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 2016 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_GEOM_METRICS_H
8#define PXR_USD_USD_GEOM_METRICS_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usdGeom/api.h"
12#include "pxr/base/tf/token.h"
13#include "pxr/usd/usd/common.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
17
64
73USDGEOM_API
74TfToken UsdGeomGetStageUpAxis(const UsdStageWeakPtr &stage);
75
84USDGEOM_API
85bool UsdGeomSetStageUpAxis(const UsdStageWeakPtr &stage, const TfToken &axis);
86
102USDGEOM_API
104
106
133
135
138USDGEOM_API
139double UsdGeomGetStageMetersPerUnit(const UsdStageWeakPtr &stage);
140
143USDGEOM_API
144bool UsdGeomStageHasAuthoredMetersPerUnit(const UsdStageWeakPtr &stage);
145
151USDGEOM_API
152bool UsdGeomSetStageMetersPerUnit(const UsdStageWeakPtr &stage,
153 double metersPerUnit);
154
172USDGEOM_API
173bool UsdGeomLinearUnitsAre(double authoredUnits, double standardUnits,
174 double epsilon = 1e-5);
175
181public:
182 static constexpr double nanometers = 1e-9;
183 static constexpr double micrometers = 1e-6;
184 static constexpr double millimeters = 0.001;
185 static constexpr double centimeters = 0.01;
186 static constexpr double meters = 1.0;
187 static constexpr double kilometers = 1000;
188
190 static constexpr double lightYears = 9.4607304725808e15;
191
192 static constexpr double inches = 0.0254;
193 static constexpr double feet = 0.3048;
194 static constexpr double yards = 0.9144;
195 static constexpr double miles = 1609.344;
196};
197
199
200PXR_NAMESPACE_CLOSE_SCOPE
201
202#endif // PXR_USD_USD_GEOM_METRICS_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Container class for static double-precision symbols representing common units of measure expressed in...
Definition: metrics.h:180
static constexpr double lightYears
Measured for one year = 365.25 days.
Definition: metrics.h:190
USDGEOM_API bool UsdGeomLinearUnitsAre(double authoredUnits, double standardUnits, double epsilon=1e-5)
Return true if the two given metrics are within the provided relative epsilon of each other,...
USDGEOM_API bool UsdGeomStageHasAuthoredMetersPerUnit(const UsdStageWeakPtr &stage)
Return whether stage has an authored metersPerUnit.
USDGEOM_API bool UsdGeomSetStageMetersPerUnit(const UsdStageWeakPtr &stage, double metersPerUnit)
Author stage's metersPerUnit.
USDGEOM_API double UsdGeomGetStageMetersPerUnit(const UsdStageWeakPtr &stage)
Return stage's authored metersPerUnit, or 0.01 if unauthored.
USDGEOM_API TfToken UsdGeomGetStageUpAxis(const UsdStageWeakPtr &stage)
Fetch and return stage 's upAxis.
USDGEOM_API bool UsdGeomSetStageUpAxis(const UsdStageWeakPtr &stage, const TfToken &axis)
Set stage 's upAxis to axis, which must be one of UsdGeomTokens->y or UsdGeomTokens->z.
USDGEOM_API TfToken UsdGeomGetFallbackUpAxis()
Return the site-level fallback up axis as a TfToken.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...