Blob 1.0

The union node. More...

#include <blobtree.h>

Inheritance diagram for TreeUnion:
TreeBinary TreeOperator TreeNode

Public Member Functions

 TreeUnion (TreeNode **, int)
 Creates a union operator node given an array of nodes.
 
 TreeUnion (const QVector< TreeNode * > &)
 Creates a union operator node given a set of nodes.
 
 TreeUnion (TreeNode *, TreeNode *)
 Creates a union operator node given up to four children nodes.
 
 TreeUnion (TreeNode *, TreeNode *, TreeNode *)
 Creates a union operator node given up to four children nodes.
 
 TreeUnion (TreeNode *, TreeNode *, TreeNode *, TreeNode *)
 Creates a union operator node given up to four children nodes.
 
virtual ~TreeUnion ()
 Destroy a union node.
 
virtual QString Show (int=0) const
 Show the tree hierarchy.
 
double Intensity (const Vector &) const
 Computes the field value at a given point in space.
 
Vector Gradient (const Vector &) const
 Compute the gradient.
 
virtual TreeNodeCopy () const
 Performs a deep copy.
 
double K () const
 Computes the gradient Lipschitz constant of the sub-tree.
 
double K (const Box &) const
 Computes the Lipschitz constant of the sub-tree within a box.
 
double K (const Segment &) const
 Compute the Lipschitz constant along a segment.
 
double K (const RayStep &) const
 Compute the Lipschitz constant along a segment.
 
double K (const Sphere &) const
 Compute the Lipschitz constant in a sphere.
 
double K (const Ray &) const
 Computes the Lipschitz constant of the sub-tree along a ray.
 
Color GetMaterial (const Vector &, const Vector &=Vector::Null) const
 Computes the texture at a given point in space.
 
TreeNodeCut (const Box &) const
 Cuts the to simplify its structure inside a box.
 
- Public Member Functions inherited from TreeBinary
 TreeBinary (TreeNode *, TreeNode *)
 Creates a union operator node given a small set of children nodes.
 
virtual ~TreeBinary ()
 Destroys an operator, destroying all existing children.
 
virtual int Memory () const
 Compute the size of the sub-tree.
 
virtual int Nodes () const
 Compute the number of nodes of the sub-tree.
 
virtual int Depth () const
 Compute the dpeth of the sub-tree.
 
virtual void SetThreshold (const double &)
 Recursively setup the threshold value.
 
- Public Member Functions inherited from TreeOperator
 TreeOperator ()
 Creates an operator node.
 
virtual ~TreeOperator ()
 Destroys an operator.
 
- Public Member Functions inherited from TreeNode
 TreeNode ()
 Create a virtual node of the Blob-Tree structure.
 
virtual ~TreeNode ()
 Destroys a node.
 
virtual double Omega (const Vector &) const
 Return the squared distance to the compact support of the node.
 
virtual void IntensityGradient (const Vector &, double &, Vector &) const
 Computes the field value and the gradient at a given point in space.
 
virtual TreeNodeBlend (TreeNode *)
 Insert a blending node that blends the old and the new sub-tree together.
 
virtual TreeNodeUnion (TreeNode *)
 Insert a union node that unions the old and the new sub-tree together.
 
virtual TreeNodeDifference (TreeNode *)
 Insert a difference node.
 
virtual TreeNodeTranslate (const Vector &)
 Insert a translation node.
 
virtual TreeNodeRotate (const Matrix &)
 Insert a rotation node.
 
virtual TreeNodeScale (const Vector &)
 Insert a scaling node.
 
Box GetBox () const
 Return the bounding box of the node.
 
virtual Vector Dichotomy (Vector, Vector, double, double, double, const double &=1.0e-4)
 Compute the intersection between the implicit surface and a segment.
 

Static Public Member Functions

static TreeNodeSplineVertex (const Vector &, const double &, const Vector &, const double &, const Vector &, const double &, const Vector &, const double &, const double &, int)
 Create a spline of TreeVertex primitives.
 
static TreeUnionQuadricSurface (const Vector &, const Vector &, const double &, const double &, const QuadricCurve2Set &)
 This function creates a surface of revolution.
 
static TreeNodeQuadricCurve (const double &, const double &, const QuadricCurveSet &)
 This function creates a quadric Bézier curve controled by an array of control knots.
 
static TreeNodeSet (const QVector< TreeNode * > &)
 Union a set of sub-trees.
 

Static Protected Member Functions

static TreeNodeBVHRecursive (QVector< TreeNode * > &, int, int)
 Create a bounding box hierarchy.
 
static TreeNodeOptimizeHierarchy (QVector< TreeNode * > &, int, int)
 Recursive BVH Tree construction from a vector<TNode*>.
 

Additional Inherited Members

- Protected Attributes inherited from TreeNode
Box box = Box::Null
 Bounding box of the node.
 
double T = 0.5
 Threshold value.
 
- Static Protected Attributes inherited from TreeNode
static const double Epsilon = 1e-6
 Epsilon value for gradient computation.
 

Detailed Description

The union node.

Example of how to code such a node:

TreeNode* node=new TreeUnion(
new TreeVertex(Vector(1,0,-2),new BlendCubic(2.0,1.0)),
new TreeVertex(Vector(-1,4,0),new BlendCubic(1.0,1.0)));
Normalized blending functions (1-r2)3.
Definition blend.h:91
The generic nodes with some pure virtual functions.
Definition blobtree.h:28
TreeUnion(TreeNode **, int)
Creates a union operator node given an array of nodes.
Definition treeunion.cpp:45
A point skeleton element.
Definition blobtree.h:583

,

Constructor & Destructor Documentation

◆ TreeUnion() [1/2]

TreeUnion::TreeUnion ( TreeNode ** a,
int n )
explicit

Creates a union operator node given an array of nodes.

Note that the array should contain at least two elements.

◆ TreeUnion() [2/2]

TreeUnion::TreeUnion ( const QVector< TreeNode * > & set)
explicit

Creates a union operator node given a set of nodes.

Note that the array should contain at least two elements.

Parameters
setSet of nodes.

◆ ~TreeUnion()

TreeUnion::~TreeUnion ( )
virtual

Destroy a union node.

Implicitly calls TreeOperator::~TreeOperator().

Member Function Documentation

◆ Show()

QString TreeUnion::Show ( int s = 0) const
virtual

Show the tree hierarchy.

Parameters
spaceNumber of spaces.

Reimplemented from TreeNode.

◆ Intensity()

double TreeUnion::Intensity ( const Vector & p) const
virtual

Computes the field value at a given point in space.

Parameters
pPoint.

Implements TreeNode.

◆ Gradient()

Vector TreeUnion::Gradient ( const Vector & p) const
virtual

Compute the gradient.

The returned vector is the gradient of the maximum contributing field function.

Parameters
pPoint.

Reimplemented from TreeNode.

◆ K() [1/5]

double TreeUnion::K ( const Box & b) const
virtual

Computes the Lipschitz constant of the sub-tree within a box.

Parameters
bThe box.

Implements TreeNode.

◆ K() [2/5]

double TreeUnion::K ( const Segment & s) const
virtual

Compute the Lipschitz constant along a segment.

Parameters
sThe segment.

Reimplemented from TreeNode.

◆ K() [3/5]

double TreeUnion::K ( const RayStep & raystep) const
virtual

Compute the Lipschitz constant along a segment.

Parameters
raystepThe segment.

Reimplemented from TreeNode.

◆ K() [4/5]

double TreeUnion::K ( const Sphere & s) const
virtual

Compute the Lipschitz constant in a sphere.

Parameters
sThe sphere.

Reimplemented from TreeNode.

◆ K() [5/5]

double TreeUnion::K ( const Ray & ray) const
virtual

Computes the Lipschitz constant of the sub-tree along a ray.

Parameters
rayThe ray.

Implements TreeNode.

◆ GetMaterial()

Color TreeUnion::GetMaterial ( const Vector & p,
const Vector & n = Vector::Null ) const
virtual

Computes the texture at a given point in space.

Returns the color of the child node with highest field value.

Parameters
pPoint.
nNormal.

Reimplemented from TreeNode.

◆ Cut()

TreeNode * TreeUnion::Cut ( const Box & b) const
virtual

Cuts the to simplify its structure inside a box.

This function returns a null pointer either if the box does not intersect the bounding box of the union, or if it misses the bounding box of all children.

Parameters
bThe box.

Implements TreeNode.

◆ SplineVertex()

TreeNode * TreeUnion::SplineVertex ( const Vector & a,
const double & ra,
const Vector & na,
const double & fa,
const Vector & b,
const double & rb,
const Vector & nb,
const double & fb,
const double & It,
int n )
static

Create a spline of TreeVertex primitives.

Parameters
a,bControl points.
na,nbControl directions.
ra,rbControl radii.
fa,fbControl length of directions.
ItIntensity.
nNumber of elements.

◆ QuadricSurface()

TreeUnion * TreeUnion::QuadricSurface ( const Vector & a,
const Vector & b,
const double & r,
const double & s,
const QuadricCurve2Set & q )
static

This function creates a surface of revolution.

The profile is a quadric Bézier curve controled by an array of control knots.

The field functions are simple normalized cubics (i.e. skeletal elements use the BlendCubic class).

Parameters
a,bThe end vertices of the axis.
r,sThe radius of influence and the strength of the field function.
qThe quadric curve.

◆ QuadricCurve()

TreeNode * TreeUnion::QuadricCurve ( const double & r,
const double & s,
const QuadricCurveSet & c )
static

This function creates a quadric Bézier curve controled by an array of control knots.

The field functions are simple normalized cubics (i.e. skeletal elements use the BlendCubic class).

Parameters
r,sThe radius of influence and the strength of the field function.
cThe piecewise Bézier quadric curve.

◆ Set()

TreeNode * TreeUnion::Set ( const QVector< TreeNode * > & set)
static

Union a set of sub-trees.

Parameters
setSet of nodes.

◆ BVHRecursive()

TreeNode * TreeUnion::BVHRecursive ( QVector< TreeNode * > & pts,
int begin,
int end )
staticprotected

Create a bounding box hierarchy.

Parameters
ptsSet of nodes.
begin,endIndexes of the nodes that should be organized into the hierarchy.

◆ OptimizeHierarchy()

TreeNode * TreeUnion::OptimizeHierarchy ( QVector< TreeNode * > & s,
int begin,
int end )
staticprotected

Recursive BVH Tree construction from a vector<TNode*>.

Parameters
sSet of sub-trees.
begin,endFirst and last indexes