Table of Contents

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

triangleSource TTriangleSource

Source from which to retrieve a sequence of triangles.

volume float

Volume of the mesh.

center Vector3

Center of mass of the mesh.

Type Parameters

TTriangleSource

Type 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

triangleSource TTriangleSource

Source from which to retrieve a sequence of triangles.

mass float

Mass of the mesh to scale the inertia tensor with.

volume float

Volume of the mesh.

inertia Symmetric3x3

Inertia tensor of the mesh.

Type Parameters

TTriangleSource

Type 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

triangleSource TTriangleSource

Source from which to retrieve a sequence of triangles.

mass float

Mass of the mesh to scale the inertia tensor with.

volume float

Volume of the mesh.

inertia Symmetric3x3

Inertia tensor of the mesh.

center Vector3

Center of mass of the mesh.

Type Parameters

TTriangleSource

Type 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

triangleSource TTriangleSource

Source from which to retrieve a sequence of triangles.

Returns

Vector3

Center of mass of the mesh.

Type Parameters

TTriangleSource

Type 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

triangleSource TTriangleSource

Source from which to retrieve a sequence of triangles.

mass float

Mass of the mesh to scale the inertia tensor with.

inertia Symmetric3x3

Inertia tensor of the mesh.

Type Parameters

TTriangleSource

Type 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

triangleSource TTriangleSource

Source from which to retrieve a sequence of triangles.

mass float

Mass of the mesh to scale the inertia tensor with.

inertia Symmetric3x3

Inertia tensor of the mesh.

center Vector3

Center of mass of the mesh.

Type Parameters

TTriangleSource

Type 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

a Vector3
b Vector3
c Vector3
mass float
inertiaTensor Symmetric3x3

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

a Vector3

First vertex of the tetrahedron.

b Vector3

Second vertex of the tetrahedron.

c Vector3

Third vertex of the tetrahedron.

volume float

Volume of the tetrahedron.

inertiaTensor Symmetric3x3

Inertia 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

a Vector3

First vertex of the tetrahedron.

b Vector3

Second vertex of the tetrahedron.

c Vector3

Third 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

a Vector3

First vertex in the triangle.

b Vector3

Second vertex in the triangle.

c Vector3

Third 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

a Vector3

First vertex in the triangle.

b Vector3

Second vertex in the triangle.

c Vector3

Third vertex in the triangle.

mass float

Mass of the triangle.

inertiaTensor Symmetric3x3

Inertia 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

a Vector3

First vertex in the triangle.

b Vector3

Second vertex in the triangle.

c Vector3

Third vertex in the triangle.

area float

Area of the triangle.

inertiaTensor Symmetric3x3

Inertia 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)

Parameters

mass float

Mass associated with the inertia tensor being moved.

offset Vector3

Offset from the current inertia frame of reference to the new frame of reference.

inertiaOffset Symmetric3x3

Modification to add to the inertia tensor to move it into the new reference frame.