OpenSubdiv
Parameterization Class Reference

Simple class defining the 2D parameterization of a face. More...

#include <parameterization.h>

Public Types

enum  Type {
  QUAD,
  TRI,
  QUAD_SUBFACES
}
 Enumerated type for the different kinds of Parameterizations. More...
 

Public Member Functions

Construction and initialization

Valid construction of a Parameterization is only achieved with the non-default constructor. A Parameterization will be invalid (and so unusable) if default constructed, or constructed using arguments that describe a face that cannot be parameterized.

 Parameterization (Sdc::SchemeType scheme, int faceSize)
 Primary constructor with subdivision scheme and face size. More...
 
bool IsValid () const
 Returns true if correctly initialized. More...
 
 Parameterization ()
 Default construction produces an invalid instance. More...
 
 Parameterization (Parameterization const &)=default
 
Parameterizationoperator= (Parameterization const &)=default
 
 ~Parameterization ()=default
 
Simple queries

Simple queries of a valid Parameterization.

Type GetType () const
 Returns the type of parameterization assigned. More...
 
int GetFaceSize () const
 Returns the size (number of vertices) of the corresponding face. More...
 
Methods to inspect parametric features

Methods are available to inspect common topological features of a Parameterization, i.e. the parametric coordinates corresponding to the vertices, edges or center of the face it represents.

Methods for vertices and edges require an index of the desired vertex or edge. The edge parameter "t" locally parameterizes the edge over [0,1] in a counter-clockwise orientation.

template<typename REAL >
void GetVertexCoord (int vertexIndex, REAL uvCoord[2]) const
 Returns the (u,v) coordinate of a given vertex. More...
 
template<typename REAL >
void GetEdgeCoord (int edgeIndex, REAL t, REAL uvCoord[2]) const
 Returns the (u,v) coordinate at any point on a given edge. More...
 
template<typename REAL >
void GetCenterCoord (REAL uvCoord[2]) const
 Returns the (u,v) coordinate for the center of the face. More...
 
Methods to deal with discontinuous parameterizations

Parameterizations that have been partitioned into sub-faces are discontinuous and warrant care in order to process them effectively – often requiring explicit conversions.

These conversion methods to and from the local coordinates of a sub-face are only for use with instances of Parameterization that have such sub-faces. Results for input coordinates that are significantly outside the domain of the input parameterization are undefined.

Note that sub-face coordinates that are normalized correspond to coordinates for Ptex faces.

bool HasSubFaces () const
 Returns if Parameterization has been partitioned into sub-faces. More...
 
template<typename REAL >
int GetSubFace (REAL const uvCoord[2]) const
 Returns the integer sub-face containing the given (u,v) More...
 
template<typename REAL >
int ConvertCoordToSubFace (REAL const uvCoord[2], REAL subFaceCoord[2]) const
 Convert (u,v) to a sub-face (return value) and its local (u,v) coordinate. More...
 
template<typename REAL >
void ConvertSubFaceToCoord (int subFace, REAL const subFaceCoord[2], REAL uvCoord[2]) const
 Convert a sub-face and its local (u,v) coordinate to (u,v) More...
 
template<typename REAL >
int ConvertCoordToNormalizedSubFace (REAL const uvCoord[2], REAL subFaceCoord[2]) const
 Convert (u,v) to a sub-face (return value) and its normalized (u,v) coordinate. More...
 
template<typename REAL >
void ConvertNormalizedSubFaceToCoord (int subFace, REAL const subFaceCoord[2], REAL uvCoord[2]) const
 Convert a sub-face and its normalized (u,v) coordinate to (u,v) More...
 

Detailed Description

Simple class defining the 2D parameterization of a face.

Parameterization is a simple class that provides information about the parameterization of a face in a local (u,v) coordinate system. It is defined by the size of a face (i.e. its number of vertices) and the subdivision scheme that determines its limit surface.

As an example of how the subdivision scheme is essential in determining the Parameterization, consider the case of a triangle. A triangle is regular for the Loop scheme and so has a very simple parameterization as a triangular patch. But for the Catmull-Clark scheme, a triangle is an irregular face that must first be subdivided – making its limit surface a piecewise collection of quadrilateral patches.

Definition at line 52 of file parameterization.h.

Member Enumeration Documentation

◆ Type

enum Type

Enumerated type for the different kinds of Parameterizations.

The three kinds of parameterizations defined are: quadrilateral, triangle and quadrangulated sub-faces. This is not intended for common use, but is publicly available for situations when it is necessary to distinguish:

Enumerator
QUAD 

Quadrilateral.

TRI 

Triangle.

QUAD_SUBFACES 

Partitioned into quadrilateral sub-faces.

Definition at line 62 of file parameterization.h.

Constructor & Destructor Documentation

◆ Parameterization() [1/3]

Parameterization ( Sdc::SchemeType  scheme,
int  faceSize 
)

Primary constructor with subdivision scheme and face size.

◆ Parameterization() [2/3]

Parameterization ( )
inline

Default construction produces an invalid instance.

Definition at line 84 of file parameterization.h.

◆ Parameterization() [3/3]

Parameterization ( Parameterization const &  )
default

◆ ~Parameterization()

~Parameterization ( )
default

Member Function Documentation

◆ ConvertCoordToNormalizedSubFace()

int ConvertCoordToNormalizedSubFace ( REAL const  uvCoord[2],
REAL  subFaceCoord[2] 
) const
inline

Convert (u,v) to a sub-face (return value) and its normalized (u,v) coordinate.

Definition at line 229 of file parameterization.h.

◆ ConvertCoordToSubFace()

int ConvertCoordToSubFace ( REAL const  uvCoord[2],
REAL  subFaceCoord[2] 
) const
inline

Convert (u,v) to a sub-face (return value) and its local (u,v) coordinate.

Definition at line 215 of file parameterization.h.

◆ ConvertNormalizedSubFaceToCoord()

void ConvertNormalizedSubFaceToCoord ( int  subFace,
REAL const  subFaceCoord[2],
REAL  uvCoord[2] 
) const
inline

Convert a sub-face and its normalized (u,v) coordinate to (u,v)

Definition at line 235 of file parameterization.h.

◆ ConvertSubFaceToCoord()

void ConvertSubFaceToCoord ( int  subFace,
REAL const  subFaceCoord[2],
REAL  uvCoord[2] 
) const
inline

Convert a sub-face and its local (u,v) coordinate to (u,v)

Definition at line 221 of file parameterization.h.

◆ GetCenterCoord()

void GetCenterCoord ( REAL  uvCoord[2]) const

Returns the (u,v) coordinate for the center of the face.

◆ GetEdgeCoord()

void GetEdgeCoord ( int  edgeIndex,
REAL  t,
REAL  uvCoord[2] 
) const

Returns the (u,v) coordinate at any point on a given edge.

◆ GetFaceSize()

int GetFaceSize ( ) const
inline

Returns the size (number of vertices) of the corresponding face.

Definition at line 101 of file parameterization.h.

◆ GetSubFace()

int GetSubFace ( REAL const  uvCoord[2]) const
inline

Returns the integer sub-face containing the given (u,v)

Definition at line 202 of file parameterization.h.

◆ GetType()

Type GetType ( ) const
inline

Returns the type of parameterization assigned.

Definition at line 98 of file parameterization.h.

◆ GetVertexCoord()

void GetVertexCoord ( int  vertexIndex,
REAL  uvCoord[2] 
) const

Returns the (u,v) coordinate of a given vertex.

◆ HasSubFaces()

bool HasSubFaces ( ) const
inline

Returns if Parameterization has been partitioned into sub-faces.

Definition at line 196 of file parameterization.h.

◆ IsValid()

bool IsValid ( ) const
inline

Returns true if correctly initialized.

Definition at line 81 of file parameterization.h.

◆ operator=()

Parameterization& operator= ( Parameterization const &  )
default

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