ug4
ug::node_tree Namespace Reference

Classes

class  BoxedGroupNode
 A group node featuring a bounding box. More...
 
class  CollisionEdgesNode
 holds index pairs defining edges. More...
 
struct  CollisionElementID
 
class  CollisionTreeRootNode
 A group node featuring a bounding box and a set of points. More...
 
class  CollisionTrianglesNode
 holds index tuples defining triangles. More...
 
class  GroupNode
 You can group nodes using the GroupNode. More...
 
class  Node
 Nodes serve as base-objects for items of wich a scene-graph consists. More...
 
class  Object
 An Object serves as the base-class for most of the polymorphic node-tree objects. More...
 
class  Traverser
 Derivates of a Traverser can be used to traverse a scenegraph. More...
 
class  Traverser_CollisionTree
 Enhances the Traverser base-class by methods to traverse a collision tree. More...
 
class  Traverser_IntersectFaces
 traverses a node-tree and intersect a given face with the contained geometry. More...
 
class  Traverser_ProjectPoint
 traverses a node-tree and projects a given point to the contained geometry. More...
 

Typedefs

typedef SmartPtr< BoxedGroupNodeSPBoxedGroupNode
 the smartpointer used to encapsulate the node More...
 
typedef SmartPtr< CollisionEdgesNodeSPCollisionEdgesNode
 the smartpointer used to encapsulate the node More...
 
typedef SmartPtr< CollisionTreeRootNodeSPCollisionTreeRootNode
 the smartpointer which will be used to encapsulate the node More...
 
typedef SmartPtr< CollisionTrianglesNodeSPCollisionTrianglesNode
 the smartpointer used to encapsulate the node More...
 
typedef SmartPtr< GroupNodeSPGroupNode
 the smartpointer used to encapsulate the node More...
 
typedef SmartPtr< NodeSPNode
 the smartpointer used to encapsulate the node More...
 

Enumerations

enum  ObjectCode {
  OC_INVALID = 0xFFFFFFFF , OC_OBJECT = 0 , OC_NODE = 1 , OC_GROUP_NODE ,
  OC_BOXED_GROUP_NODE , OC_COLLISION_TREE_ROOT_NODE , OC_COLLISION_EDGES_NODE , OC_COLLISION_TRIANGLES_NODE ,
  OC_NODES_END , OC_CUSTOM_OBJECT
}
 ids associated with objects. Values shouldn't be unnessesarily high. More...
 

Functions

static void CalculateBoundingBox (vector3 &boxMinOut, vector3 &boxMaxOut, const vector3 *points, const int *inds, size_t numInds)
 
static void CalculateBoundingBox (vector3 &boxMinOut, vector3 &boxMaxOut, const vector3 *points, size_t numPoints)
 
SPCollisionTreeRootNode CreateOctree (vector3 *points, size_t numPoints, int *elemInds, size_t numElemInds, int numIndsPerElem, CollisionElementID *elemIDs, int maxDepth, int elemThreshold, bool bLoose)
 Creates an Octree from a list of elements. More...
 
void CreateSubOctrees (BoxedGroupNode *parentNode, vector3 *points, size_t numPoints, int *elemInds, size_t numElemInds, int numIndsPerElem, CollisionElementID *elemIDs, int maxDepth, int elemThreshold, bool bLoose)
 Creates sub-trees of an Octree. More...
 
static void GrowBox (vector3 &minInOut, vector3 &maxInOut, number scaleFac)
 

Typedef Documentation

◆ SPBoxedGroupNode

the smartpointer used to encapsulate the node

◆ SPCollisionEdgesNode

the smartpointer used to encapsulate the node

◆ SPCollisionTreeRootNode

the smartpointer which will be used to encapsulate the node

◆ SPCollisionTrianglesNode

the smartpointer used to encapsulate the node

◆ SPGroupNode

the smartpointer used to encapsulate the node

◆ SPNode

the smartpointer used to encapsulate the node

Enumeration Type Documentation

◆ ObjectCode

ids associated with objects. Values shouldn't be unnessesarily high.

Enumerator
OC_INVALID 
OC_OBJECT 
OC_NODE 
OC_GROUP_NODE 
OC_BOXED_GROUP_NODE 
OC_COLLISION_TREE_ROOT_NODE 
OC_COLLISION_EDGES_NODE 
OC_COLLISION_TRIANGLES_NODE 
OC_NODES_END 
OC_CUSTOM_OBJECT 

Function Documentation

◆ CalculateBoundingBox() [1/2]

static void ug::node_tree::CalculateBoundingBox ( vector3 boxMinOut,
vector3 boxMaxOut,
const vector3 points,
const int *  inds,
size_t  numInds 
)
static

calculates the bounding box around a set of elements which are given by a set of indices referencing a set of points. This method is particularily useful if the elements only reference a subset of the given points. If not the bounding box should be calculated directly on the set of points.

Referenced by CreateOctree(), and CreateSubOctrees().

◆ CalculateBoundingBox() [2/2]

static void ug::node_tree::CalculateBoundingBox ( vector3 boxMinOut,
vector3 boxMaxOut,
const vector3 points,
size_t  numPoints 
)
static

calculates the bounding box around a set of points

◆ CreateOctree()

SPCollisionTreeRootNode ug::node_tree::CreateOctree ( vector3 points,
size_t  numPoints,
int *  elemInds,
size_t  numElemInds,
int  numIndsPerElem,
CollisionElementID elemIDs,
int  maxDepth,
int  elemThreshold,
bool  bLoose 
)

Creates an Octree from a list of elements.

Given a list of points and a list of element-indices (describing edges or triangles) that reference those points, this method constructs a CollisionTree in the form of an octree and returns the root-node of the tree.

Arrays passed to this method will be copied to the resulting tree and may thus be deleted after the method returned.

Parameters
pointsan array of points which are referenced by the triangleInds.
numPointsThe number of points in the points array.
elemIndsArray of indices which reference the points array. 'numIndsPerElem' consecutive indices form an element. Note that the size of elemInds has to be numElemInds.
numElemIndsThe number of elements in the elemInds array.
numIndsPerElemThe number of points required to describe an element. Please note, that currently only 2 or 3 are supported.
elemIDsArray of size numElemInds / numIndsPerElem, that allows to specify an identifier associated with each element in the oct-tree. This parameter may be NULL.
maxDepthMaximal depth of the generated trees.
elemThresholdThe minimal number of elements that leads to an additional refinement of a node.
bLoose

References CalculateBoundingBox(), create(), CreateSubOctrees(), SmartPtr< T, FreePolicy >::get(), and GrowBox().

Referenced by ug::AdjustEdgeLength(), and ug::CreateOctree().

◆ CreateSubOctrees()

void ug::node_tree::CreateSubOctrees ( BoxedGroupNode parentNode,
vector3 points,
size_t  numPoints,
int *  elemInds,
size_t  numElemInds,
int  numIndsPerElem,
CollisionElementID elemIDs,
int  maxDepth,
int  elemThreshold,
bool  bLoose 
)

Creates sub-trees of an Octree.

This method is mostly used internally during oct-tree-construction. Given a list of points and a element-index-list (edges or triangles), it constructs sub-trees of the specified parent-node. This method recursivly calls itself.

Make sure that all passed points lie inside the parent-nodes box.

Arrays passed to this method will be copied to the resulting tree and may thus be deleted after the method returned.

Parameters
parentNodeThe tree-node into which created trees shall be inserted.
pointsan array of points which are referenced by the triangleInds.
numPointsThe number of points in the points array.
elemIndsArray of indices which reference the points array. 'numIndsPerElem' consecutive indices form an element. Note that the size of elemInds has to be numElemInds.
numElemIndsThe number of elements in the elemInds array.
numIndsPerElemThe number of points required to describe an element. Please note, that currently only 2 and 3 are supported.
elemIDsArray of size numElemInds / numIndsPerElem, that allows to specify an identifier associated with each element in the oct-tree. This parameter may be NULL.
maxDepthMaximal depth of the generated trees.
elemThresholdThe minimal number of elements that leads to an additional refinement of a node.
bLooseif true, elems will be assigned to the box that contains their center. Each element will be assigned to exactly one leaf-node in this case. Note that the bounding-boxes of a loose tree normally overlap each other.

if false, elems will be assigned to each leaf-node, whose box intersects the element. Each element may be assigned to multiple leaf-nodes in this case. However the boxes of leaf-nodes will not overlap in this case.

References ug::node_tree::GroupNode::add_child(), ug::BoxBoundProbe(), CalculateBoundingBox(), create(), SmartPtr< T, FreePolicy >::get(), GrowBox(), ug::LineBoxIntersection(), ug::node_tree::BoxedGroupNode::max_corner(), ug::node_tree::BoxedGroupNode::min_corner(), ug::MathVector< N, T >::size(), ug::TriangleBoxIntersection(), ug::VecAdd(), and ug::VecScale().

Referenced by CreateOctree().

◆ GrowBox()

static void ug::node_tree::GrowBox ( vector3 minInOut,
vector3 maxInOut,
number  scaleFac 
)
static

Increases the size of the bounding box by scaling around its center

References ug::VecAdd(), ug::VecScale(), and ug::VecSubtract().

Referenced by CreateOctree(), and CreateSubOctrees().