Jolt Physics
A multi core friendly Game Physics Engine
|
#include <PolyhedronSubmergedVolumeCalculator.h>
Classes | |
class | Point |
A helper class that contains cached information about a polyhedron vertex. More... | |
Public Member Functions | |
PolyhedronSubmergedVolumeCalculator (const Mat44 &inTransform, const Vec3 *inPoints, int inPointStride, int inNumPoints, const Plane &inSurface, Point *ioBuffer, RVec3 inBaseOffset) | |
bool | AreAllAbove () const |
Check if all points are above the surface. Should be used as early out. | |
bool | AreAllBelow () const |
Check if all points are below the surface. Should be used as early out. | |
int | GetReferencePointIdx () const |
Get the lowest point of the polyhedron. Used to form the 4th vertex to make a tetrahedron out of a polyhedron face. | |
void | AddFace (int inIdx1, int inIdx2, int inIdx3) |
Add a polyhedron face. Supply the indices of the points that form the face (in counter clockwise order). | |
void | GetResult (float &outSubmergedVolume, Vec3 &outCenterOfBuoyancy) const |
Call after all faces have been added. Returns the submerged volume and the center of buoyancy for the submerged volume. | |
This class calculates the intersection between a fluid surface and a polyhedron and returns the submerged volume and its center of buoyancy Construct this class and then one by one add all faces of the polyhedron using the AddFace function. After all faces have been added the result can be gotten through GetResult.
|
inline |
Constructor
inTransform | Transform to transform all incoming points with |
inPoints | Array of points that are part of the polyhedron |
inPointStride | Amount of bytes between each point (should usually be sizeof(Vec3)) |
inNumPoints | The amount of points |
inSurface | The plane that forms the fluid surface (normal should point up) |
ioBuffer | A temporary buffer of Point's that should have inNumPoints entries and should stay alive while this class is alive |
inBaseOffset | The offset to transform inTransform to world space (in double precision mode this can be used to shift the whole operation closer to the origin). Only used for debug drawing. |
|
inline |
Add a polyhedron face. Supply the indices of the points that form the face (in counter clockwise order).
|
inline |
Check if all points are above the surface. Should be used as early out.
|
inline |
Check if all points are below the surface. Should be used as early out.
|
inline |
Get the lowest point of the polyhedron. Used to form the 4th vertex to make a tetrahedron out of a polyhedron face.
|
inline |
Call after all faces have been added. Returns the submerged volume and the center of buoyancy for the submerged volume.