OpenSubdiv
Loading...
Searching...
No Matches
Surface< REAL > Class Template Reference

Encapsulates the limit surface for a face of a mesh. More...

#include <surface.h>

Classes

struct  PointDescriptor
 Simple struct defining the size and stride of points in arrays. More...
 

Public Types

typedef int Index
 Integer type representing a mesh index.
 

Public Member Functions

Construction and initialization

Instances of Surface may be explicitly constructed, but are initialized by SurfaceFactory and so only default construction is provided. An instance will be invalid (and so unusable) if default constructed, or if the factory that initialized it determined that the face associated with it has no limit surface.

bool IsValid () const
 Return true if successfully initialized.
 
void Clear ()
 Clear a previously initialized Surface.
 
 Surface ()
 Default construction produces an invalid instance.
 
 Surface (Surface const &src)=default
 
Surfaceoperator= (Surface const &src)=default
 
 ~Surface ()=default
 
Simple queries

Simple queries of valid Surface.

Parameterization GetParameterization () const
 Return the Parameterization.
 
int GetFaceSize () const
 Return the size of the face.
 
bool IsRegular () const
 Return if the Surface is a single regular patch.
 
bool IsLinear () const
 Return if the Surface is linear.
 
Methods to manage control points

Control points are the subset of points in the mesh that influence a Surface. They can be identified as part of the mesh data by their indices, or gathered into an array for other purposes.

It is not necessary to deal directly with control points for evaluation, but they are useful with limit stencils and other purposes, e.g. computing a bounding box of the control hull of the Surface.

Note that methods that access control points from the array of mesh data require that the array be contiguous. If a large data set is fragmented into blocks or pages, these methods cannot be used and control points will need to be gathered explicitly.

int GetNumControlPoints () const
 Return the number of control points affecting the Surface.
 
int GetControlPointIndices (Index meshPointIndices[]) const
 Identify indices of control points in the mesh.
 
template<typename REAL_MESH >
void GatherControlPoints (REAL_MESH const meshPoints[], PointDescriptor const &meshPointDesc, REAL controlPoints[], PointDescriptor const &controlPointDesc) const
 Gather control points in a local array.
 
void BoundControlPoints (REAL const controlPoints[], PointDescriptor const &controlPointDesc, REAL minExtent[], REAL maxExtent[]) const
 Compute bounds of control points from a local array.
 
void BoundControlPointsFromMesh (REAL const meshPoints[], PointDescriptor const &meshPointDesc, REAL minExtent[], REAL maxExtent[]) const
 Compute bounds of control points from the mesh data.
 
Methods to manage patch points

Patch points are derived from the control points and are used to evaluate the Surface. The patch points always include the control points as a subset.

int GetNumPatchPoints () const
 Return the number of patch points representing the Surface.
 
void PreparePatchPoints (REAL const meshPoints[], PointDescriptor const &meshPointDesc, REAL patchPoints[], PointDescriptor const &patchPointDesc) const
 Prepare patch points in a local array for evaluation.
 
void ComputePatchPoints (REAL patchPoints[], PointDescriptor const &patchPointDesc) const
 Compute all patch points following the control points.
 
Evaluation of positions and derivatives

Evaluation methods use the patch points to compute position, 1st and 2nd derivatives of the Surface at a given (u,v) coordinate within the domain of the Surface's Parameterization. All parameters of the different overloads are required.

void Evaluate (REAL const uv[2], REAL const patchPoints[], PointDescriptor const &pointDesc, REAL P[]) const
 Evaluation of position.
 
void Evaluate (REAL const uv[2], REAL const patchPoints[], PointDescriptor const &pointDesc, REAL P[], REAL Du[], REAL Dv[]) const
 Overload of evaluation for 1st derivatives.
 
void Evaluate (REAL const uv[2], REAL const patchPoints[], PointDescriptor const &pointDesc, REAL P[], REAL Du[], REAL Dv[], REAL Duu[], REAL Duv[], REAL Dvv[]) const
 Overload of evaluation for 2nd derivatives.
 

Evaluation and application of limit stencils

Limit stencils are sets of coefficients that express an evaluation as a linear combination of the control points. As with the direct evaluation methods, they are overloaded to optionally provide evaluation for 1st and 2nd derivatives.

In addition to methods to provide limit stencils, methods are also provided to apply them to the control points. Since application of stencils is identical for each (i.e. the same for position and any derivative) no overloads are provided for derivatives.

class SurfaceFactory
 
int EvaluateStencil (REAL const uv[2], REAL sP[]) const
 Evaluation of the limit stencil for position.
 
int EvaluateStencil (REAL const uv[2], REAL sP[], REAL sDu[], REAL sDv[]) const
 Overload of limit stencil evaluation for 1st derivatives.
 
int EvaluateStencil (REAL const uv[2], REAL sP[], REAL sDu[], REAL sDv[], REAL sDuu[], REAL sDuv[], REAL sDvv[]) const
 Overload of limit stencil evaluation for 2nd derivatives.
 
void ApplyStencil (REAL const stencil[], REAL const controlPoints[], PointDescriptor const &, REAL result[]) const
 Apply a single stencil to control points from a local array.
 
void ApplyStencilFromMesh (REAL const stencil[], REAL const meshPoints[], PointDescriptor const &, REAL result[]) const
 Apply a single stencil to control points from the mesh data.
 

Detailed Description

template<typename REAL>
class OpenSubdiv::OPENSUBDIV_VERSION::Bfr::Surface< REAL >

Encapsulates the limit surface for a face of a mesh.

The Surface class encapsulates the limit surface for a face of a mesh for any data interpolation type (vertex, varying and face-varying) and provides the public interface for its evaluation. Surface is a class template parameterized to support evaluation in single or double precision.

Template Parameters
REALFloating point precision (float or double only)

Instances of Surface are created or initialized by a subclass of the SurfaceFactory. Since existing instances can be re-initialized, they should be tested for validity after such re-initialization.

All Surfaces are assigned a Parameterization based on the subdivision scheme and the size of the face, which can then be used for evaluation and tessellation of the surface.

Definition at line 59 of file surface.h.

Member Typedef Documentation

◆ Index

typedef int Index

Integer type representing a mesh index.

Definition at line 72 of file surface.h.

Constructor & Destructor Documentation

◆ Surface() [1/2]

Surface ( )

Default construction produces an invalid instance.

◆ Surface() [2/2]

Surface ( Surface< REAL > const &  src)
default

◆ ~Surface()

~Surface ( )
default

Member Function Documentation

◆ ApplyStencil()

void ApplyStencil ( REAL const  stencil[],
REAL const  controlPoints[],
PointDescriptor const &  ,
REAL  result[] 
) const

Apply a single stencil to control points from a local array.

◆ ApplyStencilFromMesh()

void ApplyStencilFromMesh ( REAL const  stencil[],
REAL const  meshPoints[],
PointDescriptor const &  ,
REAL  result[] 
) const

Apply a single stencil to control points from the mesh data.

◆ BoundControlPoints()

void BoundControlPoints ( REAL const  controlPoints[],
PointDescriptor const &  controlPointDesc,
REAL  minExtent[],
REAL  maxExtent[] 
) const

Compute bounds of control points from a local array.

◆ BoundControlPointsFromMesh()

void BoundControlPointsFromMesh ( REAL const  meshPoints[],
PointDescriptor const &  meshPointDesc,
REAL  minExtent[],
REAL  maxExtent[] 
) const

Compute bounds of control points from the mesh data.

◆ Clear()

void Clear ( )
inline

Clear a previously initialized Surface.

Definition at line 89 of file surface.h.

◆ ComputePatchPoints()

void ComputePatchPoints ( REAL  patchPoints[],
PointDescriptor const &  patchPointDesc 
) const
inline

Compute all patch points following the control points.

For cases where the control points have already been gathered into an array allocated for the patch points, the remaining patch points will be computed.

Parameters
patchPointsArray of patch point data to be modified
patchPointDescThe size and stride of patch point data

Definition at line 331 of file surface.h.

◆ Evaluate() [1/3]

void Evaluate ( REAL const  uv[2],
REAL const  patchPoints[],
PointDescriptor const &  pointDesc,
REAL  P[] 
) const
inline

Evaluation of position.

Definition at line 372 of file surface.h.

◆ Evaluate() [2/3]

void Evaluate ( REAL const  uv[2],
REAL const  patchPoints[],
PointDescriptor const &  pointDesc,
REAL  P[],
REAL  Du[],
REAL  Dv[] 
) const
inline

Overload of evaluation for 1st derivatives.

Definition at line 382 of file surface.h.

◆ Evaluate() [3/3]

void Evaluate ( REAL const  uv[2],
REAL const  patchPoints[],
PointDescriptor const &  pointDesc,
REAL  P[],
REAL  Du[],
REAL  Dv[],
REAL  Duu[],
REAL  Duv[],
REAL  Dvv[] 
) const
inline

Overload of evaluation for 2nd derivatives.

Definition at line 392 of file surface.h.

◆ EvaluateStencil() [1/3]

int EvaluateStencil ( REAL const  uv[2],
REAL  sP[] 
) const
inline

Evaluation of the limit stencil for position.

Definition at line 416 of file surface.h.

◆ EvaluateStencil() [2/3]

int EvaluateStencil ( REAL const  uv[2],
REAL  sP[],
REAL  sDu[],
REAL  sDv[] 
) const
inline

Overload of limit stencil evaluation for 1st derivatives.

Definition at line 423 of file surface.h.

◆ EvaluateStencil() [3/3]

int EvaluateStencil ( REAL const  uv[2],
REAL  sP[],
REAL  sDu[],
REAL  sDv[],
REAL  sDuu[],
REAL  sDuv[],
REAL  sDvv[] 
) const
inline

Overload of limit stencil evaluation for 2nd derivatives.

Definition at line 431 of file surface.h.

◆ GatherControlPoints()

void GatherControlPoints ( REAL_MESH const  meshPoints[],
PointDescriptor const &  meshPointDesc,
REAL  controlPoints[],
PointDescriptor const &  controlPointDesc 
) const

Gather control points in a local array.

Template Parameters
REAL_MESHFloating point precision of mesh points
Parameters
meshPointsInput array of mesh point data
meshPointDescThe size and stride of mesh point data
controlPointsOutput array of control point data
controlPointDescThe size and stride of control point data

◆ GetControlPointIndices()

int GetControlPointIndices ( Index  meshPointIndices[]) const

Identify indices of control points in the mesh.

◆ GetFaceSize()

int GetFaceSize ( ) const
inline

Return the size of the face.

Definition at line 109 of file surface.h.

◆ GetNumControlPoints()

int GetNumControlPoints ( ) const
inline

Return the number of control points affecting the Surface.

Definition at line 137 of file surface.h.

◆ GetNumPatchPoints()

int GetNumPatchPoints ( ) const

Return the number of patch points representing the Surface.

◆ GetParameterization()

Parameterization GetParameterization ( ) const
inline

Return the Parameterization.

Definition at line 106 of file surface.h.

◆ IsLinear()

bool IsLinear ( ) const
inline

Return if the Surface is linear.

Definition at line 115 of file surface.h.

◆ IsRegular()

bool IsRegular ( ) const
inline

Return if the Surface is a single regular patch.

Definition at line 112 of file surface.h.

◆ IsValid()

bool IsValid ( ) const
inline

Return true if successfully initialized.

Definition at line 86 of file surface.h.

◆ operator=()

Surface & operator= ( Surface< REAL > const &  src)
default

◆ PreparePatchPoints()

void PreparePatchPoints ( REAL const  meshPoints[],
PointDescriptor const &  meshPointDesc,
REAL  patchPoints[],
PointDescriptor const &  patchPointDesc 
) const
inline

Prepare patch points in a local array for evaluation.

The patch points consist of the control points plus any additional points derived from them that may be required to represent the limit surface as one or more parametric patches.

Parameters
meshPointsInput array of mesh point data
meshPointDescThe size and stride of mesh point data
patchPointsOutput array of patch point data
patchPointDescThe size and stride of patch point data

Note that this method requires the mesh data be in a contiguous array. If a large data set is fragmented into blocks or pages, this method cannot be used. The control points will need to be gathered explicitly as the subset of patch points, after which the method to compute the remaining patch points can be used.

Definition at line 345 of file surface.h.

Friends And Related Function Documentation

◆ SurfaceFactory

friend class SurfaceFactory
friend

Definition at line 315 of file surface.h.


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