Class MeshInertiaHelper
- Namespace
- BepuPhysics.Collidables
- Assembly
- BepuPhysics.dll
Provides helpers for computing the inertia of objects with triangular surfaces.
public static class MeshInertiaHelper
- Inheritance
-
MeshInertiaHelper
- Inherited Members
Methods
ComputeClosedCenterOfMass<TTriangleSource>(ref TTriangleSource, out float, out Vector3)
Computes the center of mass of a closed mesh.
public static void ComputeClosedCenterOfMass<TTriangleSource>(ref TTriangleSource triangleSource, out float volume, out Vector3 center) where TTriangleSource : ITriangleSource
Parameters
triangleSourceTTriangleSourceSource from which to retrieve a sequence of triangles.
volumefloatVolume of the mesh.
centerVector3Center of mass of the mesh.
Type Parameters
TTriangleSourceType of the triangle source.
ComputeClosedInertia<TTriangleSource>(ref TTriangleSource, float, out float, out Symmetric3x3)
Computes the inertia of a closed mesh. Triangles visible from outside the shape are assumed to have clockwise winding in right handed coordinates or counterclockwise winding in left handed coordinates.
public static void ComputeClosedInertia<TTriangleSource>(ref TTriangleSource triangleSource, float mass, out float volume, out Symmetric3x3 inertia) where TTriangleSource : ITriangleSource
Parameters
triangleSourceTTriangleSourceSource from which to retrieve a sequence of triangles.
massfloatMass of the mesh to scale the inertia tensor with.
volumefloatVolume of the mesh.
inertiaSymmetric3x3Inertia tensor of the mesh.
Type Parameters
TTriangleSourceType of the triangle source.
ComputeClosedInertia<TTriangleSource>(ref TTriangleSource, float, out float, out Symmetric3x3, out Vector3)
Computes the inertia of a closed mesh. Triangles visible from outside the shape are assumed to have clockwise winding in right handed coordinates or counterclockwise winding in left handed coordinates.
public static void ComputeClosedInertia<TTriangleSource>(ref TTriangleSource triangleSource, float mass, out float volume, out Symmetric3x3 inertia, out Vector3 center) where TTriangleSource : ITriangleSource
Parameters
triangleSourceTTriangleSourceSource from which to retrieve a sequence of triangles.
massfloatMass of the mesh to scale the inertia tensor with.
volumefloatVolume of the mesh.
inertiaSymmetric3x3Inertia tensor of the mesh.
centerVector3Center of mass of the mesh.
Type Parameters
TTriangleSourceType of the triangle source.
ComputeOpenCenterOfMass<TTriangleSource>(ref TTriangleSource)
Computes the center of mass of an open mesh, treating it as a triangle soup.
public static Vector3 ComputeOpenCenterOfMass<TTriangleSource>(ref TTriangleSource triangleSource) where TTriangleSource : ITriangleSource
Parameters
triangleSourceTTriangleSourceSource from which to retrieve a sequence of triangles.
Returns
- Vector3
Center of mass of the mesh.
Type Parameters
TTriangleSourceType of the triangle source.
ComputeOpenInertia<TTriangleSource>(ref TTriangleSource, float, out Symmetric3x3)
Computes the inertia of an open mesh, treating it as a triangle soup.
public static void ComputeOpenInertia<TTriangleSource>(ref TTriangleSource triangleSource, float mass, out Symmetric3x3 inertia) where TTriangleSource : ITriangleSource
Parameters
triangleSourceTTriangleSourceSource from which to retrieve a sequence of triangles.
massfloatMass of the mesh to scale the inertia tensor with.
inertiaSymmetric3x3Inertia tensor of the mesh.
Type Parameters
TTriangleSourceType of the triangle source.
ComputeOpenInertia<TTriangleSource>(ref TTriangleSource, float, out Symmetric3x3, out Vector3)
Computes the inertia of an open mesh, treating it as a triangle soup.
public static void ComputeOpenInertia<TTriangleSource>(ref TTriangleSource triangleSource, float mass, out Symmetric3x3 inertia, out Vector3 center) where TTriangleSource : ITriangleSource
Parameters
triangleSourceTTriangleSourceSource from which to retrieve a sequence of triangles.
massfloatMass of the mesh to scale the inertia tensor with.
inertiaSymmetric3x3Inertia tensor of the mesh.
centerVector3Center of mass of the mesh.
Type Parameters
TTriangleSourceType of the triangle source.
ComputeTetrahedronContribution(Vector3, Vector3, Vector3, float, out Symmetric3x3)
public static void ComputeTetrahedronContribution(Vector3 a, Vector3 b, Vector3 c, float mass, out Symmetric3x3 inertiaTensor)
Parameters
ComputeTetrahedronContribution(Vector3, Vector3, Vector3, out float, out Symmetric3x3)
Integrates the inertia contribution of a tetrahedron with vertices at a, b, c, and (0,0,0) assuming a density of 1.
public static void ComputeTetrahedronContribution(Vector3 a, Vector3 b, Vector3 c, out float volume, out Symmetric3x3 inertiaTensor)
Parameters
aVector3First vertex of the tetrahedron.
bVector3Second vertex of the tetrahedron.
cVector3Third vertex of the tetrahedron.
volumefloatVolume of the tetrahedron.
inertiaTensorSymmetric3x3Inertia tensor of this tetrahedron assuming a density of 1.
ComputeTetrahedronVolume(Vector3, Vector3, Vector3)
Computes the signed volume of a tetrahedron where the fourth vertex is at the origin. Triangles visible from outside the shape are assumed to have clockwise winding in right handed coordinates or counterclockwise winding in left handed coordinates.
public static float ComputeTetrahedronVolume(Vector3 a, Vector3 b, Vector3 c)
Parameters
aVector3First vertex of the tetrahedron.
bVector3Second vertex of the tetrahedron.
cVector3Third vertex of the tetrahedron.
Returns
- float
Volume of the tetrahedron.
ComputeTriangleArea(Vector3, Vector3, Vector3)
Computes the area of a triangle.
public static float ComputeTriangleArea(Vector3 a, Vector3 b, Vector3 c)
Parameters
aVector3First vertex in the triangle.
bVector3Second vertex in the triangle.
cVector3Third vertex in the triangle.
Returns
- float
Area of the triangle.
ComputeTriangleContribution(Vector3, Vector3, Vector3, float, out Symmetric3x3)
Integrates the inertia contribution from a single triangle.
public static void ComputeTriangleContribution(Vector3 a, Vector3 b, Vector3 c, float mass, out Symmetric3x3 inertiaTensor)
Parameters
aVector3First vertex in the triangle.
bVector3Second vertex in the triangle.
cVector3Third vertex in the triangle.
massfloatMass of the triangle.
inertiaTensorSymmetric3x3Inertia tensor of the triangle.
ComputeTriangleContribution(Vector3, Vector3, Vector3, out float, out Symmetric3x3)
Integrates the inertia contribution from a single triangle assuming a density of 1.
public static void ComputeTriangleContribution(Vector3 a, Vector3 b, Vector3 c, out float area, out Symmetric3x3 inertiaTensor)
Parameters
aVector3First vertex in the triangle.
bVector3Second vertex in the triangle.
cVector3Third vertex in the triangle.
areafloatArea of the triangle.
inertiaTensorSymmetric3x3Inertia tensor of the triangle assuming that the density is 1.
GetInertiaOffset(float, Vector3, out Symmetric3x3)
Computes an offset for an inertia tensor based on an offset frame of reference.
public static void GetInertiaOffset(float mass, Vector3 offset, out Symmetric3x3 inertiaOffset)