public

Inheritance Graph

graph BT
	Octree
	Octree --> TriangleTree
	RandomizedSampleTree --> Octree
	click Octree "classMinSG_1_1TriangleTrees_1_1Octree"
	click TriangleTree "classMinSG_1_1TriangleTrees_1_1TriangleTree"
	click RandomizedSampleTree "classMinSG_1_1TriangleTrees_1_1RandomizedSampleTree"

Description

One object of this class represents a node in an octree.

Author: Benjamin Eikel

Date: 2011-07-26

Protected Attributes

   
   
std::vector< TriangleAccessor > triangleStorage
Internal storage of the triangles inside this node.
   
std::vector< std::unique_ptr< Octree > > children
Eight children of this node or empty if leaf.
   
const uint32_t maxTrianglesPerNode
   
const float looseFactor
Fraction of bounding box enlargement.

Public Functions

   
   
  Octree( Rendering::Mesh * mesh, uint32_t trianglesPerNode, float enlargementFactor)
   
  ~Octree()
Clean up memory for possible children.
   
bool isLeaf() const
   
float getLooseFactor() const
   
std::vector< const TriangleTree * > getChildren() const
   
const TriangleAccessor & getTriangle(uint32_t index) const
   
uint32_t getTriangleCount() const
   
bool shouldSplit() const
   
void split()
   
bool contains(const TriangleAccessor & triangle) const
   
void fetchAttributes( Util::AttributeProvider * container) const

Protected Functions

   
   
  Octree(const Geometry::Box & childBound, const Octree & parent)
   
Octree * createChild(const Geometry::Box & childBound, const Octree & parent) const
Return a child node. Needed for polymorphism.

Documentation

variable
MinSG::TriangleTrees::Octree::triangleStorage

protected
 
 
std::vector< TriangleAccessor > triangleStorage

Internal storage of the triangles inside this node.

Defined in MinSG/Ext/TriangleTrees/Octree.h:136


variable
MinSG::TriangleTrees::Octree::children

protected
 
 
std::vector< std::unique_ptr< Octree > > children

Eight children of this node or empty if leaf.

Defined in MinSG/Ext/TriangleTrees/Octree.h:139


variable
MinSG::TriangleTrees::Octree::maxTrianglesPerNode

protected
 
 
const uint32_t maxTrianglesPerNode

Maximum number of triangles stored in a node. If the actual number is bigger, the node will be split.

Defined in MinSG/Ext/TriangleTrees/Octree.h:145


variable
MinSG::TriangleTrees::Octree::looseFactor

protected
 
 
const float looseFactor

Fraction of bounding box enlargement.

Defined in MinSG/Ext/TriangleTrees/Octree.h:148


function
MinSG::TriangleTrees::Octree::Octree

public explicit
     
     
Octree( Rendering::Mesh * mesh,
  uint32_t trianglesPerNode,
  float enlargementFactor
)    

Create an Octree root node with TriangleAccessors to all given triangles.

Parameters

mesh
Mesh containing the triangles.
trianglesPerNode
Maximum number of triangles to store inside a node. Bigger nodes will be split.
enlargementFactor
Increase of the size of the bounding box. Must not be smaller than one. If larger than one, this Octree will be an Loose Octree .

Defined in MinSG/Ext/TriangleTrees/Octree.h:48


function
MinSG::TriangleTrees::Octree::~Octree

public virtual
   
   
~Octree( )

Clean up memory for possible children.

Defined in MinSG/Ext/TriangleTrees/Octree.h:51


function
MinSG::TriangleTrees::Octree::isLeaf

public const inline virtual
   
   
bool isLeaf( ) const

Tell if the node is a leaf node.

Returns

trueif the node is a leaf andfalseif it is an inner node.

Defined in MinSG/Ext/TriangleTrees/Octree.h:58


function
MinSG::TriangleTrees::Octree::getLooseFactor

public const inline
   
   
float getLooseFactor( ) const

Return the loose factor of this node.

Returns

Loose factor

Defined in MinSG/Ext/TriangleTrees/Octree.h:67


function
MinSG::TriangleTrees::Octree::getChildren

public const inline virtual
   
   
std::vector< const TriangleTree * > getChildren( ) const

Retrieve the eight child nodes.

Returns

Pointers to children.

Defined in MinSG/Ext/TriangleTrees/Octree.h:76


function
MinSG::TriangleTrees::Octree::getTriangle

public const virtual
     
     
const TriangleAccessor & getTriangle( uint32_t index ) const

Return one triangle.

Parameters

index
Index of triangle stored in this node.

Returns

Indices stored in this node.

Defined in MinSG/Ext/TriangleTrees/Octree.h:91


function
MinSG::TriangleTrees::Octree::getTriangleCount

public const inline virtual
   
   
uint32_t getTriangleCount( ) const

Return the number of triangles that are stored in this tree node.

Returns

Triangle count

Defined in MinSG/Ext/TriangleTrees/Octree.h:98


function
MinSG::TriangleTrees::Octree::shouldSplit

public const inline
   
   
bool shouldSplit( ) const

Check if this node should be split.

Returns

trueif this node should be split.

Defined in MinSG/Ext/TriangleTrees/Octree.h:107


function
MinSG::TriangleTrees::Octree::split

public
   
   
void split( )

Split this node if it is a leaf. It creates two children and converts this node into an inner node.

Defined in MinSG/Ext/TriangleTrees/Octree.h:115


function
MinSG::TriangleTrees::Octree::contains

public const virtual
     
     
bool contains( const TriangleAccessor & triangle ) const

Check if the triangle fits into the bounding box of the tree node.

Parameters

triangle
Triangle to check.

Returns

trueif the triangle is inside or at most touching the bounds.

Defined in MinSG/Ext/TriangleTrees/Octree.h:125


function
MinSG::TriangleTrees::Octree::fetchAttributes

public const virtual
     
     
void fetchAttributes( Util::AttributeProvider * container ) const

Add attributes specific to this object to the given container.

Parameters

container
Container for attributes.

Defined in MinSG/Ext/TriangleTrees/Octree.h:132


function
MinSG::TriangleTrees::Octree::Octree

protected explicit
     
     
Octree( const Geometry::Box & childBound,
  const Octree & parent
)    

Create a new Octree node. This is used to create child nodes. The creating node has to assign the triangles to the node.

Parameters

childBound
Axis-aligned bounding box for the child.
parent
Parent node which is used to copy the parameters from.

Defined in MinSG/Ext/TriangleTrees/Octree.h:159


function
MinSG::TriangleTrees::Octree::createChild

protected const inline virtual
     
     
Octree * createChild( const Geometry::Box & childBound,
  const Octree & parent
) const    

Return a child node. Needed for polymorphism.

Defined in MinSG/Ext/TriangleTrees/Octree.h:162