Rapier C — 2D / f32 0.36.0+c.0
Loading...
Searching...
No Matches
R2SoftBodyDesc Struct Reference

Copyable recipe, not an owned procedural builder. More...

#include <rapier.h>

Data Fields

uint32_t kind
 Discriminant selecting which description fields are read.
struct R2Vector a
 Recipe origin/center or first rope endpoint; use a recipe constructor.
struct R2Vector b
 Recipe half extents, second rope endpoint, or tube axis; use a recipe constructor.
struct R2Vector du
 Cloth basis step along its first parameter axis.
struct R2Vector dv
 Cloth basis step along its second parameter axis.
size_t nx
 First recipe resolution; interpretation depends on kind.
size_t ny
 Second recipe resolution; interpretation depends on kind.
size_t nz
 Third recipe resolution; interpretation depends on kind.
R2Real radius
 Radius for the selected primitive or recipe.
R2Real radiusEnd
 Radius at the second end of a tapered cloth tube.
struct R2Vector translation
 Translation vector.
struct R2OptionalReal totalMass
 Optional total mass override for generated particles.
struct R2VolumeMeshParameters meshing
 Volume-meshing parameters for a volumetric recipe.
struct R2VectorView positions
 Borrowed initial particle positions.
struct R2RealView masses
 Borrowed per-particle masses; when empty, particleMass is used.
struct R2IndexView pinned
 Borrowed indices of pinned particles.
struct R2EdgeView edges
 Borrowed edge topology; count is edges.
struct R2EdgeView bendEdges
 Borrowed bending edge constraints.
struct R2IndexView tensionOnlyEdges
 Borrowed indices of edges that resist tension only.
struct R2SoftEdgeSoftnessView edgeSoftness
 Borrowed per-edge softness overrides.
struct R2SoftEdgeTearView edgeTearResistance
 Borrowed per-edge tear-resistance overrides.
R2CellView cells
 Borrowed triangles in 2D or tetrahedra in 3D.
R2SurfaceElementView surface
 Borrowed boundary edges in 2D or triangles in 3D.
struct R2VectorView skinVertices
 Borrowed skin vertex positions.
R2SurfaceElementView skinIndices
 Borrowed skin topology.
struct R2SoftBodyDescView appended
 Borrowed descriptions merged into this body, their particles numbered after this one's in order.
struct R2EdgeView addedEdges
 Borrowed structural edges added after appending (seams); indices count this body's particles then the appended ones.
struct R2SoftBodyMaterial material
 Soft-body material coefficients.
uint32_t cellModel
 R2_SOFT_CELL_VOLUME, R2_SOFT_CELL_COROTATIONAL, or R2_SOFT_CELL_NEO_HOOKEAN.
uint32_t solver
 0 = constraints, 1 = FEM (requires a library built with FEM).
R2Real particleMass
 Default nonnegative particle mass.
struct R2OptionalReal particleRadius
 Disabled by default: retain the radius computed by the generator.
R2Bool volumePreservation
 Whether to preserve volume.
R2Real volumeFactor
 Target volume multiplier.
struct R2OptionalBool shapeMatching
 Optional shape-matching override; disabled retains recipe defaults.
struct R2OptionalBool oriented
 Optional override of the ORIENTED flag of the generated collision surface (when disabled, a closed surface is oriented).
R2Bool selfContacts
 Whether self-collision is enabled.
R2Bool skinCollision
 Whether skin elements participate in collision detection.
R2Bool collisionEnabled
 Whether the generated collision geometry is enabled.
struct R2ColliderDesc collider
 Collider configuration used by the recipe; shape comes from the generated geometry.
R2Real linearDamping
 Nonnegative linear damping coefficient.
R2Real gravityScale
 Multiplier applied to world gravity.
size_t additionalSolverIterations
 Extra solver iterations for this body and connected bodies.
size_t additionalPgsIterations
 Extra PGS iterations for this body.
R2Bool canSleep
 Whether automatic sleeping is allowed.
int8_t dominanceGroup
 Signed dominance group; larger groups dominate smaller groups.
struct R2UserData userData
 Application data; Rapier does not own pointers encoded in it.

Detailed Description

Copyable recipe, not an owned procedural builder.

Initialize before editing. All array views borrow caller data until build/insert returns; counts for topology arrays are element counts (edges, triangles, or tetrahedra). Nonempty topology overrides the generator's topology. Zero counts retain it. Generator inputs: a/b are rope ends or center/half-extents; cloth uses a/du/dv. R2_SOFT_DESC_POLYGON reads positions; R2_SOFT_DESC_TRIMESH reads positions and cells (its triangles become edges and a boundary, not cells).

Field Documentation

◆ a

struct R2Vector R2SoftBodyDesc::a

Recipe origin/center or first rope endpoint; use a recipe constructor.

◆ addedEdges

struct R2EdgeView R2SoftBodyDesc::addedEdges

Borrowed structural edges added after appending (seams); indices count this body's particles then the appended ones.

Their rest length is the current distance of their particles.

◆ additionalPgsIterations

size_t R2SoftBodyDesc::additionalPgsIterations

Extra PGS iterations for this body.

◆ additionalSolverIterations

size_t R2SoftBodyDesc::additionalSolverIterations

Extra solver iterations for this body and connected bodies.

◆ appended

struct R2SoftBodyDescView R2SoftBodyDesc::appended

Borrowed descriptions merged into this body, their particles numbered after this one's in order.

Each contributes its particles, masses, pinned particles and elements (after its own translation and total mass); every other setting comes from this description. Appended descriptions cannot append others nor have a skin.

◆ b

struct R2Vector R2SoftBodyDesc::b

Recipe half extents, second rope endpoint, or tube axis; use a recipe constructor.

◆ bendEdges

struct R2EdgeView R2SoftBodyDesc::bendEdges

Borrowed bending edge constraints.

◆ canSleep

R2Bool R2SoftBodyDesc::canSleep

Whether automatic sleeping is allowed.

◆ cellModel

uint32_t R2SoftBodyDesc::cellModel

R2_SOFT_CELL_VOLUME, R2_SOFT_CELL_COROTATIONAL, or R2_SOFT_CELL_NEO_HOOKEAN.

◆ cells

R2CellView R2SoftBodyDesc::cells

Borrowed triangles in 2D or tetrahedra in 3D.

◆ collider

struct R2ColliderDesc R2SoftBodyDesc::collider

Collider configuration used by the recipe; shape comes from the generated geometry.

◆ collisionEnabled

R2Bool R2SoftBodyDesc::collisionEnabled

Whether the generated collision geometry is enabled.

◆ dominanceGroup

int8_t R2SoftBodyDesc::dominanceGroup

Signed dominance group; larger groups dominate smaller groups.

◆ du

struct R2Vector R2SoftBodyDesc::du

Cloth basis step along its first parameter axis.

◆ dv

struct R2Vector R2SoftBodyDesc::dv

Cloth basis step along its second parameter axis.

◆ edges

struct R2EdgeView R2SoftBodyDesc::edges

Borrowed edge topology; count is edges.

◆ edgeSoftness

struct R2SoftEdgeSoftnessView R2SoftBodyDesc::edgeSoftness

Borrowed per-edge softness overrides.

◆ edgeTearResistance

struct R2SoftEdgeTearView R2SoftBodyDesc::edgeTearResistance

Borrowed per-edge tear-resistance overrides.

◆ gravityScale

R2Real R2SoftBodyDesc::gravityScale

Multiplier applied to world gravity.

◆ kind

uint32_t R2SoftBodyDesc::kind

Discriminant selecting which description fields are read.

◆ linearDamping

R2Real R2SoftBodyDesc::linearDamping

Nonnegative linear damping coefficient.

◆ masses

struct R2RealView R2SoftBodyDesc::masses

Borrowed per-particle masses; when empty, particleMass is used.

◆ material

struct R2SoftBodyMaterial R2SoftBodyDesc::material

Soft-body material coefficients.

◆ meshing

struct R2VolumeMeshParameters R2SoftBodyDesc::meshing

Volume-meshing parameters for a volumetric recipe.

◆ nx

size_t R2SoftBodyDesc::nx

First recipe resolution; interpretation depends on kind.

◆ ny

size_t R2SoftBodyDesc::ny

Second recipe resolution; interpretation depends on kind.

◆ nz

size_t R2SoftBodyDesc::nz

Third recipe resolution; interpretation depends on kind.

◆ oriented

struct R2OptionalBool R2SoftBodyDesc::oriented

Optional override of the ORIENTED flag of the generated collision surface (when disabled, a closed surface is oriented).

Set it to false for a shell whose inner side holds bodies.

◆ particleMass

R2Real R2SoftBodyDesc::particleMass

Default nonnegative particle mass.

◆ particleRadius

struct R2OptionalReal R2SoftBodyDesc::particleRadius

Disabled by default: retain the radius computed by the generator.

◆ pinned

struct R2IndexView R2SoftBodyDesc::pinned

Borrowed indices of pinned particles.

◆ positions

struct R2VectorView R2SoftBodyDesc::positions

Borrowed initial particle positions.

◆ radius

R2Real R2SoftBodyDesc::radius

Radius for the selected primitive or recipe.

◆ radiusEnd

R2Real R2SoftBodyDesc::radiusEnd

Radius at the second end of a tapered cloth tube.

◆ selfContacts

R2Bool R2SoftBodyDesc::selfContacts

Whether self-collision is enabled.

◆ shapeMatching

struct R2OptionalBool R2SoftBodyDesc::shapeMatching

Optional shape-matching override; disabled retains recipe defaults.

◆ skinCollision

R2Bool R2SoftBodyDesc::skinCollision

Whether skin elements participate in collision detection.

◆ skinIndices

R2SurfaceElementView R2SoftBodyDesc::skinIndices

Borrowed skin topology.

◆ skinVertices

struct R2VectorView R2SoftBodyDesc::skinVertices

Borrowed skin vertex positions.

◆ solver

uint32_t R2SoftBodyDesc::solver

0 = constraints, 1 = FEM (requires a library built with FEM).

◆ surface

R2SurfaceElementView R2SoftBodyDesc::surface

Borrowed boundary edges in 2D or triangles in 3D.

◆ tensionOnlyEdges

struct R2IndexView R2SoftBodyDesc::tensionOnlyEdges

Borrowed indices of edges that resist tension only.

◆ totalMass

struct R2OptionalReal R2SoftBodyDesc::totalMass

Optional total mass override for generated particles.

◆ translation

struct R2Vector R2SoftBodyDesc::translation

Translation vector.

◆ userData

struct R2UserData R2SoftBodyDesc::userData

Application data; Rapier does not own pointers encoded in it.

◆ volumeFactor

R2Real R2SoftBodyDesc::volumeFactor

Target volume multiplier.

◆ volumePreservation

R2Bool R2SoftBodyDesc::volumePreservation

Whether to preserve volume.


The documentation for this struct was generated from the following file: