HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_SubDivCurve.h File Reference
#include "GU_API.h"
#include <GA/GA_Handle.h>
#include <GA/GA_Types.h>
#include <GEO/GEO_Face.h>
#include <UT/UT_VectorTypes.h>
#include <UT/UT_Span.h>
#include <UT/UT_Spline.h>
#include "UT/UT_Tuple.h"
#include <stddef.h>
+ Include dependency graph for GU_SubDivCurve.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define __GU_SubDivCurve__
 

Functions

GA_Size GU_API GUcountOpenPolys (const GA_Detail &detail, const GA_PrimitiveGroup *group=nullptr)
 Returns the number of open polygons in the given detail. More...
 
GA_Size GU_API GUsubdivideCurves (GA_Detail &dest, const GA_Detail &src, int segmentsperedge, bool treatasindependent=false, const GA_PrimitiveGroup *srcgroup=nullptr)
 
UT_Tuple< UT_Vector4,
UT_Vector4i > GU_API 
GUcomputeCubicCurveCoeffsAndIndices (float u, exint n, bool closed, const UT_Matrix4 *firstbasis, const UT_Matrix4 *midbasis)
 
UT_Tuple< UT_Vector4,
UT_Vector4i > GU_API 
GUcomputeCubicCurveCoeffsAndIndices (float u, exint n, bool closed)
 
template<typename T >
void GUevaluateCubicCurve (const GEO_Face &face, float u, T &val, const GA_ROHandleT< T > &attrib, const UT_Matrix4 *midbasis=nullptr, const UT_Matrix4 *firstbasis=nullptr, int component=0)
 
template<typename T >
void GUevaluateCubicCurve (const GEO_Face &face, float startu, float endu, exint nus, T *vals, const GA_ROHandleT< T > &attrib, const UT_Matrix4 *midbasis=nullptr, const UT_Matrix4 *firstbasis=nullptr, int component=-1)
 
template<typename T >
void GUevaluateCubicCurve (const GEO_Face &face, const UT_Span< const float > &uvals, T *vals, const GA_ROHandleT< T > &attrib, const UT_Matrix4 *midbasis=nullptr, const UT_Matrix4 *firstbasis=nullptr, int component=-1)
 
template<typename T >
void GUinterpolateCurveAsSubD (const GEO_Face &face, const GA_RWHandleT< T > &attrib, int component=-1)
 
template<typename ARRAY , typename T >
void GUinterpolateCurveAsSubD (const ARRAY &offsets, GA_AttributeOwner offsetowner, const GA_RWHandleT< T > &attrib, int component=-1, bool closed=false)
 

Macro Definition Documentation

#define __GU_SubDivCurve__

Definition at line 15 of file GU_SubDivCurve.h.

Function Documentation

UT_Tuple<UT_Vector4, UT_Vector4i> GU_API GUcomputeCubicCurveCoeffsAndIndices ( float  u,
exint  n,
bool  closed,
const UT_Matrix4 firstbasis,
const UT_Matrix4 midbasis 
)

This computes point indices and coefficients at u for a curve with n vertices. This allows one to evaluate subdivision curve values outside of the GEO framework. This function is used by GUevaluateCubicCurve, so matches its behavior. This doesn't handle the n==0 case though. Any unused/invalid indices are set to -1. Evaluate the subdivision curve by adding the products of all coefficients & values at index where index >=0.

UT_Tuple<UT_Vector4, UT_Vector4i> GU_API GUcomputeCubicCurveCoeffsAndIndices ( float  u,
exint  n,
bool  closed 
)
GA_Size GU_API GUcountOpenPolys ( const GA_Detail detail,
const GA_PrimitiveGroup group = nullptr 
)

Returns the number of open polygons in the given detail.

template<typename T >
void GUevaluateCubicCurve ( const GEO_Face face,
float  u,
T &  val,
const GA_ROHandleT< T > &  attrib,
const UT_Matrix4 midbasis = nullptr,
const UT_Matrix4 firstbasis = nullptr,
int  component = 0 
)

Evaluates this curve (or face boundary if closed) as the specified cubic spline at u (in [0,1]).

If midbasis and startbasis are not specified, the bases for subdivision curves will be used. Column 0 of midbasis is the unit coefficients for p[-1],p[0],p[1],p[2]. Column 1 is the t coefficients; column 2 is the t^2 coefficients, and column 3 is the t^3 coefficients. firstbasis is only used if the face is open and has rows in the order p[0],p[1],p[2],p[3] for the first edge, and is used in reverse for the last edge.

attrib can have any owner, including primitive and detail, in which case the value is constant. Otherwise, if this face has no vertices, the output will be zeroed. If it has one vertex, the value will be copied. If it has two vertices, the values will be lerped. If it has 3 vertices and firstbasis has a non-zero row 3, the quadratic interpolating basis will be used (this may change).

This is instantiated for fpreal16, fpreal32, fpreal64, and the corresponding UT_Vector2T, UT_Vector3T, UT_Vector4T, UT_Matrix2T, UT_Matrix3T, and UT_Matrix4T types.

If T is a scalar type and component=-1, all components of the attribute will be evaluated into vals, instead of just one, so make sure it's large enough. In the version that takes a T&val, only the specified component is evaluated into val.

template<typename T >
void GUevaluateCubicCurve ( const GEO_Face face,
float  startu,
float  endu,
exint  nus,
T *  vals,
const GA_ROHandleT< T > &  attrib,
const UT_Matrix4 midbasis = nullptr,
const UT_Matrix4 firstbasis = nullptr,
int  component = -1 
)

Evaluates this curve (or face boundary if closed) as the specified cubic spline at u (in [0,1]).

If midbasis and startbasis are not specified, the bases for subdivision curves will be used. Column 0 of midbasis is the unit coefficients for p[-1],p[0],p[1],p[2]. Column 1 is the t coefficients; column 2 is the t^2 coefficients, and column 3 is the t^3 coefficients. firstbasis is only used if the face is open and has rows in the order p[0],p[1],p[2],p[3] for the first edge, and is used in reverse for the last edge.

attrib can have any owner, including primitive and detail, in which case the value is constant. Otherwise, if this face has no vertices, the output will be zeroed. If it has one vertex, the value will be copied. If it has two vertices, the values will be lerped. If it has 3 vertices and firstbasis has a non-zero row 3, the quadratic interpolating basis will be used (this may change).

This is instantiated for fpreal16, fpreal32, fpreal64, and the corresponding UT_Vector2T, UT_Vector3T, UT_Vector4T, UT_Matrix2T, UT_Matrix3T, and UT_Matrix4T types.

If T is a scalar type and component=-1, all components of the attribute will be evaluated into vals, instead of just one, so make sure it's large enough. In the version that takes a T&val, only the specified component is evaluated into val.

template<typename T >
void GUevaluateCubicCurve ( const GEO_Face face,
const UT_Span< const float > &  uvals,
T *  vals,
const GA_ROHandleT< T > &  attrib,
const UT_Matrix4 midbasis = nullptr,
const UT_Matrix4 firstbasis = nullptr,
int  component = -1 
)

Evaluates this curve (or face boundary if closed) as the specified cubic spline at u (in [0,1]).

If midbasis and startbasis are not specified, the bases for subdivision curves will be used. Column 0 of midbasis is the unit coefficients for p[-1],p[0],p[1],p[2]. Column 1 is the t coefficients; column 2 is the t^2 coefficients, and column 3 is the t^3 coefficients. firstbasis is only used if the face is open and has rows in the order p[0],p[1],p[2],p[3] for the first edge, and is used in reverse for the last edge.

attrib can have any owner, including primitive and detail, in which case the value is constant. Otherwise, if this face has no vertices, the output will be zeroed. If it has one vertex, the value will be copied. If it has two vertices, the values will be lerped. If it has 3 vertices and firstbasis has a non-zero row 3, the quadratic interpolating basis will be used (this may change).

This is instantiated for fpreal16, fpreal32, fpreal64, and the corresponding UT_Vector2T, UT_Vector3T, UT_Vector4T, UT_Matrix2T, UT_Matrix3T, and UT_Matrix4T types.

If T is a scalar type and component=-1, all components of the attribute will be evaluated into vals, instead of just one, so make sure it's large enough. In the version that takes a T&val, only the specified component is evaluated into val.

template<typename T >
void GUinterpolateCurveAsSubD ( const GEO_Face face,
const GA_RWHandleT< T > &  attrib,
int  component = -1 
)

This moves the values of the given attribute such that if this polygon were subdivided as a subdivision curve, the limit curve would interpolate the starting values. In a sense, this "undoes" the subdivision so that it can be done later to produce the same result.

If T is a scalar type and component=-1, all components of the attribute will be evaluated into vals, instead of just one, so make sure it's large enough. ARRAY is specialized for GA_OffsetList, UT_Array<GA_Offset>, UT_Span<const GA_Offset>

template<typename ARRAY , typename T >
void GUinterpolateCurveAsSubD ( const ARRAY &  offsets,
GA_AttributeOwner  offsetowner,
const GA_RWHandleT< T > &  attrib,
int  component = -1,
bool  closed = false 
)

This moves the values of the given attribute such that if this polygon were subdivided as a subdivision curve, the limit curve would interpolate the starting values. In a sense, this "undoes" the subdivision so that it can be done later to produce the same result.

If T is a scalar type and component=-1, all components of the attribute will be evaluated into vals, instead of just one, so make sure it's large enough. ARRAY is specialized for GA_OffsetList, UT_Array<GA_Offset>, UT_Span<const GA_Offset>

GA_Size GU_API GUsubdivideCurves ( GA_Detail dest,
const GA_Detail src,
int  segmentsperedge,
bool  treatasindependent = false,
const GA_PrimitiveGroup srcgroup = nullptr 
)

Creates new polygon curves in dest from any curves in src (srcgroup if specified), that are subdivided levels times. If dest==src and treatasindependent is false, it will reuse any points that are used by primitives that are not being subdivided, to maintain equivalent connectivity. Curves with zero vertices or one vertex will be left untouched. Other points, vertices, and primitives will usually be new. Returns the number of polygon curves that were generated in dest. NOTE: The number of vertices generated is exponential in levels, not linear!