Blob 1.0
TreeNode Class Referenceabstract

The generic nodes with some pure virtual functions. More...

#include <blobtree.h>

Inheritance diagram for TreeNode:
TreeElement TreeOperator TreeNormal TreeBinary TreeUnary TreeBox TreeCircle TreeCircleArc TreeCircleArcSwept TreeCone TreeConeSphere TreeConic TreeCubic TreeCubicCurve TreeCylinder TreeCylinderBox TreeDisc TreeEdge TreeHemisphere TreeHemisphereDisc TreeHollowBox TreeOctahedron TreePoly TreePyramid TreeQuadric TreeQuadricCurve TreeRectangle TreeRectangleDisc TreeSphere TreeTetra TreeTorus TreeTriangle TreeTubular TreeVertex TreeBlend TreeBlendRUnion TreeBlendSquared TreeBlendUnion TreeContact TreeDifference TreeHyperBlend TreeIntersection TreeUnion TreeAlpha TreeCloneFrame TreeCloneTranslate TreeInstantiate TreeNoise TreeTexture TreeWarp

Public Member Functions

 TreeNode ()
 Create a virtual node of the Blob-Tree structure.
 
virtual ~TreeNode ()
 Destroys a node.
 
virtual double Intensity (const Vector &) const =0
 Compute the field function value at a given point in space.
 
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 Vector Gradient (const Vector &) const
 Computes the gradient of the field function 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.
 
virtual TreeNodeCopy () const =0
 Creates a deep copy of the node, recursively traversing the whole structure.
 
virtual double K () const =0
 Compute the Lipschitz constant of the node.
 
virtual double K (const Box &) const =0
 Compute the local Lipschitz constant in a box.
 
virtual double K (const Ray &) const =0
 Compute the local Lipschitz along a ray.
 
virtual double K (const Segment &) const
 Compute the Lipschitz constant along a segment.
 
virtual double K (const RayStep &) const
 Compute the Lipschitz constant along an optimized ray-stepping segment.
 
virtual double K (const Sphere &) const
 Compute the Lipschitz constant in a sphere.
 
Box GetBox () const
 Return the bounding box of the node.
 
virtual void SetThreshold (const double &)
 Set the threshold value.
 
virtual Color GetMaterial (const Vector &, const Vector &=Vector::Null) const
 Gets the color of a node at a point.
 
virtual TreeNodeCut (const Box &) const =0
 Cuts the node to simplify its structure inside a box.
 
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 QString Show (int=0) const
 Show the tree hierarchy.
 
virtual Vector Dichotomy (Vector, Vector, double, double, double, const double &=1.0e-4)
 Compute the intersection between the implicit surface and a segment.
 

Protected Attributes

Box box = Box::Null
 Bounding box of the node.
 
double T = 0.5
 Threshold value.
 

Static Protected Attributes

static const double Epsilon = 1e-6
 Epsilon value for gradient computation.
 

Detailed Description

The generic nodes with some pure virtual functions.

All nodes include a Box to accelerate queries in the Blob-Tree such as ray-intersections, field function or gradient evaluation.

Member Function Documentation

◆ Omega()

double TreeNode::Omega ( const Vector & p) const
virtual

Return the squared distance to the compact support of the node.

Parameters
pPoint.

Reimplemented in TreeBox, TreeCylinder, TreeEdge, TreeHemisphereDisc, TreeSphere, TreeTorus, TreeTriangle, and TreeVertex.

◆ IntensityGradient()

void TreeNode::IntensityGradient ( const Vector & p,
double & value,
Vector & gradient ) const
virtual

Computes the field value and the gradient at a given point in space.

This virtual function computes the gradient and the field values separately, calling TreeNode::Intensity and TreeNode::Gradient respectively. This technique is slower however than some specific implementations which can be optimized for some primitives, in particular distance based primitives.

See also
TreeVertex::IntensityGradient
Parameters
pPoint.
valueReturned field value.
gradientReturned gradient.

Reimplemented in TreeBlend, TreeNormal, and TreeVertex.

◆ Gradient()

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

Computes the gradient of the field function at a given point in space.

If the closed form expression of the gradient is not implemented in derivatives of TreeNode, use this approximation instead.

Parameters
pPoint.

Reimplemented in TreeAlpha, TreeBlend, TreeBlendSquared, TreeBlendUnion, TreeCloneFrame, TreeCloneTranslate, TreeConeSphere, TreeDifference, TreeFrame, TreeHyperBlend, TreeInstantiate, TreeIntersection, TreeNormal, TreeRotate, TreeScale, TreeTaper, TreeTexture, TreeTranslate, TreeTwist, TreeUnion, and TreeVertex.

◆ Blend()

TreeNode * TreeNode::Blend ( TreeNode * e)
virtual

Insert a blending node that blends the old and the new sub-tree together.

Parameters
eElement.

Reimplemented in TreeBlend.

◆ Union()

TreeNode * TreeNode::Union ( TreeNode * e)
virtual

Insert a union node that unions the old and the new sub-tree together.

Parameters
eElement.

◆ Difference()

TreeNode * TreeNode::Difference ( TreeNode * e)
virtual

Insert a difference node.

Parameters
eElement.

◆ Translate()

TreeNode * TreeNode::Translate ( const Vector & t)
virtual

Insert a translation node.

Parameters
tTranslation vector.

Reimplemented in TreeBlend, TreeBubble, TreeCone, TreeConic, TreeCubic, TreeCylinder, TreeEdge, TreeQuadric, TreeRectangleDisc, TreeSphere, TreeTranslate, and TreeVertex.

◆ Rotate()

TreeNode * TreeNode::Rotate ( const Matrix & r)
virtual

Insert a rotation node.

Parameters
rRotation matrix.

Reimplemented in TreeBlend, TreeBubble, TreeCone, TreeConic, TreeCubic, TreeCylinder, TreeEdge, TreeQuadric, TreeRectangleDisc, TreeRotate, TreeSphere, and TreeVertex.

◆ Scale()

TreeNode * TreeNode::Scale ( const Vector & s)
virtual

Insert a scaling node.

Parameters
sScaling vector.

Reimplemented in TreeEdge, TreeQuadric, TreeScale, and TreeVertex.

◆ K() [1/3]

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

Compute the Lipschitz constant along a segment.

By default return the Lipchitz constant of the bounding box of the segment.

Parameters
sThe segment.

Reimplemented in TreeAlpha, TreeBlend, TreeBlendSquared, TreeBlendUnion, TreeBox, TreeCloneFrame, TreeCloneTranslate, TreeContact, TreeDifference, TreeEdge, TreeElement, TreeFrame, TreeHyperBlend, TreeInstantiate, TreeIntersection, TreeNormal, TreeRotate, TreeScale, TreeSphere, TreeTaper, TreeTexture, TreeTranslate, TreeTwist, TreeUnion, and TreeVertex.

◆ K() [2/3]

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

Compute the Lipschitz constant along an optimized ray-stepping segment.

By default return the Lipchitz constant of the segment, i.e. do not use optimized algorithms with pre-computed data in RayStep.

Parameters
raystepThe step.

Reimplemented in TreeBlend, TreeBox, TreeCloneFrame, TreeCloneTranslate, TreeDifference, TreeEdge, TreeInstantiate, TreeIntersection, TreeNormal, TreeRotate, TreeScale, TreeSphere, TreeTaper, TreeTexture, TreeTranslate, TreeTwist, TreeUnion, and TreeVertex.

◆ K() [3/3]

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

Compute the Lipschitz constant in a sphere.

By default return the Lipchitz constant of the bounding box of the sphere.

Parameters
sThe sphere.

Reimplemented in TreeAlpha, TreeBlend, TreeBlendSquared, TreeCloneFrame, TreeCloneTranslate, TreeContact, TreeDifference, TreeElement, TreeFrame, TreeInstantiate, TreeIntersection, TreeNormal, TreeRotate, TreeScale, TreeTaper, TreeTexture, TreeTranslate, TreeTwist, and TreeUnion.

◆ SetThreshold()

void TreeNode::SetThreshold ( const double & T)
virtual

Set the threshold value.

The threshold which may be needed for the direct evaluation of the surface under some specific circumstances.

Parameters
TThreshold.

Reimplemented in TreeBinary, TreeCloneFrame, TreeCloneTranslate, TreeInstantiate, TreeOperator, and TreeUnary.

◆ GetMaterial()

Color TreeNode::GetMaterial ( const Vector & ,
const Vector & = Vector::Null ) const
virtual

◆ Show()

QString TreeNode::Show ( int space = 0) const
virtual

◆ Dichotomy()

Vector TreeNode::Dichotomy ( Vector a,
Vector b,
double va,
double vb,
double length,
const double & epsilon = 1.0e-4 )
virtual

Compute the intersection between the implicit surface and a segment.

Parameters
a,bSegment vertices.
va,vbField value at segment vertices.
lengthDistance between a and b.
epsilonAccuracy.