A3DUnitGetFromValue
-
A3DEUnits
A3DUnitGetFromValue(A3DDouble dUnit) -
Converts a units representation from``A3DDouble``to:c:enum:~A3DEUnits.
14.1HOOPS Exchange stores most of its unit information as factors of millimeters, as described in:c:enum:~A3DEUnits. This function allows you to retrieve the correct unit enumeration given an input value. For example, a value of*10.*returns:c:enumerator:~kA3DUnitCentimeter.
Behavior
To properly retrieve the correct:c:enum:~A3DEUnitsfor a given``A3DDouble``input, HOOPS Exchange compares it with the expected float value of each unit (as returned by:c:func:~A3DUnitGetFromEnum) given a unit-specific threshold as presented by this table:
**Enumerator** | **Value (millimeters)** | **Threshold**
kA3DUnitAngstrom| 1.e-7 | 1.e-9kA3DUnitAstronomical| 1.495978707e14 | 1.e2kA3DUnitCentimeter| 10.0 | 0.01kA3DUnitDecimeter| 1.e2 | 0.01kA3DUnitDekameter| 1.e4 | 0.01kA3DUnitFoot| 12.0 * 25.4 | 0.01kA3DUnitGigameter| 1.e12 | 1.kA3DUnitHectometer| 1.e5 | 0.01kA3DUnitInch| 25.4 | 0.01kA3DUnitKilometer| 1000000.0 | 0.01kA3DUnitLightYear| 9.4607304725808e18 | 1.e6kA3DUnitMeter| 1000.0 | 0.01kA3DUnitMicroInch| 2.54e-5 | 1.e-7kA3DUnitMicron| 1.e-3 | 1.e-4kA3DUnitMil| 0.0254 | 1.e-4kA3DUnitMile| 1760.0 * 3.0 * 12.0 * 25.4 | 0.01kA3DUnitMillimeter| 1.0 | 0.01kA3DUnitNanometer| 1.e-6 | 1.e-8kA3DUnitParsec| 64800.0 / PI * 1.495978707e14 | 1.e7kA3DUnitPicas| 25.4 / 6.0 | 0.01kA3DUnitPoint| 25.4 / 72.0 | 0.01kA3DUnitUSSurveyFoot| 1200000.0 / 3937.0 | 1.e-4kA3DUnitUSSurveyInch| 100000.0 / 3937.0 | 1.e-5kA3DUnitUSSurveyMile| 1760.0 * 3600000.0 / 3937.0 | 3937.,0.01kA3DUnitUSSurveyYard| 3.0 * 1200000.0 / 3937.0 | 1.e-4kA3DUnitYard| 3.0 * 12.0 * 25.4 | 0.01
If the provided value does not fall under any of these value ranges, the function returns:c:enumerator:~kA3DUnitUnknown.
Parameters
dUnit: A unit value (in millimeter)Returns
An:c:enum:~A3DEUnitsvalue