warp.mesh_get_point#
- warp.mesh_get_point(id: uint64, index: int32) vec3f#
Kernel
Look up the position of a face’s vertex in the
warp.Mesh.indexis a face-vertex index: a position in the mesh’s index buffer, in[0, 3 * number_of_faces), where positions3*f,3*f + 1,3*f + 2belong to facef. Returns the position of the vertex referenced there, i.e.points[indices[index]], in the mesh’s local space. Usemesh_get_index()to obtain that vertex index itself.- Parameters:
id – The mesh identifier
index – A face-vertex index, in
[0, 3 * number_of_faces)
- Returns:
The referenced vertex’s position, in the mesh’s local space.
Example
@wp.kernel def slot0(mesh_id: wp.uint64, out: wp.array[wp.vec3]): out[0] = wp.mesh_get_point(mesh_id, 0) points = wp.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]], dtype=wp.vec3) indices = wp.array([0,3,2, 0,2,1, 4,5,6, 4,6,7, 0,1,5, 0,5,4, 2,3,7, 2,7,6, 0,4,7, 0,7,3, 1,2,6, 1,6,5], dtype=wp.int32) mesh = wp.Mesh(points=points, indices=indices) out = wp.zeros(1, dtype=wp.vec3) wp.launch(slot0, dim=1, inputs=[mesh.id], outputs=[out]) print(out.numpy()[0])
[0. 0. 0.]