SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::helper::TriangleOctree Class Reference

#include <TriangleOctree.h>

Classes

class  traceResult
 

Public Attributes

SReal x
 
SReal y
 
SReal z
 
bool visited
 
SReal size
 
bool val
 
bool is_leaf
 
bool internal
 
TriangleOctreeRoottm
 
type::vector< int > objects
 
TriangleOctreechildVec [8]
 

Static Public Attributes

static constexpr int CUBE_SIZE = TriangleOctreeRoot::CUBE_SIZE
 

Public Member Functions

 ~TriangleOctree ()
 
 TriangleOctree (TriangleOctreeRoot *_tm, SReal _x=(SReal) -CUBE_SIZE, SReal _y=(SReal) -CUBE_SIZE, SReal _z=(SReal) -CUBE_SIZE, SReal _size=2 *CUBE_SIZE)
 
void draw (sofa::helper::visual::DrawTool *drawtool)
 
int trace (type::Vec3 origin, type::Vec3 direction, traceResult &result)
 Find the nearest triangle intersecting the given ray, or -1 of not found. More...
 
void traceAll (type::Vec3 origin, type::Vec3 direction, type::vector< traceResult > &results)
 Find all triangles intersecting the given ray. More...
 
void traceAllCandidates (type::Vec3 origin, type::Vec3 direction, std::set< int > &results)
 Find all triangles intersecting the given ray. More...
 
void bboxAllCandidates (type::Vec3 bbmin, type::Vec3 bbmax, std::set< int > &results)
 Find all triangles intersecting the given ray. More...
 

Protected Member Functions

int trace (const type::Vec3 &origin, const type::Vec3 &direction, SReal tx0, SReal ty0, SReal tz0, SReal tx1, SReal ty1, SReal tz1, unsigned int a, unsigned int b, type::Vec3 &origin1, type::Vec3 &direction1, traceResult &result)
 
template<class Res >
void traceAllStart (type::Vec3 origin, type::Vec3 direction, Res &results)
 
template<class Res >
void traceAll (const type::Vec3 &origin, const type::Vec3 &direction, SReal tx0, SReal ty0, SReal tz0, SReal tx1, SReal ty1, SReal tz1, unsigned int a, unsigned int b, type::Vec3 &origin1, type::Vec3 &direction1, Res &results)
 
template<class Res >
void bbAll (const type::Vec3 &bbmin, const type::Vec3 &bbmax, Res &results)
 
int nearestTriangle (int minIndex, const type::Vec3 &origin, const type::Vec3 &direction, traceResult &result)
 
void allTriangles (const type::Vec3 &origin, const type::Vec3 &direction, type::vector< traceResult > &results)
 
void allTriangles (const type::Vec3 &origin, const type::Vec3 &direction, std::set< int > &results)
 
void bbAllTriangles (const type::Vec3 &bbmin, const type::Vec3 &bbmax, std::set< int > &results)
 
void insert (SReal _x, SReal _y, SReal _z, SReal _inc, int t)
 

Friends

class TriangleOctreeRoot
 

Attribute details

◆ childVec

TriangleOctree* sofa::helper::TriangleOctree::childVec[8]

◆ CUBE_SIZE

constexpr int sofa::helper::TriangleOctree::CUBE_SIZE = TriangleOctreeRoot::CUBE_SIZE
staticconstexpr

◆ internal

bool sofa::helper::TriangleOctree::internal

◆ is_leaf

bool sofa::helper::TriangleOctree::is_leaf

◆ objects

type::vector< int > sofa::helper::TriangleOctree::objects

◆ size

SReal sofa::helper::TriangleOctree::size

◆ tm

TriangleOctreeRoot* sofa::helper::TriangleOctree::tm

◆ val

bool sofa::helper::TriangleOctree::val

◆ visited

bool sofa::helper::TriangleOctree::visited

◆ x

SReal sofa::helper::TriangleOctree::x

◆ y

SReal sofa::helper::TriangleOctree::y

◆ z

SReal sofa::helper::TriangleOctree::z

Constructor details

◆ ~TriangleOctree()

sofa::helper::TriangleOctree::~TriangleOctree ( )

◆ TriangleOctree()

sofa::helper::TriangleOctree::TriangleOctree ( TriangleOctreeRoot _tm,
SReal  _x = (SReal)-CUBE_SIZE,
SReal  _y = (SReal)-CUBE_SIZE,
SReal  _z = (SReal) -CUBE_SIZE,
SReal  _size = 2 * CUBE_SIZE 
)
inline

Function details

◆ allTriangles() [1/2]

void sofa::helper::TriangleOctree::allTriangles ( const type::Vec3 origin,
const type::Vec3 direction,
std::set< int > &  results 
)
protected

◆ allTriangles() [2/2]

void sofa::helper::TriangleOctree::allTriangles ( const type::Vec3 origin,
const type::Vec3 direction,
type::vector< traceResult > &  results 
)
protected

◆ bbAll()

template<class Res >
void sofa::helper::TriangleOctree::bbAll ( const type::Vec3 bbmin,
const type::Vec3 bbmax,
Res &  results 
)
protected

◆ bbAllTriangles()

void sofa::helper::TriangleOctree::bbAllTriangles ( const type::Vec3 bbmin,
const type::Vec3 bbmax,
std::set< int > &  results 
)
protected

◆ bboxAllCandidates()

void sofa::helper::TriangleOctree::bboxAllCandidates ( type::Vec3  bbmin,
type::Vec3  bbmax,
std::set< int > &  results 
)

Find all triangles intersecting the given ray.

◆ draw()

void sofa::helper::TriangleOctree::draw ( sofa::helper::visual::DrawTool drawtool)

◆ insert()

void sofa::helper::TriangleOctree::insert ( SReal  _x,
SReal  _y,
SReal  _z,
SReal  _inc,
int  t 
)
protected

◆ nearestTriangle()

int sofa::helper::TriangleOctree::nearestTriangle ( int  minIndex,
const type::Vec3 origin,
const type::Vec3 direction,
traceResult result 
)
protected

◆ trace() [1/2]

int sofa::helper::TriangleOctree::trace ( const type::Vec3 origin,
const type::Vec3 direction,
SReal  tx0,
SReal  ty0,
SReal  tz0,
SReal  tx1,
SReal  ty1,
SReal  tz1,
unsigned int  a,
unsigned int  b,
type::Vec3 origin1,
type::Vec3 direction1,
traceResult result 
)
protected

◆ trace() [2/2]

int sofa::helper::TriangleOctree::trace ( type::Vec3  origin,
type::Vec3  direction,
traceResult result 
)

Find the nearest triangle intersecting the given ray, or -1 of not found.

◆ traceAll() [1/2]

template<class Res >
void sofa::helper::TriangleOctree::traceAll ( const type::Vec3 origin,
const type::Vec3 direction,
SReal  tx0,
SReal  ty0,
SReal  tz0,
SReal  tx1,
SReal  ty1,
SReal  tz1,
unsigned int  a,
unsigned int  b,
type::Vec3 origin1,
type::Vec3 direction1,
Res &  results 
)
protected

◆ traceAll() [2/2]

void sofa::helper::TriangleOctree::traceAll ( type::Vec3  origin,
type::Vec3  direction,
type::vector< traceResult > &  results 
)

Find all triangles intersecting the given ray.

◆ traceAllCandidates()

void sofa::helper::TriangleOctree::traceAllCandidates ( type::Vec3  origin,
type::Vec3  direction,
std::set< int > &  results 
)

Find all triangles intersecting the given ray.

◆ traceAllStart()

template<class Res >
void sofa::helper::TriangleOctree::traceAllStart ( type::Vec3  origin,
type::Vec3  direction,
Res &  results 
)
protected

Related details

◆ TriangleOctreeRoot

friend class TriangleOctreeRoot
friend