HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_ImplicitBasicSurface< PREC > Class Template Reference

#include <GEO_ImplicitBasicSurface.h>

Public Member Functions

 GEO_ImplicitBasicSurface ()=default
 
 GEO_ImplicitBasicSurface (const char *name, const VEXvec3< PREC > &P, const VEXmat3< PREC > &transform, const VEXvec4< PREC > &shapevals)
 
VEXfloat< PREC > eval (const VEXvec3< PREC > &P) const
 Evaluate SDF at point P (world space) More...
 
VEXfloat< PREC > eval (const VEXvec3< PREC > &P, VEXvec3< PREC > &grad) const
 Evaluate SDF with spatial gradient. More...
 
VEXfloat< PREC > eval (const VEXvec3< PREC > &P, VEXvec3< PREC > &grad, UT_Vector4T< VEXfloat< PREC >> &parms_grad) const
 Evaluate SDF with spatial and parameter gradients. More...
 
template<bool WantGrad, bool WantParmGrad>
void evalBatched (int npts, const VEXvec3< PREC > *P, VEXfloat< PREC > *sdf, VEXvec3< PREC > *grad, UT_Vector4T< VEXfloat< PREC >> *parms_grad) const
 Batched evaluation helper with compile-time output control. More...
 
UT_IntervalT< VEXfloat< PREC > > evalInterval (const UT_BoundingBoxT< VEXfloat< PREC >> &P) const
 Evaluate SDF bounds for interval box (world space) More...
 
UT_IntervalT< VEXfloat< PREC > > evalInterval (const VEXvec3< PREC > &center, VEXfloat< PREC > radius) const
 
VEXfloat< PREC > operator() (const VEXvec3< PREC > &P) const
 Operator() overloads. More...
 
VEXfloat< PREC > operator() (const VEXvec3< PREC > &P, VEXvec3< PREC > &grad) const
 
VEXfloat< PREC > operator() (const VEXvec3< PREC > &P, VEXvec3< PREC > &grad, UT_Vector4T< VEXfloat< PREC >> &parms_grad) const
 
UT_IntervalT< VEXfloat< PREC > > operator() (const UT_BoundingBoxT< VEXfloat< PREC >> &P) const
 
UT_IntervalT< VEXfloat< PREC > > operator() (const VEXvec3< PREC > &center, VEXfloat< PREC > radius) const
 
void scale (VEXfloat< PREC > s)
 Scale all distance-valued parameters by uniform factor. More...
 
VEXvec3< PREC > worldToLocal (const VEXvec3< PREC > &P) const
 Transform world point to local reference frame. More...
 
VEXvec3< PREC > localToWorld (const VEXvec3< PREC > &P) const
 Transform point from reference frame to world space. More...
 
VEXvec3< PREC > worldToLocalVec (const VEXvec3< PREC > &vec) const
 Transform local gradient to world space. More...
 
VEXvec3< PREC > localToWorldVec (const VEXvec3< PREC > &vec) const
 Transform local gradient to world space. More...
 
UT_BoundingBoxT< VEXfloat< PREC > > worldToLocalInterval (const UT_BoundingBoxT< VEXfloat< PREC >> &P) const
 Transform world interval box to local reference frame. More...
 

Static Public Member Functions

static GEO_ImplicitShapeID shapeNameToID (const char *name)
 Convert shape name string to ID. More...
 
static const char * shapeIDToName (GEO_ImplicitShapeID id)
 Convert shape ID to name string. More...
 

Public Attributes

VEXvec3< PREC > myPos = {0, 0, 0}
 Position of the shape in world space. More...
 
VEXmat3< PREC > myTransform = {1,0,0, 0,1,0, 0,0,1}
 
UT_Vector4T< VEXfloat< PREC > > myParms = {1, 1, 1, 0}
 Parameters describing the shape. More...
 
GEO_ImplicitShapeID myId = GEO_ImplicitShapeID::Empty
 

Detailed Description

template<VEX_Precision PREC>
class GEO_ImplicitBasicSurface< PREC >

Basic Implicit Surface - unified wrapper for elementary implicit surfaces. This class stores transform (position, orientation) and shape parameters, dispatching to the appropriate SDF based on shape ID.

Typically initialized from geometry point attributes: P, orient, shape_parms, shape_id, shape_invert

Definition at line 59 of file GEO_ImplicitBasicSurface.h.

Constructor & Destructor Documentation

template<VEX_Precision PREC>
GEO_ImplicitBasicSurface< PREC >::GEO_ImplicitBasicSurface ( )
default
template<VEX_Precision PREC>
GEO_ImplicitBasicSurface< PREC >::GEO_ImplicitBasicSurface ( const char *  name,
const VEXvec3< PREC > &  P,
const VEXmat3< PREC > &  transform,
const VEXvec4< PREC > &  shapevals 
)

Make basic shape fron its name, position, transform and parameters

The transform does not have to be rotation matrix. Scales are extracted and applied to parameters Any shearing or non-uniform scaling is ignored

Member Function Documentation

template<VEX_Precision PREC>
VEXfloat<PREC> GEO_ImplicitBasicSurface< PREC >::eval ( const VEXvec3< PREC > &  P) const

Evaluate SDF at point P (world space)

template<VEX_Precision PREC>
VEXfloat<PREC> GEO_ImplicitBasicSurface< PREC >::eval ( const VEXvec3< PREC > &  P,
VEXvec3< PREC > &  grad 
) const

Evaluate SDF with spatial gradient.

template<VEX_Precision PREC>
VEXfloat<PREC> GEO_ImplicitBasicSurface< PREC >::eval ( const VEXvec3< PREC > &  P,
VEXvec3< PREC > &  grad,
UT_Vector4T< VEXfloat< PREC >> &  parms_grad 
) const

Evaluate SDF with spatial and parameter gradients.

template<VEX_Precision PREC>
template<bool WantGrad, bool WantParmGrad>
void GEO_ImplicitBasicSurface< PREC >::evalBatched ( int  npts,
const VEXvec3< PREC > *  P,
VEXfloat< PREC > *  sdf,
VEXvec3< PREC > *  grad,
UT_Vector4T< VEXfloat< PREC >> *  parms_grad 
) const

Batched evaluation helper with compile-time output control.

template<VEX_Precision PREC>
UT_IntervalT<VEXfloat<PREC> > GEO_ImplicitBasicSurface< PREC >::evalInterval ( const UT_BoundingBoxT< VEXfloat< PREC >> &  P) const

Evaluate SDF bounds for interval box (world space)

template<VEX_Precision PREC>
UT_IntervalT<VEXfloat<PREC> > GEO_ImplicitBasicSurface< PREC >::evalInterval ( const VEXvec3< PREC > &  center,
VEXfloat< PREC >  radius 
) const

Evaluate SDF bounds for bounding sphere (world space). Cheaper than evalInterval when P comes from a rotated region, since transforming a sphere to local space only rotates the center.

template<VEX_Precision PREC>
VEXvec3<PREC> GEO_ImplicitBasicSurface< PREC >::localToWorld ( const VEXvec3< PREC > &  P) const

Transform point from reference frame to world space.

template<VEX_Precision PREC>
VEXvec3<PREC> GEO_ImplicitBasicSurface< PREC >::localToWorldVec ( const VEXvec3< PREC > &  vec) const

Transform local gradient to world space.

template<VEX_Precision PREC>
VEXfloat<PREC> GEO_ImplicitBasicSurface< PREC >::operator() ( const VEXvec3< PREC > &  P) const
inline

Operator() overloads.

Definition at line 112 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
VEXfloat<PREC> GEO_ImplicitBasicSurface< PREC >::operator() ( const VEXvec3< PREC > &  P,
VEXvec3< PREC > &  grad 
) const
inline

Definition at line 116 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
VEXfloat<PREC> GEO_ImplicitBasicSurface< PREC >::operator() ( const VEXvec3< PREC > &  P,
VEXvec3< PREC > &  grad,
UT_Vector4T< VEXfloat< PREC >> &  parms_grad 
) const
inline

Definition at line 120 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
UT_IntervalT<VEXfloat<PREC> > GEO_ImplicitBasicSurface< PREC >::operator() ( const UT_BoundingBoxT< VEXfloat< PREC >> &  P) const
inline

Definition at line 125 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
UT_IntervalT<VEXfloat<PREC> > GEO_ImplicitBasicSurface< PREC >::operator() ( const VEXvec3< PREC > &  center,
VEXfloat< PREC >  radius 
) const
inline

Definition at line 130 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
void GEO_ImplicitBasicSurface< PREC >::scale ( VEXfloat< PREC >  s)
inline

Scale all distance-valued parameters by uniform factor.

Definition at line 141 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
static const char* GEO_ImplicitBasicSurface< PREC >::shapeIDToName ( GEO_ImplicitShapeID  id)
static

Convert shape ID to name string.

template<VEX_Precision PREC>
static GEO_ImplicitShapeID GEO_ImplicitBasicSurface< PREC >::shapeNameToID ( const char *  name)
static

Convert shape name string to ID.

template<VEX_Precision PREC>
VEXvec3<PREC> GEO_ImplicitBasicSurface< PREC >::worldToLocal ( const VEXvec3< PREC > &  P) const

Transform world point to local reference frame.

template<VEX_Precision PREC>
UT_BoundingBoxT<VEXfloat<PREC> > GEO_ImplicitBasicSurface< PREC >::worldToLocalInterval ( const UT_BoundingBoxT< VEXfloat< PREC >> &  P) const

Transform world interval box to local reference frame.

template<VEX_Precision PREC>
VEXvec3<PREC> GEO_ImplicitBasicSurface< PREC >::worldToLocalVec ( const VEXvec3< PREC > &  vec) const

Transform local gradient to world space.

Member Data Documentation

template<VEX_Precision PREC>
GEO_ImplicitShapeID GEO_ImplicitBasicSurface< PREC >::myId = GEO_ImplicitShapeID::Empty

Definition at line 69 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
UT_Vector4T<VEXfloat<PREC> > GEO_ImplicitBasicSurface< PREC >::myParms = {1, 1, 1, 0}

Parameters describing the shape.

Definition at line 68 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
VEXvec3<PREC> GEO_ImplicitBasicSurface< PREC >::myPos = {0, 0, 0}

Position of the shape in world space.

Definition at line 63 of file GEO_ImplicitBasicSurface.h.

template<VEX_Precision PREC>
VEXmat3<PREC> GEO_ImplicitBasicSurface< PREC >::myTransform = {1,0,0, 0,1,0, 0,0,1}

Rotation matrix from reference frame to world space It is assumed that this matrix is rotation!

Definition at line 66 of file GEO_ImplicitBasicSurface.h.


The documentation for this class was generated from the following file: