Core 1.0
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Algebraic Class Reference

Trivariate polynomials of maximum degree 15. More...

#include <algebraic.h>

Inheritance diagram for Algebraic:
AnalyticScalarField

Public Member Functions

 Algebraic ()
 Creates a null algebraic expression.
 
 Algebraic (const Box &, int, const QVector< double > &)
 Creates an algebraic implicit surface. More...
 
 Algebraic (const Box &, int)
 Creates an algebraic implicit surface. More...
 
virtual ~Algebraic ()
 Empty.
 
double & operator() (int, int, int)
 Returns the value of term xijk in the array of coefficients. More...
 
double operator() (int, int, int) const
 Return the value of term xijk in the array of coefficients. More...
 
double & operator() (int)
 Returns the value of the term. More...
 
double operator() (int) const
 Returns the value of the term. More...
 
double Value (const Vector &) const
 Compute the intensity at a point in space. More...
 
Vector Gradient (const Vector &) const
 Compute the gradient of the algebraic field function at a point in space. More...
 
int Intersect (const Ray &, double *, const double &) const
 Computes the intersection between a ray and an algebraic surface. More...
 
virtual Box GetBox () const
 Returns the bounding box of the algebraic surface. More...
 
virtual double K () const
 Return the global Lipschitz constant of the algebraic functions.
 
virtual double K (const Box &) const
 Compute the Lipschitz constant of the algebraic function in a box. More...
 
- Public Member Functions inherited from AnalyticScalarField
 AnalyticScalarField (bool=true)
 Constructor. More...
 
Matrix Hessian (const Vector &) const
 Compute the Hessian symmetric matrix of the field function. More...
 
virtual Color GetMaterial (const Vector &, const Vector &=Vector::Null) const
 Compute the color. More...
 
virtual Vector Normal (const Vector &) const
 Compute the normal to the surface. More...
 
void Curvature (const Vector &, double &, double &) const
 Compute the gaussian and mean curvatures. More...
 
Vector Cast (const Vector &, const double &, const double &=1e-6, int n=100) const
 Given a starting vertex x, project it onto the implicit surface following the gradient. More...
 
Vector Dichotomy (Vector, Vector, double, double, double, const double &=1.0e-4) const
 Compute the intersection between a segment and an implicit surface. More...
 
virtual bool GetSample (Vector &, const Box &, Random &=Random::R239) const
 Find a point sample on the implicit surface. More...
 
virtual int GetSamples (QVector< Vector > &, const Box &, int, Random &=Random::R239) const
 Find a set of random sample points on the implicit surface. More...
 
virtual QVector< VectorPoisson (double, int, Random &=Random::R239) const
 Compute a Poisson sphere distribution on an implicit surface. More...
 
virtual ScalarField2 Sample (const Rectangles &, int, int) const
 Compute the field function at the vertices a grid. More...
 
virtual ScalarField2 Sample (const Quadrangle &, int) const
 Sample the scalar field on a quadrangle. More...
 
virtual ScalarField Sample (const Box &, int) const
 Sample the implicit surface to get a scalar field. More...
 
int Roots (const Ray &, const double &, const double &, const double &, double *, int=1, const double &=1.0e-4) const
 Find the intersections between a ray and an implicit surface on a given interval. More...
 
int Roots (const Ray &, const double &, const double &, const double &, const double &, const double &, double *, int=1, const double &=1.0e-4) const
 This functions searches the intersections between a ray and an implicit surface on a given interval. More...
 
virtual double K (const Sphere &) const
 Compute the local Lipschitz constant inside a box. More...
 
virtual double K (const Segment &) const
 Compute the local Lipschitz constant along a segment. More...
 
virtual void Polygonize (int, Mesh &, const Box &, const double &=1e-4) const
 Compute the polygonal mesh approximating the implicit surface. More...
 
virtual void PolygonizeLucie (const Box &, Mesh &, bool, bool) const
 Implementation of the original continuation polygonization method. More...
 
virtual void PolygonizeLucie (const double &, Mesh &, bool, bool) const
 Wyvill's marching cubes algorithm. More...
 
virtual void Dual (int, Mesh &, const Box &) const
 Dual polygonization. More...
 
virtual bool SphereTrace (const Ray &, const double &, const double &, const double &, double &, int &, const double &=1e-4) const
 Find the first intersection between a ray and an implicit surface on a given interval, using sphere tracing. More...
 
virtual void Polygonize (const Box &, QVector< Triangle > &, const double &=1e-4, bool=false) const
 Polygonize a cube. More...
 
virtual void Polygonize (const Tetrahedra &, QVector< Triangle > &, const double &=1e-4) const
 Polygonize a tetrahedral cell. More...
 
virtual Mesh PolygonizeOctree (const Box &, int, const double &=1e-4) const
 Compute the polygonal mesh approximating the implicit surface using an octree decomposition of space. More...
 
virtual void Voxelize (const Box &, int, Box &, QVector< Vector > &) const
 Voxelize the scalar field. More...
 
virtual void Voxelize (int, Voxel &, const Box &) const
 Voxelization. More...
 
virtual void Colorize (const Mesh &, MeshColor &) const
 Colorize the vertexes of a mesh according to the analytic scalar field. More...
 

Static Public Member Functions

static double Barth (const Vector &, const double &)
 Compute the Barth sextic value. More...
 
- Static Public Member Functions inherited from AnalyticScalarField
static int Cubes ()
 Get the number of cubes processed.
 

Protected Attributes

int n = 0
 Order of the algebraic surface.
 
int size = 0
 Size of the array containing the coefficients.
 
Box box = Box::Null
 Box.
 
double k = 0
 Lipschitz constant.
 
QVector< double > c
 Array of coefficients.
 
- Protected Attributes inherited from AnalyticScalarField
bool sign = true
 Sign convention, used for normal computation.
 

Static Protected Attributes

static const int degree = 15
 Maximum order of algebraic polynomial.
 
- Static Protected Attributes inherited from AnalyticScalarField
static int ncubes = 0
 Number of cubes processed by polygonization algorithms.
 
static const double Epsilon = 1e-6
 Epsilon value for partial derivatives.
 

Additional Inherited Members

- Protected Member Functions inherited from AnalyticScalarField
bool Find (Vector &, bool, const Box &, int=10000, Random &=Random::R239) const
 Find a random sample point inside or outside the surface. More...
 

Detailed Description

Trivariate polynomials of maximum degree 15.

The algebraic surface should be embedded in a bounding box.

Constructor & Destructor Documentation

◆ Algebraic() [1/2]

Algebraic::Algebraic ( const Box b,
int  n,
const QVector< double > &  a 
)
explicit

Creates an algebraic implicit surface.

If the array pointer is either null or not specified, coefficients are initialized to 0.0, otherwise arguments are copied in an local array.

Parameters
bThe box.
nDegree of the trivariate polynomial.
aArray of coeffcients which will be copied.

◆ Algebraic() [2/2]

Algebraic::Algebraic ( const Box b,
int  n 
)
explicit

Creates an algebraic implicit surface.

If the array pointer is either null or not specified, coefficients are initialized to 0.0, otherwise arguments are copied in an local array.

Parameters
bThe box.
nDegree of the trivariate polynomial.

Member Function Documentation

◆ Barth()

double Algebraic::Barth ( const Vector p,
const double &  w 
)
static

Compute the Barth sextic value.

Parameters
pPoint.
wParameter.

◆ GetBox()

Box Algebraic::GetBox ( ) const
inlinevirtual

Returns the bounding box of the algebraic surface.

As the field function is not bounded in space, this box was provided as a parameter in the constructor.

Reimplemented from AnalyticScalarField.

◆ Gradient()

Vector Algebraic::Gradient ( const Vector p) const
virtual

Compute the gradient of the algebraic field function at a point in space.

Parameters
pPoint.

Reimplemented from AnalyticScalarField.

◆ Intersect()

int Algebraic::Intersect ( const Ray ray,
double *  t,
const double &  maxdepth 
) const

Computes the intersection between a ray and an algebraic surface.

First perform the intersection test between the ray and the box, and escape if no intersections ocur. Intersections within the box interval are stacked in the depth stack array.

Parameters
rayThe ray.
tDepth stack which should be defined as an array.
maxdepthMaximum intersection depth.

◆ K()

double Algebraic::K ( const Box box) const
virtual

Compute the Lipschitz constant of the algebraic function in a box.

Parameters
boxThe box.

Reimplemented from AnalyticScalarField.

◆ operator()() [1/4]

double & Algebraic::operator() ( int  t)
inline

Returns the value of the term.

Parameters
tTerm index, which could be computed from exponents using Term.

◆ operator()() [2/4]

double Algebraic::operator() ( int  t) const
inline

Returns the value of the term.

Parameters
tTerm index, which could be computed from exponents using Term.

◆ operator()() [3/4]

double & Algebraic::operator() ( int  i,
int  j,
int  k 
)

Returns the value of term xijk in the array of coefficients.

Parameters
i,j,kIndexes.

◆ operator()() [4/4]

double Algebraic::operator() ( int  i,
int  j,
int  k 
) const

Return the value of term xijk in the array of coefficients.

Parameters
i,j,kIndexes.

◆ Value()

double Algebraic::Value ( const Vector p) const
virtual

Compute the intensity at a point in space.

Parameters
pPoint.

Reimplemented from AnalyticScalarField.