After receiving a collection of 200+ vertices from the AutoCad API in the format of an array of vectors {X:,Y:,Z:}, I have been struggling to render them in THREE.js.
Currently, my approach involves creating all possible permutations for the 200 vertices and connecting them together. However, this method has resulted in over 200k faces, which I believe is not the correct way to achieve the desired rendering.
Update: In my AutoCAD code, I am retrieving all vertices and attempting to obtain the ids of their connected vertices (vertex1 and vertex2). Despite using GetHashCode(), I encountered issues where the generated id numbers (e.g., 148335760 and 682610240) are not unique or properly linked to other vertices.
Snippet of AutoCAD code:
//data structures for serialisation
public class EdgeMe
{
public int vertex1;
public int vertex2;
}
public class VertexMe
{
public int id;
public Point3d Point;
public List<EdgeMe> Edges = new List<EdgeMe>();
}
public class DataMe{
public Extents3d extents;
public string layer;
public List<VertexMe> points = new List<VertexMe>();
}
//...
// Further implementation details
Javascript snippet:
var faces = function(vertices) {
// Function logic here
};
var generate = function( ... ) {
// Code for generating and rendering objects in THREE.js
}
Best Regards,
Ioan