All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
metrics.h
Go to the documentation of this file.
1//
2// Copyright 2021 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_USD_PHYSICS_METRICS_H
8#define PXR_USD_USD_PHYSICS_METRICS_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usdPhysics/api.h"
12#include "pxr/usd/usd/common.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
19
21USDPHYSICS_API
22double UsdPhysicsGetStageKilogramsPerUnit(const UsdStageWeakPtr &stage);
23
25USDPHYSICS_API
26bool UsdPhysicsStageHasAuthoredKilogramsPerUnit(const UsdStageWeakPtr &stage);
27
32USDPHYSICS_API
33bool UsdPhysicsSetStageKilogramsPerUnit(const UsdStageWeakPtr &stage,
34 double kilogramsPerUnit);
35
52USDPHYSICS_API
53bool UsdPhysicsMassUnitsAre(double authoredUnits, double standardUnits,
54 double epsilon = 1e-5);
55
60public:
61 static constexpr double grams = 0.001;
62 static constexpr double kilograms = 1.0;
63 static constexpr double slugs = 14.5939;
64};
65
66PXR_NAMESPACE_CLOSE_SCOPE
67
68#endif // PXR_USD_USD_PHYSICS_METRICS_H
Container class for static double-precision symbols representing common mass units of measure express...
Definition: metrics.h:59
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,...
USDPHYSICS_API bool UsdPhysicsStageHasAuthoredKilogramsPerUnit(const UsdStageWeakPtr &stage)
Return whether stage has an authored kilogramsPerUnit.
USDPHYSICS_API double UsdPhysicsGetStageKilogramsPerUnit(const UsdStageWeakPtr &stage)
Return stage's authored kilogramsPerUnit, or 1.0 if unauthored.
USDPHYSICS_API bool UsdPhysicsSetStageKilogramsPerUnit(const UsdStageWeakPtr &stage, double kilogramsPerUnit)
Author stage's kilogramsPerUnit.