OpenSubdiv
|
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. | |
bool | IsValid () const |
Returns true if correctly initialized. | |
Parameterization () | |
Default construction produces an invalid instance. | |
Parameterization (Parameterization const &)=default | |
Parameterization & | operator= (Parameterization const &)=default |
~Parameterization ()=default | |
Simple queries | |
Simple queries of a valid Parameterization. | |
Type | GetType () const |
Returns the type of parameterization assigned. | |
int | GetFaceSize () const |
Returns the size (number of vertices) of the corresponding face. | |
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. | |
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. | |
template<typename REAL > | |
void | GetCenterCoord (REAL uvCoord[2]) const |
Returns the (u,v) coordinate for the center of the face. | |
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. | |
template<typename REAL > | |
int | GetSubFace (REAL const uvCoord[2]) const |
Returns the integer sub-face containing the given (u,v) | |
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. | |
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) | |
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. | |
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) | |
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.
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.
Parameterization | ( | Sdc::SchemeType | scheme, |
int | faceSize | ||
) |
Primary constructor with subdivision scheme and face size.
|
inline |
Default construction produces an invalid instance.
Definition at line 84 of file parameterization.h.
|
default |
|
default |
|
inline |
Convert (u,v) to a sub-face (return value) and its normalized (u,v) coordinate.
Definition at line 229 of file parameterization.h.
|
inline |
Convert (u,v) to a sub-face (return value) and its local (u,v) coordinate.
Definition at line 215 of file parameterization.h.
|
inline |
Convert a sub-face and its normalized (u,v) coordinate to (u,v)
Definition at line 235 of file parameterization.h.
|
inline |
Convert a sub-face and its local (u,v) coordinate to (u,v)
Definition at line 221 of file parameterization.h.
void GetCenterCoord | ( | REAL | uvCoord[2] | ) | const |
Returns the (u,v) coordinate for the center of the face.
void GetEdgeCoord | ( | int | edgeIndex, |
REAL | t, | ||
REAL | uvCoord[2] | ||
) | const |
Returns the (u,v) coordinate at any point on a given edge.
|
inline |
Returns the size (number of vertices) of the corresponding face.
Definition at line 101 of file parameterization.h.
|
inline |
Returns the integer sub-face containing the given (u,v)
Definition at line 202 of file parameterization.h.
|
inline |
Returns the type of parameterization assigned.
Definition at line 98 of file parameterization.h.
void GetVertexCoord | ( | int | vertexIndex, |
REAL | uvCoord[2] | ||
) | const |
Returns the (u,v) coordinate of a given vertex.
|
inline |
Returns if Parameterization has been partitioned into sub-faces.
Definition at line 196 of file parameterization.h.
|
inline |
Returns true if correctly initialized.
Definition at line 81 of file parameterization.h.
|
default |