I am new to Processing and am using this for a project I am working on: I wish to import a simple STL object (produce by 3D Studio MAX) into Processing, unwrap it into a 2D plane so I can run agents on whole the surface across the edges. The result is then exported to be use as a texture in another 3D rendering software for wrapping.
People have recommended me to use Toxiclib's WETriangleMesh to represent the object in Processing, this way the vertices connection can be saved when I unwrap the mesh.
As I am new to Processing (I am discovering new things to help with each step I make), I only have a vague idea how each step would work and not certain where to start.
As a starting point, I looked up Toxiclib's STLImportTest example and successfully imported a test box object as a TriangleMesh. I am stuck on how to convert that into a WETriangleMesh class.
Any help or suggestion will be greatly appreciated.
STLReader can load into WETriangleMesh instances directly, no need to go the addMesh() route... just change the mesh type parameter for loadBinary():
mesh = (WETriangleMesh) new STLReader().loadBinary(sketchPath("mesh.stl"), STLReader.WEMESH);
Btw. Some people were asking me why the explicit type cast is needed with this and the various .toMesh() methods (example). The reason for that is architecture. In order to support different mesh types, all those methods return only the generic Mesh3D interface and for a lot of cases this is sufficient. However, if you later need to access type specific features (e.g. WETriangleMesh.subdivide()) then you need to cast the returned mesh into the specific type.
Second part, Flatworld: At current complete mesh unwrapping is not yet supported, although a partly implemented version exists outside the library codebase. This project is in dire need to be updated with all these new things, but can't give you a schedule yet. The next toxiclibs release & documentation system is currently more important (and getting there)...