Skip to content

raisim::contact::Single3DContactProblem ​

class · #include <raisim/contact/BisectionContactSolver.hpp>

One constraint row (contact, joint limit, wire or pin) of the contact problem that the World solves each step; World::getContactProblem() exposes the list. For contact rows, imp_i is expressed in the contact frame of the corresponding Contact and acts on obA (obB receives the negated impulse).

64-byte aligned so that the hot region below always occupies the same cache lines of every element (with the natural 8-byte alignment, the 16-byte drift of the 848-byte stride made the hot region straddle a different set of lines for each contact)

Constructors & destructor ​

Single3DContactProblem ​

cpp
Single3DContactProblem(
    const MaterialPairProperties &mat,
    double x,
    double y,
    double z,
    double depth_in)

Parameters

ParameterDescription
mat (in)Material-pair properties (friction, restitution, static/rolling/spinning friction).
x (in)Contact position x in the world frame.
y (in)Contact position y in the world frame.
z (in)Contact position z in the world frame.
depth_in (in)Signed separation (negative when penetrating), see Contact::getDepth().
cpp
Single3DContactProblem() = default

Keep it defaulted: value-initialization (emplace_back()) then zero-fills every member without a default member initializer and makes Mapp_i the active union member. The world refills the same row storage every step, and joint-limit and joint-friction rows set only the fields they use, so a user-provided constructor would hand them the fields of the row stored there before.

Public member functions ​

checkRank ​

cpp
void checkRank()

Lower rank of a rank-3 contact or pin row whose apparent inverse inertia is degenerate (see contact::rank).

hasAngularFriction ​

cpp
bool hasAngularFriction() const

Returns true if rolling or spinning friction is enabled for this contact.

Public attributes ​

obA ​

cpp
Object *obA

members are ordered hot-to-cold for the Gauss-Seidel sweep. the fields from obA through normVecRatio are exactly 320 bytes (5 cache lines): everything a rank-3 single-body contact touches per sweep visit, including the slipping branch. basisMat and the 2x2 matrices (rank 2) and the sparse pointers (articulated systems) follow

obB ​

cpp
Object *obB

rank ​

cpp
int rank

Constraint kind, one of the contact::rank values.

imp_i ​

cpp
raisim::Vec<3> imp_i

imp_i: the solved impulse (contact frame for contact rows), acting on obA.

velInit ​

cpp
raisim::Vec<3> velInit

MappInv_i ​

cpp
raisim::Mat<3, 3> MappInv_i

Inverse apparent inertia (Delassus matrix) of the row: sum of both objects' contributions.

Mapp_i ​

cpp
raisim::Mat<3, 3> Mapp_i

terrainState ​

cpp
TerrainContactSolveState terrainState

(anonymous union) ​

An anonymous union: its members are listed with the other attributes and share storage.

Soil rows do not need a sticking inverse. Reuse its storage for their per-solve constants and pressure evaluations without widening any contact row.

mu ​

cpp
double mu

mu: Coulomb friction coefficient of the material pair, after static-friction blending (muinv = 1 / mu).

n2_mu ​

cpp
double n2_mu

muinv ​

cpp
double muinv

bouceVel ​

cpp
double bouceVel

tempE ​

cpp
double tempE

JA ​

cpp
const Mat<3, 6> *JA

direct pointers to the body data of single-body objects. they let the solver skip the virtual dispatch of the velocity updates in the iteration loop. null for other objects

JB ​

cpp
const Mat<3, 6> *JB

MinvJTA ​

cpp
const Mat<6, 3> *MinvJTA

MinvJTB ​

cpp
const Mat<6, 3> *MinvJTB

genVelA ​

cpp
Vec<6> *genVelA

genVelB ​

cpp
Vec<6> *genVelB

normVecRatio ​

cpp
raisim::Vec<2> normVecRatio

MappInv_i(k,2)/MappInv_i(2,2) for k=0,1. the slipping branch rebuilds the reduced apparent-inverse-mass matrix (MappInv_i's first two columns with their normal component projected out) from these two ratios instead of reading a stored 3x2 matrix Terrain rows instead cache a depth and its exact Bekker yield pressure here.

pointIdA ​

cpp
size_t pointIdA

jointId ​

cpp
size_t jointId

(anonymous union) ​

An anonymous union: its members are listed with the other attributes and share storage.

pointIdB ​

cpp
size_t pointIdB

basisMat ​

cpp
Mat<3, 2> basisMat

Mapp_iInv22 ​

cpp
raisim::Mat<2, 2> Mapp_iInv22

Terrain rows cache Wtt^-1 in Mapp_iInv22 for sticking updates during this solve. Mapp_i22 holds a shear-mobilization anchor in its first column and the tangential determinant and mobility bound in its second column.

Mapp_i22 ​

cpp
raisim::Mat<2, 2> Mapp_i22

Mapp_iInv11 ​

cpp
double Mapp_iInv11

sJA ​

cpp
const SparseJacobian *sJA

sparse direct-access counterparts for articulated systems (null for other objects). kept out of the single-body hot region above: they are touched only for articulated contacts, whose local solves span extra cache lines anyway

sJB ​

cpp
const SparseJacobian *sJB

sMinvJTA ​

cpp
const MatDyn *sMinvJTA

sMinvJTB ​

cpp
const MatDyn *sMinvJTB

sGenVelA ​

cpp
VecDyn *sGenVelA

sGenVelB ​

cpp
VecDyn *sGenVelB

rollingSpinMappInv_i ​

cpp
raisim::Mat<3, 3> rollingSpinMappInv_i

fields below are only touched during problem setup or for angular friction

rollingSpinMapp_i ​

cpp
raisim::Mat<3, 3> rollingSpinMapp_i

axis ​

cpp
Vec<3> axis

rollingSpinImp_i ​

cpp
raisim::Vec<3> rollingSpinImp_i

angularVelInit ​

cpp
raisim::Vec<3> angularVelInit

The angular velocity of a kinematic partner in the contact frame, signed as velInit (obA's minus obB's): rolling and spinning friction hold a body to it, as velInit holds it to the partner's surface. It sits in the row's tail padding (the row stays 896 bytes).

approachAllowance ​

cpp
double approachAllowance

A speculative (swept-CCD) contact, not touching yet: the normal approach speed it lets the bodies close at this step (approachAllowance, its gap over the time step). It takes the surface's restitution only if the approach closes its gap. In the tail padding too.

speculative ​

cpp
bool speculative

coeffRes ​

cpp
double coeffRes

coeffRes: restitution coefficient; bounceThres: restitution threshold velocity; depth: signed separation (negative when penetrating).

bounceThres ​

cpp
double bounceThres

impact_vel ​

cpp
double impact_vel

depth ​

cpp
double depth

position_W ​

cpp
raisim::Vec<3> position_W

Contact position used by the solver, world frame.

mu_static ​

cpp
double mu_static

mu_static: static friction coefficient. Below the tangential speed mu_static_vel_thresh, mu is blended linearly toward it.

mu_static_vel_thresh ​

cpp
double mu_static_vel_thresh

mu_static_vel_thresh_inv ​

cpp
double mu_static_vel_thresh_inv

rolling_friction ​

cpp
double rolling_friction

rolling_friction / spinning_friction: angular friction coefficients of the material pair.

spinning_friction ​

cpp
double spinning_friction

rolling_radius ​

cpp
double rolling_radius

approachVel ​

cpp
double approachVel

normal relative velocity before any contact impulse is applied. used to detect impacts

angular_friction_ready ​

cpp
bool angular_friction_ready

particleContact ​

cpp
bool particleContact

set by the solver at setup: one of the objects is deformable or granular, so the contact point is a particle or mesh vertex. such contacts are skipped exactly and never warm started

pinError_W ​

cpp
Vec<3> pinError_W

Pin rows use a fixed world basis. The error and cached impulse have that basis.

pinWarmStart ​

cpp
Vec<3> *pinWarmStart

terrainLaw ​

cpp
const TerrainContactLaw *terrainLaw

Non-null for an area quadrature contact with a deformable soil surface.

RaiSim — physics for robotics and AI.