pub struct UnitScale {
pub length_to_metres: f64,
pub angle_to_radians: Option<f64>,
}Expand description
Multipliers converting file units into SI base units.
Fields§
§length_to_metres: f64Multiply a stored length by this to get metres.
angle_to_radians: Option<f64>Multiply a stored plane angle by this to get radians; None when the
project declares no PLANEANGLEUNIT.
Implementations§
Source§impl UnitScale
impl UnitScale
Sourcepub const SI: Self
pub const SI: Self
Metres and radians, both factors of one; never a fallback for a model’s missing units.
Sourcepub fn angle(&self, entity: EntityId, value: f64) -> GeometryResult<f64>
pub fn angle(&self, entity: EntityId, value: f64) -> GeometryResult<f64>
Convert a stored plane angle to radians.
entity is the entity holding the angle; it names the refusal when the
project declares no angle unit.
Sourcepub fn radians_per_unit(&self, entity: EntityId) -> GeometryResult<f64>
pub fn radians_per_unit(&self, entity: EntityId) -> GeometryResult<f64>
Radians per stored plane angle unit.
§Errors
GeometryError::AngleUnitUndeclared naming entity when the project
declares no angle unit.
Sourcepub fn is_metric_identity(&self) -> bool
pub fn is_metric_identity(&self) -> bool
Are lengths already in metres?
Trait Implementations§
impl Copy for UnitScale
impl StructuralPartialEq for UnitScale
Auto Trait Implementations§
impl Freeze for UnitScale
impl RefUnwindSafe for UnitScale
impl Send for UnitScale
impl Sync for UnitScale
impl Unpin for UnitScale
impl UnsafeUnpin for UnitScale
impl UnwindSafe for UnitScale
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more