Blob 1.0
TreeSphere Class Reference

Sphere primitive. More...

#include <blobtree.h>

Inheritance diagram for TreeSphere:
TreeNormal Sphere TreeElement TreeNode TreeBubble

Public Member Functions

 TreeSphere (const Vector &, const double &, BlendCompact *)
 Create a sphere skeleton element.
 
 TreeSphere (const double &, BlendCompact *)
 Create a sphere skeleton element, centered at origin.
 
virtual ~TreeSphere ()
 Destroys a sphere element.
 
double Intensity (const Vector &) const
 Compute the intensity at a given point.
 
double Omega (const Vector &) const
 
virtual TreeNodeCopy () const
 Create a deep copy of sphere element.
 
int Memory () const
 Compute the size of a node.
 
double K (const Ray &) const
 Returns a local Lipschitz constant along a ray.
 
double K (const RayStep &) const
 Compute the Lipschitz constant on a segment.
 
double K (const Segment &) const
 Compute the Lipschitz constant on a segment.
 
TreeNodeTranslate (const Vector &)
 Translates a sphere primitive.
 
TreeNodeRotate (const Matrix &)
 Rotates a sphere element.
 
TreeNodeScale (const double &)
 Scale a sphere primitive.
 
- Public Member Functions inherited from TreeNormal
 TreeNormal (BlendCompact *=nullptr)
 Creates a skeletal element given a blending function.
 
virtual ~TreeNormal ()
 Destroys a skeletal element.
 
virtual double R (const Vector &) const
 Computes the squared Euclidean distance to the skeleton.
 
virtual Vector Gradient (const Vector &) const
 Compute the gradient at a given point.
 
virtual void IntensityGradient (const Vector &, double &, Vector &) const
 Compute the field value and the gradient of the field function at a given point in space.
 
virtual double K (const Sphere &) const
 Compute the Lipschitz constant inside a sphere.
 
- Public Member Functions inherited from TreeElement
 TreeElement (BlendCompact *=nullptr)
 Creates a new element given a blending function.
 
virtual ~TreeElement ()
 Destroys an element.
 
double K () const
 Returns the Lipschitz constant of the element.
 
double K (const Box &) const
 Returns a local Lipschitz constant within a box domain.
 
TreeNodeCut (const Box &) const
 Cuts the node to simplify its structure inside a box.
 
- Public Member Functions inherited from TreeNode
 TreeNode ()
 Create a virtual node of the Blob-Tree structure.
 
virtual ~TreeNode ()
 Destroys a node.
 
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 TreeNodeScale (const Vector &)
 Insert a scaling node.
 
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 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 Member Functions

Vector Normal (const Vector &) const
 Computes the normal vector between a point and the sphere.
 

Additional Inherited Members

- Protected Attributes inherited from TreeElement
BlendCompactblend = nullptr
 Falloff function.
 
- 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

Sphere primitive.

Spheres differ from vertex elements as the field function inside the sphere is constant, whereas vertex elements have a varying field function everywhere.

Example of how to code a sphere primitive:

TreeNode *sphere=new TreeSphere(Vector(1,0,-2),4.0,new BlendCubic(2.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
TreeSphere(const Vector &, const double &, BlendCompact *)
Create a sphere skeleton element.
Definition treesphere.cpp:26

,

Constructor & Destructor Documentation

◆ TreeSphere() [1/2]

TreeSphere::TreeSphere ( const Vector & c,
const double & r,
BlendCompact * blend )
explicit

Create a sphere skeleton element.

Parameters
cCenter of the sphere.
rRadius.
blendFalloff function.

◆ TreeSphere() [2/2]

TreeSphere::TreeSphere ( const double & r,
BlendCompact * blend )
explicit

Create a sphere skeleton element, centered at origin.

Parameters
rRadius.
blendFalloff function.

Member Function Documentation

◆ Intensity()

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

Compute the intensity at a given point.

Parameters
pPoint.

Reimplemented from TreeNormal.

◆ Omega()

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

Reimplemented from TreeNode.

◆ K() [1/3]

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

Returns a local Lipschitz constant along a ray.

Returns the Lipschitz constant of the element if argument ray intersects the element's bounding box.

Parameters
rayThe ray.

Reimplemented from TreeElement.

◆ K() [2/3]

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

Compute the Lipschitz constant on a segment.

Parameters
raystepSegment.

Reimplemented from TreeNormal.

◆ K() [3/3]

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

Compute the Lipschitz constant on a segment.

Parameters
sSegment.

Reimplemented from TreeNormal.

◆ Translate()

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

Translates a sphere primitive.

Parameters
tTranslation vector.

Reimplemented from TreeNode.

◆ Rotate()

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

Rotates a sphere element.

Instead of inserting a rotation node in the tree, simply updates the center of the sphere.

Parameters
rRotation matrix.

Reimplemented from TreeNode.

◆ Scale()

TreeNode * TreeSphere::Scale ( const double & s)

Scale a sphere primitive.

Parameters
sScaling factor.

◆ Normal()

Vector TreeSphere::Normal ( const Vector & p) const
protectedvirtual

Computes the normal vector between a point and the sphere.

This function calls Sphere::Normal();

Parameters
pPoint.

Implements TreeNormal.