HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdGeomBasisCurves Class Reference

#include <basisCurves.h>

+ Inheritance diagram for UsdGeomBasisCurves:

Public Member Functions

 UsdGeomBasisCurves (const UsdPrim &prim=UsdPrim())
 
 UsdGeomBasisCurves (const UsdSchemaBase &schemaObj)
 
virtual USDGEOM_API ~UsdGeomBasisCurves ()
 Destructor. More...
 
USDGEOM_API UsdAttribute GetTypeAttr () const
 
USDGEOM_API UsdAttribute CreateTypeAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetBasisAttr () const
 
USDGEOM_API UsdAttribute CreateBasisAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetWrapAttr () const
 
USDGEOM_API UsdAttribute CreateWrapAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
- Public Member Functions inherited from UsdGeomCurves
 UsdGeomCurves (const UsdPrim &prim=UsdPrim())
 
 UsdGeomCurves (const UsdSchemaBase &schemaObj)
 
virtual USDGEOM_API ~UsdGeomCurves ()
 Destructor. More...
 
USDGEOM_API UsdAttribute GetCurveVertexCountsAttr () const
 
USDGEOM_API UsdAttribute CreateCurveVertexCountsAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetWidthsAttr () const
 
USDGEOM_API UsdAttribute CreateWidthsAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API TfToken GetWidthsInterpolation () const
 
USDGEOM_API bool SetWidthsInterpolation (TfToken const &interpolation)
 
- Public Member Functions inherited from UsdGeomPointBased
 UsdGeomPointBased (const UsdPrim &prim=UsdPrim())
 
 UsdGeomPointBased (const UsdSchemaBase &schemaObj)
 
virtual USDGEOM_API ~UsdGeomPointBased ()
 Destructor. More...
 
USDGEOM_API UsdAttribute GetPointsAttr () const
 
USDGEOM_API UsdAttribute CreatePointsAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetVelocitiesAttr () const
 
USDGEOM_API UsdAttribute CreateVelocitiesAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetAccelerationsAttr () const
 
USDGEOM_API UsdAttribute CreateAccelerationsAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetNormalsAttr () const
 
USDGEOM_API UsdAttribute CreateNormalsAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API TfToken GetNormalsInterpolation () const
 
USDGEOM_API bool SetNormalsInterpolation (TfToken const &interpolation)
 
USDGEOM_API bool ComputePointsAtTime (VtArray< GfVec3f > *points, const UsdTimeCode time, const UsdTimeCode baseTime) const
 
USDGEOM_API bool ComputePointsAtTimes (std::vector< VtArray< GfVec3f >> *pointsArray, const std::vector< UsdTimeCode > &times, const UsdTimeCode baseTime) const
 
- Public Member Functions inherited from UsdGeomGprim
 UsdGeomGprim (const UsdPrim &prim=UsdPrim())
 
 UsdGeomGprim (const UsdSchemaBase &schemaObj)
 
virtual USDGEOM_API ~UsdGeomGprim ()
 Destructor. More...
 
USDGEOM_API UsdAttribute GetDisplayColorAttr () const
 
USDGEOM_API UsdAttribute CreateDisplayColorAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetDisplayOpacityAttr () const
 
USDGEOM_API UsdAttribute CreateDisplayOpacityAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetDoubleSidedAttr () const
 
USDGEOM_API UsdAttribute CreateDoubleSidedAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetOrientationAttr () const
 
USDGEOM_API UsdAttribute CreateOrientationAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdGeomPrimvar GetDisplayColorPrimvar () const
 
USDGEOM_API UsdGeomPrimvar CreateDisplayColorPrimvar (const TfToken &interpolation=TfToken(), int elementSize=-1) const
 
USDGEOM_API UsdGeomPrimvar GetDisplayOpacityPrimvar () const
 
USDGEOM_API UsdGeomPrimvar CreateDisplayOpacityPrimvar (const TfToken &interpolation=TfToken(), int elementSize=-1) const
 
- Public Member Functions inherited from UsdGeomBoundable
 UsdGeomBoundable (const UsdPrim &prim=UsdPrim())
 
 UsdGeomBoundable (const UsdSchemaBase &schemaObj)
 
virtual USDGEOM_API ~UsdGeomBoundable ()
 Destructor. More...
 
USDGEOM_API UsdAttribute GetExtentAttr () const
 
USDGEOM_API UsdAttribute CreateExtentAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
- Public Member Functions inherited from UsdGeomXformable
 UsdGeomXformable (const UsdPrim &prim=UsdPrim())
 
 UsdGeomXformable (const UsdSchemaBase &schemaObj)
 
virtual USDGEOM_API ~UsdGeomXformable ()
 Destructor. More...
 
USDGEOM_API UsdAttribute GetXformOpOrderAttr () const
 
USDGEOM_API UsdAttribute CreateXformOpOrderAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdGeomXformOp AddXformOp (UsdGeomXformOp::Type const opType, UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionDouble, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddTranslateOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionDouble, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddScaleOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateXOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateYOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateZOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateXYZOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateXZYOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateYXZOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateYZXOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateZXYOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddRotateZYXOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddOrientOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API UsdGeomXformOp AddTransformOp (UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionDouble, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
 
USDGEOM_API bool SetResetXformStack (bool resetXform) const
 
USDGEOM_API bool GetResetXformStack () const
 
USDGEOM_API bool SetXformOpOrder (std::vector< UsdGeomXformOp > const &orderedXformOps, bool resetXformStack=false) const
 
USDGEOM_API std::vector
< UsdGeomXformOp
GetOrderedXformOps (bool *resetsXformStack) const
 
USDGEOM_API bool ClearXformOpOrder () const
 Clears the local transform stack. More...
 
USDGEOM_API UsdGeomXformOp MakeMatrixXform () const
 
USDGEOM_API bool TransformMightBeTimeVarying () const
 
USDGEOM_API bool TransformMightBeTimeVarying (const std::vector< UsdGeomXformOp > &ops) const
 
USDGEOM_API bool GetTimeSamples (std::vector< double > *times) const
 
USDGEOM_API bool GetTimeSamplesInInterval (const GfInterval &interval, std::vector< double > *times) const
 
USDGEOM_API bool GetLocalTransformation (GfMatrix4d *transform, bool *resetsXformStack, const UsdTimeCode time=UsdTimeCode::Default()) const
 
USDGEOM_API bool GetLocalTransformation (GfMatrix4d *transform, bool *resetsXformStack, const std::vector< UsdGeomXformOp > &ops, const UsdTimeCode time=UsdTimeCode::Default()) const
 
- Public Member Functions inherited from UsdGeomImageable
 UsdGeomImageable (const UsdPrim &prim=UsdPrim())
 
 UsdGeomImageable (const UsdSchemaBase &schemaObj)
 
virtual USDGEOM_API ~UsdGeomImageable ()
 Destructor. More...
 
USDGEOM_API UsdAttribute GetVisibilityAttr () const
 
USDGEOM_API UsdAttribute CreateVisibilityAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdAttribute GetPurposeAttr () const
 
USDGEOM_API UsdAttribute CreatePurposeAttr (VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
 
USDGEOM_API UsdRelationship GetProxyPrimRel () const
 
USDGEOM_API UsdRelationship CreateProxyPrimRel () const
 
USDGEOM_API void MakeVisible (const UsdTimeCode &time=UsdTimeCode::Default()) const
 
USDGEOM_API void MakeInvisible (const UsdTimeCode &time=UsdTimeCode::Default()) const
 
USDGEOM_API TfToken ComputeVisibility (UsdTimeCode const &time=UsdTimeCode::Default()) const
 
USDGEOM_API TfToken ComputeVisibility (const TfToken &parentVisibility, UsdTimeCode const &time=UsdTimeCode::Default()) const
 
USDGEOM_API PurposeInfo ComputePurposeInfo () const
 
USDGEOM_API PurposeInfo ComputePurposeInfo (const PurposeInfo &parentPurposeInfo) const
 
USDGEOM_API TfToken ComputePurpose () const
 
USDGEOM_API UsdPrim ComputeProxyPrim (UsdPrim *renderPrim=NULL) const
 
USDGEOM_API bool SetProxyPrim (const UsdPrim &proxy) const
 
USDGEOM_API bool SetProxyPrim (const UsdSchemaBase &proxy) const
 
USDGEOM_API GfBBox3d ComputeWorldBound (UsdTimeCode const &time, TfToken const &purpose1=TfToken(), TfToken const &purpose2=TfToken(), TfToken const &purpose3=TfToken(), TfToken const &purpose4=TfToken()) const
 
USDGEOM_API GfBBox3d ComputeLocalBound (UsdTimeCode const &time, TfToken const &purpose1=TfToken(), TfToken const &purpose2=TfToken(), TfToken const &purpose3=TfToken(), TfToken const &purpose4=TfToken()) const
 
USDGEOM_API GfBBox3d ComputeUntransformedBound (UsdTimeCode const &time, TfToken const &purpose1=TfToken(), TfToken const &purpose2=TfToken(), TfToken const &purpose3=TfToken(), TfToken const &purpose4=TfToken()) const
 
USDGEOM_API GfMatrix4d ComputeLocalToWorldTransform (UsdTimeCode const &time) const
 
USDGEOM_API GfMatrix4d ComputeParentToWorldTransform (UsdTimeCode const &time) const
 
USDGEOM_API UsdGeomPrimvar CreatePrimvar (const TfToken &attrName, const SdfValueTypeName &typeName, const TfToken &interpolation=TfToken(), int elementSize=-1) const
 
USDGEOM_API UsdGeomPrimvar GetPrimvar (const TfToken &name) const
 
USDGEOM_API std::vector
< UsdGeomPrimvar
GetPrimvars () const
 
USDGEOM_API std::vector
< UsdGeomPrimvar
GetAuthoredPrimvars () const
 
USDGEOM_API bool HasPrimvar (const TfToken &name) const
 
- Public Member Functions inherited from UsdTyped
 UsdTyped (const UsdPrim &prim=UsdPrim())
 
 UsdTyped (const UsdSchemaBase &schemaObj)
 
virtual USD_API ~UsdTyped ()
 
- Public Member Functions inherited from UsdSchemaBase
bool IsConcrete () const
 
bool IsTyped () const
 
bool IsAPISchema () const
 Returns whether this is an API schema or not. More...
 
bool IsAppliedAPISchema () const
 
bool IsMultipleApplyAPISchema () const
 
UsdSchemaType GetSchemaType () const
 
USD_API UsdSchemaBase (const UsdPrim &prim=UsdPrim())
 Construct and store prim as the held prim. More...
 
USD_API UsdSchemaBase (const UsdSchemaBase &otherSchema)
 Construct and store for the same prim held by otherSchema. More...
 
virtual USD_API ~UsdSchemaBase ()
 Destructor. More...
 
USD_API operator bool () const
 
UsdPrim GetPrim () const
 Return this schema object's held prim. More...
 
SdfPath GetPath () const
 Shorthand for GetPrim()->GetPath(). More...
 
USD_API const UsdPrimDefinitionGetSchemaClassPrimDefinition () const
 

Static Public Member Functions

static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USDGEOM_API
UsdGeomBasisCurves 
Get (const UsdStagePtr &stage, const SdfPath &path)
 
static USDGEOM_API
UsdGeomBasisCurves 
Define (const UsdStagePtr &stage, const SdfPath &path)
 
- Static Public Member Functions inherited from UsdGeomCurves
static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USDGEOM_API UsdGeomCurves Get (const UsdStagePtr &stage, const SdfPath &path)
 
static USDGEOM_API bool ComputeExtent (const VtVec3fArray &points, const VtFloatArray &widths, VtVec3fArray *extent)
 
static USDGEOM_API bool ComputeExtent (const VtVec3fArray &points, const VtFloatArray &widths, const GfMatrix4d &transform, VtVec3fArray *extent)
 
- Static Public Member Functions inherited from UsdGeomPointBased
static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USDGEOM_API
UsdGeomPointBased 
Get (const UsdStagePtr &stage, const SdfPath &path)
 
static USDGEOM_API bool ComputeExtent (const VtVec3fArray &points, VtVec3fArray *extent)
 
static USDGEOM_API bool ComputeExtent (const VtVec3fArray &points, const GfMatrix4d &transform, VtVec3fArray *extent)
 
static USDGEOM_API bool ComputePointsAtTime (VtArray< GfVec3f > *points, UsdStageWeakPtr &stage, UsdTimeCode time, const VtVec3fArray &positions, const VtVec3fArray &velocities, UsdTimeCode velocitiesSampleTime, const VtVec3fArray &accelerations, float velocityScale)
 
- Static Public Member Functions inherited from UsdGeomGprim
static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USDGEOM_API UsdGeomGprim Get (const UsdStagePtr &stage, const SdfPath &path)
 
- Static Public Member Functions inherited from UsdGeomBoundable
static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USDGEOM_API UsdGeomBoundable Get (const UsdStagePtr &stage, const SdfPath &path)
 
static USDGEOM_API bool ComputeExtentFromPlugins (const UsdGeomBoundable &boundable, const UsdTimeCode &time, VtVec3fArray *extent)
 
static USDGEOM_API bool ComputeExtentFromPlugins (const UsdGeomBoundable &boundable, const UsdTimeCode &time, const GfMatrix4d &transform, VtVec3fArray *extent)
 
- Static Public Member Functions inherited from UsdGeomXformable
static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USDGEOM_API UsdGeomXformable Get (const UsdStagePtr &stage, const SdfPath &path)
 
static USDGEOM_API bool GetTimeSamples (std::vector< UsdGeomXformOp > const &orderedXformOps, std::vector< double > *times)
 
static USDGEOM_API bool GetTimeSamplesInInterval (std::vector< UsdGeomXformOp > const &orderedXformOps, const GfInterval &interval, std::vector< double > *times)
 
static USDGEOM_API bool GetLocalTransformation (GfMatrix4d *transform, std::vector< UsdGeomXformOp > const &ops, const UsdTimeCode time)
 
static USDGEOM_API bool IsTransformationAffectedByAttrNamed (const TfToken &attrName)
 
- Static Public Member Functions inherited from UsdGeomImageable
static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 
static USDGEOM_API UsdGeomImageable Get (const UsdStagePtr &stage, const SdfPath &path)
 
static USDGEOM_API const
TfTokenVector
GetOrderedPurposeTokens ()
 
- Static Public Member Functions inherited from UsdTyped
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 
static USD_API UsdTyped Get (const UsdStagePtr &stage, const SdfPath &path)
 
- Static Public Member Functions inherited from UsdSchemaBase
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 

Static Public Attributes

static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped
 
- Static Public Attributes inherited from UsdGeomCurves
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped
 
- Static Public Attributes inherited from UsdGeomPointBased
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped
 
- Static Public Attributes inherited from UsdGeomGprim
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped
 
- Static Public Attributes inherited from UsdGeomBoundable
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped
 
- Static Public Attributes inherited from UsdGeomXformable
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped
 
- Static Public Attributes inherited from UsdGeomImageable
static const UsdSchemaType schemaType = UsdSchemaType::AbstractTyped
 
- Static Public Attributes inherited from UsdTyped
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 
- Static Public Attributes inherited from UsdSchemaBase
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 

Protected Member Functions

USDGEOM_API UsdSchemaType _GetSchemaType () const override
 
- Protected Member Functions inherited from UsdGeomCurves
USDGEOM_API UsdSchemaType _GetSchemaType () const override
 
- Protected Member Functions inherited from UsdGeomPointBased
USDGEOM_API UsdSchemaType _GetSchemaType () const override
 
- Protected Member Functions inherited from UsdGeomXformable
USDGEOM_API UsdSchemaType _GetSchemaType () const override
 
- Protected Member Functions inherited from UsdTyped
USD_API bool _IsCompatible () const override
 
- Protected Member Functions inherited from UsdSchemaBase
const TfType_GetType () const
 
USD_API UsdAttribute _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const
 

Friends

class UsdSchemaRegistry
 

Helper functions for working with UsdGeomCurves

typedef std::vector< std::pair
< TfToken, size_t > > 
ComputeInterpolationInfo
 
USDGEOM_API TfToken ComputeInterpolationForSize (size_t n, const UsdTimeCode &timeCode, ComputeInterpolationInfo *info=NULL) const
 
USDGEOM_API size_t ComputeUniformDataSize (const UsdTimeCode &timeCode) const
 
USDGEOM_API size_t ComputeVaryingDataSize (const UsdTimeCode &timeCode) const
 
USDGEOM_API size_t ComputeVertexDataSize (const UsdTimeCode &timeCode) const
 

Detailed Description

BasisCurves are a batched curve representation analogous to the classic RIB definition via Basis and Curves statements. BasisCurves are often used to render dense aggregate geometry like hair or grass.

A 'matrix' and 'vstep' associated with the basis are used to interpolate the vertices of a cubic BasisCurves. (The basis attribute is unused for linear BasisCurves.)

A single prim may have many curves whose count is determined implicitly by the length of the curveVertexCounts vector. Each individual curve is composed of one or more segments. Each segment is defined by four vertices for cubic curves and two vertices for linear curves. See the next section for more information on how to map curve vertex counts to segment counts.

Segment Indexing

Interpolating a curve requires knowing how to decompose it into its individual segments.

The segments of a cubic curve are determined by the vertex count, the wrap (periodicity), and the vstep of the basis. For linear curves, the basis token is ignored and only the vertex count and wrap are needed.

cubic basis vstep
bezier 3
catmullRom 1
bspline 1

The first segment of a cubic (nonperiodic) curve is always defined by its first four points. The vstep is the increment used to determine what vertex indices define the next segment. For a two segment (nonperiodic) bspline basis curve (vstep = 1), the first segment will be defined by interpolating vertices [0, 1, 2, 3] and the second segment will be defined by [1, 2, 3, 4]. For a two segment bezier basis curve (vstep = 3), the first segment will be defined by interpolating vertices [0, 1, 2, 3] and the second segment will be defined by [3, 4, 5, 6]. If the vstep is not one, then you must take special care to make sure that the number of cvs properly divides by your vstep. (The indices described are relative to the initial vertex index for a batched curve.)

For periodic curves, at least one of the curve's initial vertices are repeated to close the curve. For cubic curves, the number of vertices repeated is '4 - vstep'. For linear curves, only one vertex is repeated to close the loop.

Pinned curves are a special case of nonperiodic curves that only affects the behavior of cubic Bspline and Catmull-Rom curves. To evaluate or render pinned curves, a client must effectively add 'phantom points' at the beginning and end of every curve in a batch. These phantom points are injected to ensure that the inteprolated curve begins at P[0] and ends at P[n-1].

For a curve with initial point P[0] and last point P[n-1], the phantom points are defined as. P[-1] = 2 * P[0] - P[1] P[n] = 2 * P[n-1] - P[n-2]

Pinned cubic curves will (usually) have to be unpacked into the standard nonperiodic representation before rendering. This unpacking can add some additional overhead. However, using pinned curves reduces the amount of data recorded in a scene and (more importantly) better records the authors' intent for interchange.

Note
The additional phantom points mean that the minimum curve vertex count for cubic bspline and catmullRom curves is 2.

Linear curve segments are defined by two vertices. A two segment linear curve's first segment would be defined by interpolating vertices [0, 1]. The second segment would be defined by vertices [1, 2]. (Again, for a batched curve, indices are relative to the initial vertex index.)

When validating curve topology, each renderable entry in the curveVertexCounts vector must pass this check.

type wrap validitity
linear nonperiodic curveVertexCounts[i] > 2
linear periodic curveVertexCounts[i] > 3
cubic nonperiodic (curveVertexCounts[i] - 4) % vstep == 0
cubic periodic (curveVertexCounts[i]) % vstep == 0
cubic pinned (catmullRom/bspline) (curveVertexCounts[i] - 2) >= 0

Cubic Vertex Interpolation

USDCurveBasisMatrix.png
width=750

Linear Vertex Interpolation

Linear interpolation is always used on curves of type linear. 't' with domain [0, 1], the curve is defined by the equation P0 * (1-t) + P1 * t. t at 0 describes the first point and t at 1 describes the end point.

Primvar Interpolation

For cubic curves, primvar data can be either interpolated cubically between vertices or linearly across segments. The corresponding token for cubic interpolation is 'vertex' and for linear interpolation is 'varying'. Per vertex data should be the same size as the number of vertices in your curve. Segment varying data is dependent on the wrap (periodicity) and number of segments in your curve. For linear curves, varying and vertex data would be interpolated the same way. By convention varying is the preferred interpolation because of the association of varying with linear interpolation.

USDCurvePrimvars.png

To convert an entry in the curveVertexCounts vector into a segment count for an individual curve, apply these rules. Sum up all the results in order to compute how many total segments all curves have.

The following tables describe the expected segment count for the 'i'th curve in a curve batch as well as the entire batch. Python syntax like '[:]' (to describe all members of an array) and 'len(...)' (to describe the length of an array) are used.

type wrap curve segment count batch segment count
linear nonperiodic curveVertexCounts[i] - 1 sum(curveVertexCounts[:]) - len(curveVertexCounts)
linear periodic curveVertexCounts[i] sum(curveVertexCounts[:])
cubic nonperiodic (curveVertexCounts[i] - 4) / vstep + 1 sum(curveVertexCounts[:] - 4) / vstep + len(curveVertexCounts)
cubic periodic curveVertexCounts[i] / vstep sum(curveVertexCounts[:]) / vstep
cubic pinned (catmullRom/bspline) (curveVertexCounts[i] - 2) + 1 sum(curveVertexCounts[:] - 2) + len(curveVertexCounts)

The following table descrives the expected size of varying (linearly interpolated) data, derived from the segment counts computed above.

wrap curve varying count batch varying count
nonperiodic/pinned segmentCounts[i] + 1 sum(segmentCounts[:]) + len(curveVertexCounts)
periodic segmentCounts[i] sum(segmentCounts[:])

Both curve types additionally define 'constant' interpolation for the entire prim and 'uniform' interpolation as per curve data.

Note
Take care when providing support for linearly interpolated data for cubic curves. Its shape doesn't provide a one to one mapping with either the number of curves (like 'uniform') or the number of vertices (like 'vertex') and so it is often overlooked. This is the only primitive in UsdGeom (as of this writing) where this is true. For meshes, while they use different interpolation methods, 'varying' and 'vertex' are both specified per point. It's common to assume that curves follow a similar pattern and build in structures and language for per primitive, per element, and per point data only to come upon these arrays that don't quite fit into either of those categories. It is also common to conflate 'varying' with being per segment data and use the segmentCount rules table instead of its neighboring varying data table rules. We suspect that this is because for the common case of nonperiodic cubic curves, both the provided segment count and varying data size formula end with '+ 1'. While debugging, users may look at the double '+ 1' as a mistake and try to remove it. We take this time to enumerate these issues because we've fallen into them before and hope that we save others time in their own implementations.

As an example of deriving per curve segment and varying primvar data counts from the wrap, type, basis, and curveVertexCount, the following table is provided.

wrap type basis curveVertexCount curveSegmentCount varyingDataCount
nonperiodic linear N/A [2 3 2 5] [1 2 1 4] [2 3 2 5]
nonperiodic cubic bezier [4 7 10 4 7] [1 2 3 1 2] [2 3 4 2 3]
nonperiodic cubic bspline [5 4 6 7] [2 1 3 4] [3 2 4 5]
periodic cubic bezier [6 9 6] [2 3 2] [2 3 2]
periodic linear N/A [3 7] [3 7] [3 7]

Tubes and Ribbons

The strictest definition of a curve as an infinitely thin wire is not particularly useful for describing production scenes. The additional widths and normals attributes can be used to describe cylindrical tubes and or flat oriented ribbons.

Curves with only widths defined are imaged as tubes with radius 'width / 2'. Curves with both widths and normals are imaged as ribbons oriented in the direction of the interpolated normal vectors.

While not technically UsdGeomPrimvars, widths and normals also have interpolation metadata. It's common for authored widths to have constant, varying, or vertex interpolation (see UsdGeomCurves::GetWidthsInterpolation()). It's common for authored normals to have varying interpolation (see UsdGeomPointBased::GetNormalsInterpolation()).

USDCurveHydra.png

The file used to generate these curves can be found in pxr/extras/examples/usdGeomExamples/basisCurves.usda. It's provided as a reference on how to properly image both tubes and ribbons. The first row of curves are linear; the second are cubic bezier. (We aim in future releases of HdSt to fix the discontinuity seen with broken tangents to better match offline renderers like RenderMan.) The yellow and violet cubic curves represent cubic vertex width interpolation for which there is no equivalent for linear curves.

Note
How did this prim type get its name? This prim is a portmanteau of two different statements in the original RenderMan specification: 'Basis' and 'Curves'.

For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value.

Definition at line 263 of file basisCurves.h.

Member Typedef Documentation

typedef std::vector< std::pair<TfToken, size_t> > UsdGeomBasisCurves::ComputeInterpolationInfo

Computes interpolation token for n.

If this returns an empty token and info was non-NULL, it'll contain the expected value for each token.

The topology is determined using timeCode.

Definition at line 452 of file basisCurves.h.

Constructor & Destructor Documentation

UsdGeomBasisCurves::UsdGeomBasisCurves ( const UsdPrim prim = UsdPrim())
inlineexplicit

Construct a UsdGeomBasisCurves on UsdPrim prim . Equivalent to UsdGeomBasisCurves::Get(prim.GetStage(), prim.GetPath()) for a valid prim, but will not immediately throw an error for an invalid prim

Definition at line 275 of file basisCurves.h.

UsdGeomBasisCurves::UsdGeomBasisCurves ( const UsdSchemaBase schemaObj)
inlineexplicit

Construct a UsdGeomBasisCurves on the prim held by schemaObj . Should be preferred over UsdGeomBasisCurves(schemaObj.GetPrim()), as it preserves SchemaBase state.

Definition at line 283 of file basisCurves.h.

virtual USDGEOM_API UsdGeomBasisCurves::~UsdGeomBasisCurves ( )
virtual

Destructor.

Member Function Documentation

USDGEOM_API UsdSchemaType UsdGeomBasisCurves::_GetSchemaType ( ) const
overrideprotectedvirtual

Returns the type of schema this class belongs to.

See Also
UsdSchemaType

Reimplemented from UsdSchemaBase.

USDGEOM_API TfToken UsdGeomBasisCurves::ComputeInterpolationForSize ( size_t  n,
const UsdTimeCode timeCode,
ComputeInterpolationInfo info = NULL 
) const

Computes interpolation token for n.

If this returns an empty token and info was non-NULL, it'll contain the expected value for each token.

The topology is determined using timeCode.

USDGEOM_API size_t UsdGeomBasisCurves::ComputeUniformDataSize ( const UsdTimeCode timeCode) const

Computes the expected size for data with "uniform" interpolation.

If you're trying to determine what interpolation to use, it is more efficient to use ComputeInterpolationForSize

USDGEOM_API size_t UsdGeomBasisCurves::ComputeVaryingDataSize ( const UsdTimeCode timeCode) const

Computes the expected size for data with "varying" interpolation.

If you're trying to determine what interpolation to use, it is more efficient to use ComputeInterpolationForSize

USDGEOM_API size_t UsdGeomBasisCurves::ComputeVertexDataSize ( const UsdTimeCode timeCode) const

Computes the expected size for data with "vertex" interpolation.

If you're trying to determine what interpolation to use, it is more efficient to use ComputeInterpolationForSize

USDGEOM_API UsdAttribute UsdGeomBasisCurves::CreateBasisAttr ( VtValue const defaultValue = VtValue(),
bool  writeSparsely = false 
) const

See GetBasisAttr(), and also Usd_Create_Or_Get_Property for when to use Get vs Create. If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

USDGEOM_API UsdAttribute UsdGeomBasisCurves::CreateTypeAttr ( VtValue const defaultValue = VtValue(),
bool  writeSparsely = false 
) const

See GetTypeAttr(), and also Usd_Create_Or_Get_Property for when to use Get vs Create. If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

USDGEOM_API UsdAttribute UsdGeomBasisCurves::CreateWrapAttr ( VtValue const defaultValue = VtValue(),
bool  writeSparsely = false 
) const

See GetWrapAttr(), and also Usd_Create_Or_Get_Property for when to use Get vs Create. If specified, author defaultValue as the attribute's default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

static USDGEOM_API UsdGeomBasisCurves UsdGeomBasisCurves::Define ( const UsdStagePtr &  stage,
const SdfPath path 
)
static

Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined()) on this stage.

If a prim adhering to this schema at path is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema's prim type name for the prim at path at the current EditTarget. Author SdfPrimSpec s with specifier == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors.

The given path must be an absolute prim path that does not contain any variant selections.

If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget's namespace) issue an error and return an invalid UsdPrim.

Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget.

static USDGEOM_API UsdGeomBasisCurves UsdGeomBasisCurves::Get ( const UsdStagePtr &  stage,
const SdfPath path 
)
static

Return a UsdGeomBasisCurves holding the prim adhering to this schema at path on stage. If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:

UsdGeomBasisCurves(stage->GetPrimAtPath(path));
USDGEOM_API UsdAttribute UsdGeomBasisCurves::GetBasisAttr ( ) const

The basis specifies the vstep and matrix used for cubic interpolation.

Note
The 'hermite' and 'power' tokens have been removed. We've provided UsdGeomHermiteCurves as an alternative for the 'hermite' basis.
Declaration uniform token basis = "bezier"
C++ Type TfToken
Usd Type SdfValueTypeNames->Token
Variability SdfVariabilityUniform
Allowed Values bezier, bspline, catmullRom
static USDGEOM_API const TfTokenVector& UsdGeomBasisCurves::GetSchemaAttributeNames ( bool  includeInherited = true)
static

Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved.

USDGEOM_API UsdAttribute UsdGeomBasisCurves::GetTypeAttr ( ) const

Linear curves interpolate linearly between two vertices. Cubic curves use a basis matrix with four vertices to interpolate a segment.

Declaration uniform token type = "cubic"
C++ Type TfToken
Usd Type SdfValueTypeNames->Token
Variability SdfVariabilityUniform
Allowed Values linear, cubic
USDGEOM_API UsdAttribute UsdGeomBasisCurves::GetWrapAttr ( ) const

If wrap is set to periodic, the curve when rendered will repeat the initial vertices (dependent on the vstep) to close the curve. If wrap is set to 'pinned', phantom points may be created to ensure that the curve interpolation starts at P[0] and ends at P[n-1].

Declaration uniform token wrap = "nonperiodic"
C++ Type TfToken
Usd Type SdfValueTypeNames->Token
Variability SdfVariabilityUniform
Allowed Values nonperiodic, periodic, pinned

Friends And Related Function Documentation

friend class UsdSchemaRegistry
friend

Definition at line 347 of file basisCurves.h.

Member Data Documentation

const UsdSchemaType UsdGeomBasisCurves::schemaType = UsdSchemaType::ConcreteTyped
static

Compile time constant representing what kind of schema this class is.

See Also
UsdSchemaType

Definition at line 269 of file basisCurves.h.


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