All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
metrics.h File Reference
#include "pxr/pxr.h"
#include "pxr/usd/usdPhysics/api.h"
#include "pxr/usd/usd/common.h"
+ Include dependency graph for metrics.h:

Go to the source code of this file.


class  UsdPhysicsMassUnits


USDPHYSICS_API double UsdPhysicsGetStageKilogramsPerUnit (const UsdStageWeakPtr &stage)
 Return stage's authored kilogramsPerUnit, or 1.0 if unauthored. More...
USDPHYSICS_API bool UsdPhysicsStageHasAuthoredKilogramsPerUnit (const UsdStageWeakPtr &stage)
 Return whether stage has an authored kilogramsPerUnit. More...
USDPHYSICS_API bool UsdPhysicsSetStageKilogramsPerUnit (const UsdStageWeakPtr &stage, double kilogramsPerUnit)
USDPHYSICS_API bool UsdPhysicsMassUnitsAre (double authoredUnits, double standardUnits, double epsilon=1e-5)

Detailed Description

Helper APIs for physics related metrics operations.

Definition in file metrics.h.

Function Documentation

USDPHYSICS_API double UsdPhysicsGetStageKilogramsPerUnit ( const UsdStageWeakPtr stage)

Return stage's authored kilogramsPerUnit, or 1.0 if unauthored.

USDPHYSICS_API bool UsdPhysicsMassUnitsAre ( double  authoredUnits,
double  standardUnits,
double  epsilon = 1e-5 

Return true if the two given metrics are within the provided relative epsilon of each other, when you need to know an absolute metric rather than a scaling factor.

Use like so:

double stageUnits = UsdPhysicsGetStageKilogramsPerUnit(stage);
// do something for kilograms
// do something for grams
false if either input is zero or negative, otherwise relative floating-point comparison between the two inputs.
USDPHYSICS_API bool UsdPhysicsSetStageKilogramsPerUnit ( const UsdStageWeakPtr stage,
double  kilogramsPerUnit 

Author stage's kilogramsPerUnit.

true if kilogramsPerUnit was successfully set. The stage's UsdEditTarget must be either its root layer or session layer.
USDPHYSICS_API bool UsdPhysicsStageHasAuthoredKilogramsPerUnit ( const UsdStageWeakPtr stage)

Return whether stage has an authored kilogramsPerUnit.