Blob 1.0
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
TreeNode Class Referenceabstract

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

#include <blobtree.h>

Inheritance diagram for TreeNode:
TreeElement TreeOperator TreeNoiseSphere 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 TreeBlobby TreeCloneFrame TreeCloneTranslate 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 void IntensityGradient (const Vector &, double &, Vector &) const
 Computes the field value and the gradient at a given point in space. More...
 
virtual Vector Gradient (const Vector &) const
 Computes the gradient of the field function at a given point in space. More...
 
virtual TreeNodeBlend (TreeNode *)
 Insert a blending node that blends the old and the new sub-tree together. More...
 
virtual TreeNodeUnion (TreeNode *)
 Insert a union node that unions the old and the new sub-tree together. More...
 
virtual TreeNodeDifference (TreeNode *)
 Insert a difference node. More...
 
virtual TreeNodeTranslate (const Vector &)
 Insert a translation node. More...
 
virtual TreeNodeRotate (const Matrix &)
 Insert a rotation node. More...
 
virtual TreeNodeScale (const Vector &)
 Insert a scaling node. More...
 
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. More...
 
virtual double K (const RayStep &) const
 Compute the Lipschitz constant along an optimized ray-stepping segment. More...
 
virtual double K (const Sphere &) const
 Compute the Lipschitz constant in a sphere. More...
 
Box GetBox () const
 Return the bounding box of the node.
 
virtual void SetThreshold (const double &)
 Set the threshold value. More...
 
virtual Color GetMaterial (const Vector &, const Vector &=Vector::Null) const
 Gets the color of a node at a point. More...
 
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 Vector Dichotomy (Vector, Vector, double, double, double, const double &=1.0e-4)
 Compute the intersection between the implicit surface and a segment. More...
 

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

◆ 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.

◆ 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.

◆ Difference()

TreeNode * TreeNode::Difference ( TreeNode e)
virtual

Insert a difference node.

Parameters
eElement.

◆ GetMaterial()

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

◆ 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 TreeUnion, TreeIntersection, TreeCloneTranslate, TreeCloneFrame, TreeAlpha, TreeDifference, TreeBlend, TreeHyperBlend, TreeBlendSquared, TreeBlendUnion, TreeNormal, TreeVertex, TreeConeSphere, TreeFrame, TreeTranslate, TreeRotate, TreeScale, TreeTwist, TreeTaper, and TreeTexture.

◆ 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.

◆ K() [1/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 TreeUnion, TreeIntersection, TreeCloneTranslate, TreeCloneFrame, TreeDifference, TreeBlend, TreeNormal, TreeNoiseSphere, TreeVertex, TreeSphere, TreeEdge, TreeBox, TreeTranslate, TreeRotate, TreeScale, TreeTwist, TreeTaper, and TreeTexture.

◆ K() [2/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 TreeUnion, TreeIntersection, TreeCloneTranslate, TreeCloneFrame, TreeAlpha, TreeDifference, TreeBlend, TreeHyperBlend, TreeBlendSquared, TreeContact, TreeBlendUnion, TreeElement, TreeNormal, TreeNoiseSphere, TreeVertex, TreeSphere, TreeEdge, TreeBox, TreeFrame, TreeTranslate, TreeRotate, TreeScale, TreeTwist, TreeTaper, and TreeTexture.

◆ 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 TreeUnion, TreeIntersection, TreeCloneTranslate, TreeCloneFrame, TreeAlpha, TreeDifference, TreeBlend, TreeBlendSquared, TreeContact, TreeElement, TreeNormal, TreeFrame, TreeTranslate, TreeRotate, TreeScale, TreeTwist, TreeTaper, and TreeTexture.

◆ Rotate()

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

Insert a rotation node.

Parameters
rRotation matrix.

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

◆ Scale()

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

Insert a scaling node.

Parameters
sScaling vector.

Reimplemented in TreeVertex, TreeEdge, TreeQuadric, and TreeScale.

◆ 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, TreeUnary, TreeCloneTranslate, TreeCloneFrame, and TreeOperator.

◆ Translate()

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

Insert a translation node.

Parameters
tTranslation vector.

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

◆ Union()

TreeNode * TreeNode::Union ( TreeNode e)
virtual

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

Parameters
eElement.