warp.Mesh#
- class warp.Mesh(*args, **kwargs)[source]#
Triangle mesh for collision detection, ray casting, and spatial queries.
- __init__(
- points,
- indices,
- velocities=None,
- support_winding_number=False,
- bvh_constructor=None,
- bvh_leaf_size=None,
- groups=None,
Class representing a triangle mesh.
- id#
Unique identifier for this mesh object, can be passed to kernels.
- device#
Device this object lives on, all buffers must live on the same device.
- Parameters:
points (array) – Array of vertex positions of data type
warp.vec3.indices (array) – Array of triangle indices of data type
warp.int32. Should be a 1D array with shape(num_tris * 3).velocities (array | None) – Optional array of vertex velocities of data type
warp.vec3.support_winding_number (bool) – If
True, the mesh will build additional data structures to supportwarp.mesh_query_point_sign_winding_number()queries.bvh_constructor (BvhConstructor | str | None) – The construction algorithm for the underlying BVH (see the docstring of
Bvhfor explanation). Valid choices are"sah","median","lbvh","cubql", orNone. When"cubql"is selected (experimental), only ray query APIs are supported. All other queries will silently return no results.bvh_leaf_size (int | None) – The number of primitives (AABBs) stored in each leaf node (see the docstring of
Bvhfor more details). IfNonethe default value based on thebvh_constructorwill be used.groups (array | None) – Optional array of triangle group indices of data type
warp.int32. Should be a 1D array with shape(num_tris).
Methods
__init__(points, indices[, velocities, ...])Class representing a triangle mesh.
refit()Refit the BVH to points.
Attributes
The array of mesh's vertex positions of type
warp.vec3.The array of mesh's velocities of type
warp.vec3.- vars: ClassVar[dict[str, _Var]] = {'indices': <warp._src.codegen.Var object>, 'points': <warp._src.codegen.Var object>, 'velocities': <warp._src.codegen.Var object>}#
- property points[source]#
The array of mesh’s vertex positions of type
warp.vec3.The Mesh.points property has a custom setter method. Users can modify the vertex positions in-place, but
refit()must be called manually after such modifications. Alternatively, assigning a new array to this property is also supported. The new array must have the same shape as the original, and once assigned, TheMeshwill automatically perform a refit operation based on the new vertex positions.