Rapier C — 2D / f32 0.36.0+c.0
Loading...
Searching...
No Matches
Shapes and mesh data

Shared immutable geometry and copied rendering data. More...

Data Structures

struct  R2VolumeMeshParameters
 Parameters for the native volumetric mesher. More...
struct  R2CompoundShapeView
 Borrowed elements; count counts elements. More...
struct  R2ShapeDesc
 Non-owning shape description. More...
struct  R2CompoundShapeDesc
 One compound child with a local pose and borrowed geometry description. More...

Macros

#define R2_POLYLINE_ORIENTED   1
 Treat the 2D polyline as oriented when generating contact normals.
#define R2_POLYLINE_DEFORMABLE   2
 Prepare polyline acceleration data for deformation.
#define R2_SHAPE_DESC_BALL   0
 ShapeDesc kind selecting a ball.
#define R2_SHAPE_DESC_CUBOID   1
 ShapeDesc kind selecting a cuboid.
#define R2_SHAPE_DESC_ROUND_CUBOID   2
 ShapeDesc kind selecting a round cuboid.
#define R2_SHAPE_DESC_CAPSULE   3
 ShapeDesc kind selecting a capsule.
#define R2_SHAPE_DESC_SEGMENT   4
 ShapeDesc kind selecting a segment.
#define R2_SHAPE_DESC_TRIANGLE   5
 ShapeDesc kind selecting a triangle.
#define R2_SHAPE_DESC_HALFSPACE   6
 ShapeDesc kind selecting a half-space.
#define R2_SHAPE_DESC_CONVEX_HULL   7
 ShapeDesc kind selecting a convex hull.
#define R2_SHAPE_DESC_TRIMESH   8
 ShapeDesc kind selecting a triangle mesh.
#define R2_SHAPE_DESC_POLYLINE   9
 ShapeDesc kind selecting a polyline.
#define R2_SHAPE_DESC_SHARED   10
 ShapeDesc kind selecting borrowed shared geometry.
#define R2_SHAPE_DESC_HEIGHTFIELD   11
 ShapeDesc kind selecting a heightfield.
#define R2_SHAPE_DESC_CYLINDER   12
 ShapeDesc kind selecting a cylinder.
#define R2_SHAPE_DESC_CONE   13
 ShapeDesc kind selecting a cone.
#define R2_SHAPE_DESC_COMPOUND   14
 ShapeDesc kind selecting compound child shapes.
#define R2_SHAPE_DESC_ROUND_CYLINDER   15
 ShapeDesc kind selecting a round cylinder.
#define R2_SHAPE_DESC_ROUND_CONE   16
 ShapeDesc kind selecting a round cone.
#define R2_TRIMESH_HALF_EDGE_TOPOLOGY   1
 Compute the half-edge topology of the triangle mesh.
#define R2_TRIMESH_CONNECTED_COMPONENTS   2
 Compute the connected components of the triangle mesh.
#define R2_TRIMESH_DELETE_BAD_TOPOLOGY_TRIANGLES   4
 Delete the triangles breaking the half-edge topology.
#define R2_TRIMESH_ORIENTED   8
 Treat the triangle mesh as oriented (outward normals) and compute its pseudo-normals.
#define R2_TRIMESH_MERGE_DUPLICATE_VERTICES   16
 Merge triangle-mesh vertices with identical positions.
#define R2_TRIMESH_DELETE_DEGENERATE_TRIANGLES   32
 Delete the triangles with a zero area.
#define R2_TRIMESH_DELETE_DUPLICATE_TRIANGLES   64
 Delete the triangles sharing their three vertices with another triangle.
#define R2_TRIMESH_FIX_INTERNAL_EDGES   144
 Correct contact normals at internal mesh edges; includes duplicate-vertex merging.
#define R2_TRIMESH_DEFORMABLE   256
 Prepare triangle-mesh acceleration data for deformation.
#define R2_TRIMESH_FIX_INTERNAL_EDGES_TWO_SIDED   656
 Correct internal-edge contacts on both sides of the triangle mesh.
#define R2_HEIGHTFIELD_FIX_INTERNAL_EDGES   1
 Correct contact normals at internal heightfield edges.

Typedefs

typedef struct R2ShapeMesh R2ShapeMesh
 Owned tessellated shape: flat triangle vertices and independent line segments, in local space.
typedef struct R2VolumeMeshParameters R2VolumeMeshParameters
 Parameters for the native volumetric mesher.
typedef struct R2SharedShape R2SharedShape
 Opaque SharedShape.
typedef struct R2CompoundShapeView R2CompoundShapeView
 Borrowed elements; count counts elements.
typedef struct R2ShapeDesc R2ShapeDesc
 Non-owning shape description.
typedef struct R2CompoundShapeDesc R2CompoundShapeDesc
 One compound child with a local pose and borrowed geometry description.

Functions

struct R2ShapeCastHit r2CastShape (const struct R2World *world, const struct R2QueryOptions *query_options, struct R2Pose pose, struct R2Vector velocity, const R2SharedShape *shape, struct R2ShapeCastOptions options)
 Sweep shape from pose along velocity and return the first hit; report R2_NOT_FOUND on a miss.
size_t r2IntersectShape (const struct R2World *world, const struct R2QueryOptions *query_options, struct R2Pose pose, const R2SharedShape *shape, struct R2ColliderHandle *buffer, size_t capacity)
 Copy handles of colliders intersecting the shape at its world-space pose.
struct R2ShapeDesc r2DefaultShapeDesc (void)
 Return native default shape desc.
R2SharedShape * r2ShapeDesc_Build (const struct R2ShapeDesc *desc)
 Build an owned shared shape from a description; release it with r2FreeSharedShape.
R2SharedShape * r2BallSharedShape (R2Real radius)
 Create an owned ball shape.
R2SharedShape * r2CuboidSharedShape (struct R2Vector half_extents)
 Create an owned cuboid shape.
R2SharedShape * r2RoundCuboidSharedShape (struct R2Vector half_extents, R2Real border_radius)
 Create an owned round cuboid shape.
R2SharedShape * r2CapsuleSharedShape (struct R2Vector a, struct R2Vector b, R2Real radius)
 Create an owned capsule shape.
R2SharedShape * r2SegmentSharedShape (struct R2Vector a, struct R2Vector b)
 Create an owned segment shape.
R2SharedShape * r2TriangleSharedShape (struct R2Vector a, struct R2Vector b, struct R2Vector c)
 Create an owned triangle shape.
R2SharedShape * r2HalfspaceSharedShape (struct R2Vector normal)
 Create an owned halfspace shape.
R2SharedShape * r2CompoundSharedShape (struct R2CompoundShapeView children)
 Create an owned compound shape; each child pose is relative to the compound.
R2Status r2FreeSharedShape (R2SharedShape *object)
 Frees an owned object; NULL is allowed.
R2SharedShape * r2SharedShape_Clone (const R2SharedShape *object)
 Create an owned wrapper sharing the same immutable geometry.
R2SharedShape * r2HeightfieldSharedShape (struct R2RealView heights, size_t rows, size_t columns, struct R2Vector scale)
 Create an owned heightfield shape from copied samples.
struct R2Aabb r2SharedShape_ComputeAabb (const R2SharedShape *shape, struct R2Pose pose)
 Compute the shape axis-aligned bounds at the supplied world-space pose.
struct R2MassProperties r2SharedShape_MassProperties (const R2SharedShape *shape, R2Real density)
 Compute local mass properties for the supplied nonnegative density.
R2Bool r2SharedShape_ContainsPoint (const R2SharedShape *shape, struct R2Pose pose, struct R2Vector point)
 Test whether the world-space point lies inside the shape at pose.
struct R2ShapeMesh * r2SharedShape_Tessellate (const R2SharedShape *shape, uint32_t subdivisions)
 Return owned local-space rendering geometry; release it with r2FreeShapeMesh.
size_t r2ShapeMesh_Triangles (const struct R2ShapeMesh *mesh, struct R2Vector *buffer, size_t capacity)
 Flat groups of three vertices.
size_t r2ShapeMesh_Lines (const struct R2ShapeMesh *mesh, struct R2Vector *buffer, size_t capacity)
 Flat groups of two vertices.
R2Status r2FreeShapeMesh (struct R2ShapeMesh *mesh)
 Release an owned shape mesh.
R2Status r2ShapeDesc_SetTrimesh (struct R2ShapeDesc *desc, struct R2VectorView vertices, struct R2TriangleView indices, uint32_t flags)
 Replace the shape geometry with a borrowed tri mesh.
R2Status r2ShapeDesc_SetPolyline (struct R2ShapeDesc *desc, struct R2VectorView vertices, struct R2EdgeView indices, uint32_t flags)
 Replace the shape geometry with a borrowed polyline.
R2Status r2ShapeDesc_SetConvexHull (struct R2ShapeDesc *desc, struct R2VectorView vertices)
 Replace the shape geometry with a borrowed convex hull point cloud.
size_t r2Collider_ShapeIdentity (struct R2ColliderHandle handle)
 Return a process-local geometry identity for caching, not a serializable ID.
R2SharedShape * r2Collider_CloneShape (struct R2ColliderHandle handle)
 Return an owned wrapper sharing the collider geometry.
R2Status r2Collider_SetShape (struct R2ColliderHandle handle, const R2SharedShape *shape)
 Replace collider geometry by sharing shape; the supplied wrapper is not consumed.
R2SharedShape * r2ConvexDecompositionSharedShape (struct R2VectorView vertices, R2SurfaceElementView indices)
 Create an owned compound shape by convex decomposition of the input surface.
R2SharedShape * r2VoxelsSharedShapeFromPoints (struct R2Vector voxel_size, struct R2VectorView points)
 Create an owned voxel shape by quantizing points with the supplied per-axis voxel size.
R2SharedShape * r2VoxelizedMeshSharedShape (struct R2VectorView vertices, R2SurfaceElementView indices, R2Real voxel_size)
 Create an owned voxel shape from a surface mesh with the supplied uniform voxel size.
R2SharedShape * r2ConvexHullSharedShape (struct R2VectorView vertices)
 Create an owned convex hull of the supplied vertices.
R2SharedShape * r2TrimeshSharedShape (struct R2VectorView vertices, struct R2TriangleView indices)
 Create an owned triangle mesh from vertices and triangle indices.
R2SharedShape * r2PolylineSharedShape (struct R2VectorView vertices, struct R2EdgeView indices)
 Create an owned polyline from vertices and edge indices.
R2SharedShape * r2OrientedPolylineSharedShape (struct R2VectorView vertices, struct R2EdgeView indices)
 Create an owned oriented 2D polyline from vertices and edge indices.
R2SharedShape * r2ConvexPolylineSharedShape (struct R2VectorView vertices)
 Create an owned convex polygon from vertices already ordered along its boundary.
R2SharedShape * r2RoundConvexHullSharedShape (struct R2VectorView vertices, R2Real border_radius)
 Create an owned round convex hull shape.
R2SharedShape * r2TrimeshSharedShapeWithFlags (struct R2VectorView vertices, struct R2TriangleView indices, uint32_t flags)
 Create an owned triangle mesh with the supplied TRIMESH_* processing flags.

Detailed Description

Shared immutable geometry and copied rendering data.

Owned pointers require their matching Free functions; description views remain borrowed until build/insert.

Macro Definition Documentation

◆ R2_HEIGHTFIELD_FIX_INTERNAL_EDGES

#define R2_HEIGHTFIELD_FIX_INTERNAL_EDGES   1

Correct contact normals at internal heightfield edges.

◆ R2_POLYLINE_DEFORMABLE

#define R2_POLYLINE_DEFORMABLE   2

Prepare polyline acceleration data for deformation.

◆ R2_POLYLINE_ORIENTED

#define R2_POLYLINE_ORIENTED   1

Treat the 2D polyline as oriented when generating contact normals.

◆ R2_SHAPE_DESC_BALL

#define R2_SHAPE_DESC_BALL   0

ShapeDesc kind selecting a ball.

◆ R2_SHAPE_DESC_CAPSULE

#define R2_SHAPE_DESC_CAPSULE   3

ShapeDesc kind selecting a capsule.

◆ R2_SHAPE_DESC_COMPOUND

#define R2_SHAPE_DESC_COMPOUND   14

ShapeDesc kind selecting compound child shapes.

◆ R2_SHAPE_DESC_CONE

#define R2_SHAPE_DESC_CONE   13

ShapeDesc kind selecting a cone.

◆ R2_SHAPE_DESC_CONVEX_HULL

#define R2_SHAPE_DESC_CONVEX_HULL   7

ShapeDesc kind selecting a convex hull.

◆ R2_SHAPE_DESC_CUBOID

#define R2_SHAPE_DESC_CUBOID   1

ShapeDesc kind selecting a cuboid.

◆ R2_SHAPE_DESC_CYLINDER

#define R2_SHAPE_DESC_CYLINDER   12

ShapeDesc kind selecting a cylinder.

◆ R2_SHAPE_DESC_HALFSPACE

#define R2_SHAPE_DESC_HALFSPACE   6

ShapeDesc kind selecting a half-space.

◆ R2_SHAPE_DESC_HEIGHTFIELD

#define R2_SHAPE_DESC_HEIGHTFIELD   11

ShapeDesc kind selecting a heightfield.

◆ R2_SHAPE_DESC_POLYLINE

#define R2_SHAPE_DESC_POLYLINE   9

ShapeDesc kind selecting a polyline.

◆ R2_SHAPE_DESC_ROUND_CONE

#define R2_SHAPE_DESC_ROUND_CONE   16

ShapeDesc kind selecting a round cone.

◆ R2_SHAPE_DESC_ROUND_CUBOID

#define R2_SHAPE_DESC_ROUND_CUBOID   2

ShapeDesc kind selecting a round cuboid.

◆ R2_SHAPE_DESC_ROUND_CYLINDER

#define R2_SHAPE_DESC_ROUND_CYLINDER   15

ShapeDesc kind selecting a round cylinder.

◆ R2_SHAPE_DESC_SEGMENT

#define R2_SHAPE_DESC_SEGMENT   4

ShapeDesc kind selecting a segment.

◆ R2_SHAPE_DESC_SHARED

#define R2_SHAPE_DESC_SHARED   10

ShapeDesc kind selecting borrowed shared geometry.

◆ R2_SHAPE_DESC_TRIANGLE

#define R2_SHAPE_DESC_TRIANGLE   5

ShapeDesc kind selecting a triangle.

◆ R2_SHAPE_DESC_TRIMESH

#define R2_SHAPE_DESC_TRIMESH   8

ShapeDesc kind selecting a triangle mesh.

◆ R2_TRIMESH_CONNECTED_COMPONENTS

#define R2_TRIMESH_CONNECTED_COMPONENTS   2

Compute the connected components of the triangle mesh.

◆ R2_TRIMESH_DEFORMABLE

#define R2_TRIMESH_DEFORMABLE   256

Prepare triangle-mesh acceleration data for deformation.

◆ R2_TRIMESH_DELETE_BAD_TOPOLOGY_TRIANGLES

#define R2_TRIMESH_DELETE_BAD_TOPOLOGY_TRIANGLES   4

Delete the triangles breaking the half-edge topology.

◆ R2_TRIMESH_DELETE_DEGENERATE_TRIANGLES

#define R2_TRIMESH_DELETE_DEGENERATE_TRIANGLES   32

Delete the triangles with a zero area.

◆ R2_TRIMESH_DELETE_DUPLICATE_TRIANGLES

#define R2_TRIMESH_DELETE_DUPLICATE_TRIANGLES   64

Delete the triangles sharing their three vertices with another triangle.

◆ R2_TRIMESH_FIX_INTERNAL_EDGES

#define R2_TRIMESH_FIX_INTERNAL_EDGES   144

Correct contact normals at internal mesh edges; includes duplicate-vertex merging.

◆ R2_TRIMESH_FIX_INTERNAL_EDGES_TWO_SIDED

#define R2_TRIMESH_FIX_INTERNAL_EDGES_TWO_SIDED   656

Correct internal-edge contacts on both sides of the triangle mesh.

◆ R2_TRIMESH_HALF_EDGE_TOPOLOGY

#define R2_TRIMESH_HALF_EDGE_TOPOLOGY   1

Compute the half-edge topology of the triangle mesh.

◆ R2_TRIMESH_MERGE_DUPLICATE_VERTICES

#define R2_TRIMESH_MERGE_DUPLICATE_VERTICES   16

Merge triangle-mesh vertices with identical positions.

◆ R2_TRIMESH_ORIENTED

#define R2_TRIMESH_ORIENTED   8

Treat the triangle mesh as oriented (outward normals) and compute its pseudo-normals.

Typedef Documentation

◆ R2CompoundShapeDesc

typedef struct R2CompoundShapeDesc R2CompoundShapeDesc

One compound child with a local pose and borrowed geometry description.

◆ R2CompoundShapeView

typedef struct R2CompoundShapeView R2CompoundShapeView

Borrowed elements; count counts elements.

Data must remain live through insertion.

◆ R2ShapeDesc

typedef struct R2ShapeDesc R2ShapeDesc

Non-owning shape description.

Only fields selected by kind are read. a = cuboid half extents, capsule/segment endpoint, triangle vertex, or halfspace normal. b/c = remaining endpoints/vertices. radius is also the rounded-cuboid border radius. Mesh views count edges or triangles; heightfields are column-major. Arrays, compound children, and sharedShape remain borrowed until build/insert returns.

◆ R2ShapeMesh

typedef struct R2ShapeMesh R2ShapeMesh

Owned tessellated shape: flat triangle vertices and independent line segments, in local space.

Rounded 3D shapes use their inner surface (as in the Rust testbed). Halfspaces use a finite patch.

◆ R2SharedShape

typedef struct R2SharedShape R2SharedShape

Opaque SharedShape.

See the ownership and borrowing contract in README.md.

◆ R2VolumeMeshParameters

typedef struct R2VolumeMeshParameters R2VolumeMeshParameters

Parameters for the native volumetric mesher.

Enclosure: 0 cover, 1 crust (3D).

Function Documentation

◆ r2BallSharedShape()

R2SharedShape * r2BallSharedShape ( R2Real radius)

Create an owned ball shape.

Release it with r2FreeSharedShape.

◆ r2CapsuleSharedShape()

R2SharedShape * r2CapsuleSharedShape ( struct R2Vector a,
struct R2Vector b,
R2Real radius )

Create an owned capsule shape.

Release it with r2FreeSharedShape.

◆ r2CastShape()

struct R2ShapeCastHit r2CastShape ( const struct R2World * world,
const struct R2QueryOptions * query_options,
struct R2Pose pose,
struct R2Vector velocity,
const R2SharedShape * shape,
struct R2ShapeCastOptions options )

Sweep shape from pose along velocity and return the first hit; report R2_NOT_FOUND on a miss.

Time is bounded by options.max_time_of_impact. NULL query options use the default filter. Query state reflects the latest Step or DetectCollisions call.

◆ r2Collider_CloneShape()

R2SharedShape * r2Collider_CloneShape ( struct R2ColliderHandle handle)

Return an owned wrapper sharing the collider geometry.

Release it with r2FreeSharedShape.

◆ r2Collider_SetShape()

R2Status r2Collider_SetShape ( struct R2ColliderHandle handle,
const R2SharedShape * shape )

Replace collider geometry by sharing shape; the supplied wrapper is not consumed.

◆ r2Collider_ShapeIdentity()

size_t r2Collider_ShapeIdentity ( struct R2ColliderHandle handle)

Return a process-local geometry identity for caching, not a serializable ID.

Keep a shared-shape clone alive while using it as a cache key.

◆ r2CompoundSharedShape()

R2SharedShape * r2CompoundSharedShape ( struct R2CompoundShapeView children)

Create an owned compound shape; each child pose is relative to the compound.

Child shapes are shared, not consumed. Release with r2FreeSharedShape.

◆ r2ConvexDecompositionSharedShape()

R2SharedShape * r2ConvexDecompositionSharedShape ( struct R2VectorView vertices,
R2SurfaceElementView indices )

Create an owned compound shape by convex decomposition of the input surface.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2ConvexHullSharedShape()

R2SharedShape * r2ConvexHullSharedShape ( struct R2VectorView vertices)

Create an owned convex hull of the supplied vertices.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2ConvexPolylineSharedShape()

R2SharedShape * r2ConvexPolylineSharedShape ( struct R2VectorView vertices)

Create an owned convex polygon from vertices already ordered along its boundary.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2CuboidSharedShape()

R2SharedShape * r2CuboidSharedShape ( struct R2Vector half_extents)

Create an owned cuboid shape.

Release it with r2FreeSharedShape.

◆ r2DefaultShapeDesc()

struct R2ShapeDesc r2DefaultShapeDesc ( void )

Return native default shape desc.

This POD value owns no resources.

◆ r2FreeShapeMesh()

R2Status r2FreeShapeMesh ( struct R2ShapeMesh * mesh)

Release an owned shape mesh.

NULL is allowed. Do not pass borrowed pointers or free the object twice.

◆ r2FreeSharedShape()

R2Status r2FreeSharedShape ( R2SharedShape * object)

Frees an owned object; NULL is allowed.

Never free a borrowed pointer.

◆ r2HalfspaceSharedShape()

R2SharedShape * r2HalfspaceSharedShape ( struct R2Vector normal)

Create an owned halfspace shape.

Release it with r2FreeSharedShape.

◆ r2HeightfieldSharedShape()

R2SharedShape * r2HeightfieldSharedShape ( struct R2RealView heights,
size_t rows,
size_t columns,
struct R2Vector scale )

Create an owned heightfield shape from copied samples.

3D samples are column-major, with rows * columns entries. Release with r2FreeSharedShape.

◆ r2IntersectShape()

size_t r2IntersectShape ( const struct R2World * world,
const struct R2QueryOptions * query_options,
struct R2Pose pose,
const R2SharedShape * shape,
struct R2ColliderHandle * buffer,
size_t capacity )

Copy handles of colliders intersecting the shape at its world-space pose.

The shape is borrowed for this call.

See also
Arrays and output buffers NULL query options use the default filter. Query state reflects the latest Step or DetectCollisions call.

◆ r2OrientedPolylineSharedShape()

R2SharedShape * r2OrientedPolylineSharedShape ( struct R2VectorView vertices,
struct R2EdgeView indices )

Create an owned oriented 2D polyline from vertices and edge indices.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2PolylineSharedShape()

R2SharedShape * r2PolylineSharedShape ( struct R2VectorView vertices,
struct R2EdgeView indices )

Create an owned polyline from vertices and edge indices.

Release it with r2FreeSharedShape. Empty indices connect the vertices in order (a line strip). Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2RoundConvexHullSharedShape()

R2SharedShape * r2RoundConvexHullSharedShape ( struct R2VectorView vertices,
R2Real border_radius )

Create an owned round convex hull shape.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2RoundCuboidSharedShape()

R2SharedShape * r2RoundCuboidSharedShape ( struct R2Vector half_extents,
R2Real border_radius )

Create an owned round cuboid shape.

Release it with r2FreeSharedShape.

◆ r2SegmentSharedShape()

R2SharedShape * r2SegmentSharedShape ( struct R2Vector a,
struct R2Vector b )

Create an owned segment shape.

Release it with r2FreeSharedShape.

◆ r2ShapeDesc_Build()

R2SharedShape * r2ShapeDesc_Build ( const struct R2ShapeDesc * desc)

Build an owned shared shape from a description; release it with r2FreeSharedShape.

Borrowed inputs may be released after this call.

◆ r2ShapeDesc_SetConvexHull()

R2Status r2ShapeDesc_SetConvexHull ( struct R2ShapeDesc * desc,
struct R2VectorView vertices )

Replace the shape geometry with a borrowed convex hull point cloud.

◆ r2ShapeDesc_SetPolyline()

R2Status r2ShapeDesc_SetPolyline ( struct R2ShapeDesc * desc,
struct R2VectorView vertices,
struct R2EdgeView indices,
uint32_t flags )

Replace the shape geometry with a borrowed polyline.

Counts are elements. Copies no arrays. Invalid view metadata leaves the description unchanged. Geometry and flags are validated when the description is built or inserted.

◆ r2ShapeDesc_SetTrimesh()

R2Status r2ShapeDesc_SetTrimesh ( struct R2ShapeDesc * desc,
struct R2VectorView vertices,
struct R2TriangleView indices,
uint32_t flags )

Replace the shape geometry with a borrowed tri mesh.

Counts are elements. Copies no arrays. Invalid view metadata leaves the description unchanged. Geometry and flags are validated when the description is built or inserted.

◆ r2ShapeMesh_Lines()

size_t r2ShapeMesh_Lines ( const struct R2ShapeMesh * mesh,
struct R2Vector * buffer,
size_t capacity )

Flat groups of two vertices.

Standard output-buffer convention.

See also
Arrays and output buffers

◆ r2ShapeMesh_Triangles()

size_t r2ShapeMesh_Triangles ( const struct R2ShapeMesh * mesh,
struct R2Vector * buffer,
size_t capacity )

Flat groups of three vertices.

Standard output-buffer convention.

See also
Arrays and output buffers

◆ r2SharedShape_Clone()

R2SharedShape * r2SharedShape_Clone ( const R2SharedShape * object)

Create an owned wrapper sharing the same immutable geometry.

Release it with r2FreeSharedShape.

◆ r2SharedShape_ComputeAabb()

struct R2Aabb r2SharedShape_ComputeAabb ( const R2SharedShape * shape,
struct R2Pose pose )

Compute the shape axis-aligned bounds at the supplied world-space pose.

◆ r2SharedShape_ContainsPoint()

R2Bool r2SharedShape_ContainsPoint ( const R2SharedShape * shape,
struct R2Pose pose,
struct R2Vector point )

Test whether the world-space point lies inside the shape at pose.

◆ r2SharedShape_MassProperties()

struct R2MassProperties r2SharedShape_MassProperties ( const R2SharedShape * shape,
R2Real density )

Compute local mass properties for the supplied nonnegative density.

◆ r2SharedShape_Tessellate()

struct R2ShapeMesh * r2SharedShape_Tessellate ( const R2SharedShape * shape,
uint32_t subdivisions )

Return owned local-space rendering geometry; release it with r2FreeShapeMesh.

subdivisions controls curved-shape resolution.

◆ r2TriangleSharedShape()

R2SharedShape * r2TriangleSharedShape ( struct R2Vector a,
struct R2Vector b,
struct R2Vector c )

Create an owned triangle shape.

Release it with r2FreeSharedShape.

◆ r2TrimeshSharedShape()

R2SharedShape * r2TrimeshSharedShape ( struct R2VectorView vertices,
struct R2TriangleView indices )

Create an owned triangle mesh from vertices and triangle indices.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2TrimeshSharedShapeWithFlags()

R2SharedShape * r2TrimeshSharedShapeWithFlags ( struct R2VectorView vertices,
struct R2TriangleView indices,
uint32_t flags )

Create an owned triangle mesh with the supplied TRIMESH_* processing flags.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2VoxelizedMeshSharedShape()

R2SharedShape * r2VoxelizedMeshSharedShape ( struct R2VectorView vertices,
R2SurfaceElementView indices,
R2Real voxel_size )

Create an owned voxel shape from a surface mesh with the supplied uniform voxel size.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.

◆ r2VoxelsSharedShapeFromPoints()

R2SharedShape * r2VoxelsSharedShapeFromPoints ( struct R2Vector voxel_size,
struct R2VectorView points )

Create an owned voxel shape by quantizing points with the supplied per-axis voxel size.

Release it with r2FreeSharedShape. Copies typed input geometry into an owned shared shape; arrays may be released on return.