Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
TriangleSplitter Class Referenceabstract

A class that splits a triangle list into two parts for building a tree. More...

#include <TriangleSplitter.h>

Inheritance diagram for TriangleSplitter:
NonCopyable TriangleSplitterBinning TriangleSplitterFixedLeafSize TriangleSplitterLongestAxis TriangleSplitterMean TriangleSplitterMorton

Classes

struct  Range
 Helper struct to indicate triangle range before and after the split. More...
 
struct  Stats
 

Public Member Functions

 TriangleSplitter (const VertexList &inVertices, const IndexedTriangleList &inTriangles)
 Constructor. More...
 
virtual ~TriangleSplitter ()=default
 Virtual destructor. More...
 
virtual void GetStats (Stats &outStats) const =0
 Get stats of splitter. More...
 
Range GetInitialRange () const
 Range of triangles to start with. More...
 
virtual bool Split (const Range &inTriangles, Range &outLeft, Range &outRight)=0
 
const VertexListGetVertices () const
 Get the list of vertices. More...
 
const IndexedTriangleGetTriangle (uint inIdx) const
 Get triangle by index. More...
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Protected Member Functions

bool SplitInternal (const Range &inTriangles, uint inDimension, float inSplit, Range &outLeft, Range &outRight)
 Helper function to split triangles based on dimension and split value. More...
 

Protected Attributes

const VertexListmVertices
 Vertices of the indexed triangles. More...
 
const IndexedTriangleListmTriangles
 Unsorted triangles. More...
 
Array< Float3mCentroids
 Unsorted centroids of triangles. More...
 
Array< uintmSortedTriangleIdx
 Indices to sort triangles. More...
 

Detailed Description

A class that splits a triangle list into two parts for building a tree.

Constructor & Destructor Documentation

◆ TriangleSplitter()

JPH_NAMESPACE_BEGIN TriangleSplitter::TriangleSplitter ( const VertexList inVertices,
const IndexedTriangleList inTriangles 
)

Constructor.

◆ ~TriangleSplitter()

virtual TriangleSplitter::~TriangleSplitter ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ GetInitialRange()

Range TriangleSplitter::GetInitialRange ( ) const
inline

Range of triangles to start with.

◆ GetStats()

virtual void TriangleSplitter::GetStats ( Stats outStats) const
pure virtual

◆ GetTriangle()

const IndexedTriangle & TriangleSplitter::GetTriangle ( uint  inIdx) const
inline

Get triangle by index.

◆ GetVertices()

const VertexList & TriangleSplitter::GetVertices ( ) const
inline

Get the list of vertices.

◆ Split()

virtual bool TriangleSplitter::Split ( const Range inTriangles,
Range outLeft,
Range outRight 
)
pure virtual

Split triangles into two groups left and right, returns false if no split could be made

Parameters
inTrianglesThe range of triangles (in mSortedTriangleIdx) to process
outLeftOn return this will contain the ranges for the left subpart. mSortedTriangleIdx may have been shuffled.
outRightOn return this will contain the ranges for the right subpart. mSortedTriangleIdx may have been shuffled.
Returns
Returns true when a split was found

Implemented in TriangleSplitterBinning, TriangleSplitterFixedLeafSize, TriangleSplitterLongestAxis, TriangleSplitterMean, and TriangleSplitterMorton.

◆ SplitInternal()

bool TriangleSplitter::SplitInternal ( const Range inTriangles,
uint  inDimension,
float  inSplit,
Range outLeft,
Range outRight 
)
protected

Helper function to split triangles based on dimension and split value.

Member Data Documentation

◆ mCentroids

Array<Float3> TriangleSplitter::mCentroids
protected

Unsorted centroids of triangles.

◆ mSortedTriangleIdx

Array<uint> TriangleSplitter::mSortedTriangleIdx
protected

Indices to sort triangles.

◆ mTriangles

const IndexedTriangleList& TriangleSplitter::mTriangles
protected

Unsorted triangles.

◆ mVertices

const VertexList& TriangleSplitter::mVertices
protected

Vertices of the indexed triangles.


The documentation for this class was generated from the following files: