Difference between separate points and shared points:
Having an object, we know that it is described makes several polygons. Each polygon is defined by 3 or 4 points or more points. (Typically CADs use only 3 points per polygon)
Some Polygons that form the object have the same vertices as those next to it (see image,)
so they could be calculated only once.
To do this we must keep a list of unique vertices. The polygons instead of containing 3 points, contain three links to three points in the list of vertices.
In the image above we see that the points calculated from 35 are reduced only 15. Theoretically the calculation time is halved. How to implement it.
In separate points you need to have a list that contains a custom type.
Type MyTypePolygon (Polygon_ID as int, ListPoint as List)
Type MyVertices (X as Float,Y as Float, Z as Float)
Dim ListPolygon as List
.....
ListPolygon.initialize
Dim NewPolygon as MyTypePolygon
NewPolygon.Initialize
NewPolygon.ID=100
NewPolygon.ListPoint.Initialize
Dim Point as MyVertices
Point.Initialize
Point.X=0
Point.Y=1
Point.Z=2
NewPolygon.ListPoint.Ad(Point)
ListPolygon.Add(NewPolygon)
ListPolygon
In shared points you need to have a custom list, which will contain the identifier of the polygon and a list of Indices
Type MyTypePolygon (Polygon_ID as int, ListIndex_Of_Point as List)
Type MyVertices (X as Float,Y as Float, Z as Float)
Dim ListPolygon as List
Dim ListVertices as List
.....
ListPolygon.Initialize
ListVertices.Initialize
Dim Point as MyVertices
Point.Initialize
Point.X=0
Point.Y=1
Point.Z=2
Dim Position_InTo_ListVertice as int = AddVertice_If_not_Exist(ListVertices,Point)
Dim NewPolygon as MyTypePolygon
NewPolygon.Initialize
NewPolygon.ID=100
NewPolygon.ListIndex_Of_Point.Initialize
NewPolygon.ListIndex_Of_Point.Add(Position_InTo_ListVertice)
.....
This is just a simplified example to show how to implement a list of shared points.
Although theoretically you save computation time and it should be fast, managing multiple lists, indexing and searching if points already exist lower performance.
At least if I do not understand a better method of implementation
Update:
It seems that having
shared points is effective when the object has many points, we speak of the order of tens of thousands / hundreds of thousands or even millions of points.
Below these sizes it is not very performing