Hello OpenMesh,
I would like to be able to quickly copy a numpy array of vertices and faces into a TriMesh. After some digging I found this task https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python/issues/18 which suggests assigning multiple points by doing `m.points()[:] = p`. I can't, however, figure out how to resize the points array without using `add_point` or `new_vertex`.
Any help would be much appreciated.
As an aside, it would be great to be able to post and comment on issues. Is there a reason the project is managed such that gitlab project is readonly?
Best regards,
Hi,
if you just want to create a mesh with given points (and faces) you can directly do something like this: mesh = om.TriMesh(np.random.rand(1000,3))
It would probably make sense to expose functions that allow adding point (and face) arrays to an existing mesh.
Best, - Isaak Lim
On 30.10.19 18:15, Jesse Vander Does wrote:
Hello OpenMesh,
I would like to be able to quickly copy a numpy array of vertices and faces into a TriMesh. After some digging I found this task https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python/issues/18%... suggests assigning multiple points by doing `m.points()[:] = p`. I can't, however, figure out how to resize the points array without using `add_point` or `new_vertex`.
Any help would be much appreciated.
As an aside, it would be great to be able to post and comment on issues. Is there a reason the project is managed such that gitlab project is readonly?
Best regards,
Jesse Vander Does 424-465-0285 | jvanderdoes@gmail.com mailto:jvanderdoes@gmail.com
OpenMesh mailing list -- openmesh@lists.rwth-aachen.de To unsubscribe send an email to openmesh-leave@lists.rwth-aachen.de https://lists.rwth-aachen.de/postorius/lists/openmesh.lists.rwth-aachen.de
Hi,
I added the functions Isaak mentioned earlier. If you build from source, there are now three ways to add vertices and faces to a mesh using numpy arrays:
1. Using the mesh constructor as described by Isaak: mesh = om.TriMesh(points, face_vertex_indices). Here points is an array of vertex coordinates with shape (n, 3) and face_vertex_indices is an array of vertex indices with shape (m, 3) where each row defines a triangle.
2. By passing an array of vertex coordinates to mesh.add_vertices() or by passing an array of face_vertex_indices to mesh.add_faces().
3. By first calling mesh.resize_points(n) and then directly modifying the array returned by mesh.points().
Best regards, Alex
On 30. Oct 2019, at 18:15, Jesse Vander Does <jvanderdoes@gmail.commailto:jvanderdoes@gmail.com> wrote:
Hello OpenMesh,
I would like to be able to quickly copy a numpy array of vertices and faces into a TriMesh. After some digging I found this task https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python/issues/18 which suggests assigning multiple points by doing `m.points()[:] = p`. I can't, however, figure out how to resize the points array without using `add_point` or `new_vertex`.
Any help would be much appreciated.
As an aside, it would be great to be able to post and comment on issues. Is there a reason the project is managed such that gitlab project is readonly?
Best regards, -- Jesse Vander Does 424-465-0285 | jvanderdoes@gmail.commailto:jvanderdoes@gmail.com _______________________________________________ OpenMesh mailing list -- openmesh@lists.rwth-aachen.demailto:openmesh@lists.rwth-aachen.de To unsubscribe send an email to openmesh-leave@lists.rwth-aachen.demailto:openmesh-leave@lists.rwth-aachen.de https://lists.rwth-aachen.de/postorius/lists/openmesh.lists.rwth-aachen.de