I am creating a CAD file converter on top of two libraries (Opencascade and DWF Toolkit).
However, my question is the agnostic plattform:
Given:
I created a grid, since the list of triangular faces forms the model created in my application. Each triangle is defined by three vertices, which consist of three floats (x, y and z coordinates). Since triangles form a grid, most vertices are separated by more than one triangle.
Purpose:
I need to find a list of unique vertices and generate an array of faces consisting of tuples of three indices in this list.
What I want to do is:
for each triangle
for each vertex in triangle
if not vertex in listOfVertices
Add vertex to listOfVertices
for each triangle
for each vertex in triangle
Get Vertex Index From listOfvertices
AddToMap(vertex Index, triangle)
, , step1 ( ) O (n!), , . : ", - " std:: map, ! ", , - .
stackoverflow: - -, 3 , 3d-.