I have a bunch of vertices in a point cloud stored in an obj file (i can change the file if need be).

How do I calculate the faces from the point cloud using python? Example:

v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
v -1.000000 0.000000 0.000000
v 0.000000 0.000000 1.000000
v 1.000000 0.000000 0.000000
v 0.000000 0.000000 -1.000000
v 0.000000 0.000000 0.000000

Edit: I may have to calculate the normal's too, right?

  • $\begingroup$ I suggest taking a look at Poisson reconstruction and Delaunay triangulation. This question will likely be closed as off topic though, since this is more about computer graphics in general and not about Blender. $\endgroup$ – Robert Gützkow Aug 4 '19 at 19:58
  • $\begingroup$ This is a really broad scope of work, and much of it hinges on computational geometry algorithms which would probably be better suited to other stackexchange sites (although some small bits of comp geo stuff is generally alright here, you may more help at programming and mathematics specific stacks). It would be better to narrow this down to specific parts that relate directly to Blender, and ask those here. $\endgroup$ – Sazerac Aug 5 '19 at 2:36
  • $\begingroup$ In particular, the computer graphics beta site might be a good place to ask about some parts of the process computergraphics.stackexchange.com/questions. $\endgroup$ – Sazerac Aug 5 '19 at 2:42

OK my search for this answer wasn't so straight forward. I knew how to solve this with MeshLab, but I couldn't get another python functions to work so...

I ended up just writing a script that ran MeshLab. This helped: https://stackoverflow.com/questions/54143202/using-meshlab-function-with-python

The only thing to note is that it appears that calculating normals via the script wont work. Other than that follow the instructions for running a script.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.