RigsofRods
Soft-body Physics Simulation
|
#include "DynamicCollisions.h"
#include "Application.h"
#include "Actor.h"
#include "SimData.h"
#include "CartesianToTriangleTransform.h"
#include "Collisions.h"
#include "GameContext.h"
#include "PointColDetector.h"
#include "Triangle.h"
Go to the source code of this file.
Functions | |
static bool | BackfaceCollisionTest (const float distance, const Vector3 &normal, const node_t &surface_point, const std::vector< int > &neighbour_node_ids, const node_t nodes[]) |
Determine on which side of a triangle an occuring collision takes place. More... | |
static bool | InsideTriangleTest (const CartesianToTriangleTransform::TriangleCoord &local, const float margin) |
Test if a point given in triangle local coordinates lies within the triangle itself. More... | |
void | ResolveCollisionForces (const float penetration_depth, node_t &hitnode, node_t &na, node_t &nb, node_t &no, const float alpha, const float beta, const float gamma, const Vector3 &normal, const float dt, const bool remote, ground_model_t &submesh_ground_model) |
Calculate collision forces and apply them to the collision node and the three vertex nodes of the collision triangle. More... | |
|
static |
Determine on which side of a triangle an occuring collision takes place.
The frontface of the triangle is the side towards which the surface normal is pointing. The backface is the opposite side.
distance | Signed shortest distance from collision point to triangle plane. |
normal | Surface normal of the triangle. |
surface_point | Arbitrary point within the triangle plane. |
neighbour_node_ids | Indices of neighbouring nodes connected to the colliding node. |
nodes |
Definition at line 49 of file DynamicCollisions.cpp.
|
static |
Test if a point given in triangle local coordinates lies within the triangle itself.
A point (within in the triangle plane) is located inside the triangle if its barycentric coordinates \(\alpha, \beta, \gamma\) are all positive. The margin additionally defines the maximum distance from the triangle plane within which a three-dimensional point is still considered to be close enough to be inside the triangle.
local | Point in triangle local coordinates. |
margin | Range within which a point is considered to be close enough to the triangle plane. |
Definition at line 88 of file DynamicCollisions.cpp.
void ResolveCollisionForces | ( | const float | penetration_depth, |
node_t & | hitnode, | ||
node_t & | na, | ||
node_t & | nb, | ||
node_t & | no, | ||
const float | alpha, | ||
const float | beta, | ||
const float | gamma, | ||
const Vector3 & | normal, | ||
const float | dt, | ||
const bool | remote, | ||
ground_model_t & | submesh_ground_model | ||
) |
Calculate collision forces and apply them to the collision node and the three vertex nodes of the collision triangle.
Definition at line 97 of file DynamicCollisions.cpp.