Skip to main content

Scale

Trait Scale 

Source
pub trait Scale {
    // Required methods
    fn scale_length(&self, v: PositiveReal) -> Self;
    fn scale_volume(&self, v: PositiveReal) -> Self;
}
Expand description

Produce a new shape by uniform scaling.

§Example

use hoomd_geometry::{Scale, shape::Sphere};

let sphere = Sphere {
    radius: 5.0.try_into()?,
};

let scaled_sphere = sphere.scale_length(0.5.try_into()?);

assert_eq!(scaled_sphere.radius.get(), 2.5);

Required Methods§

Source

fn scale_length(&self, v: PositiveReal) -> Self

Produce a new shape by uniformly scaling length.

Source

fn scale_volume(&self, v: PositiveReal) -> Self

Produce a new shape by uniformly scaling volume.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const N: usize> Scale for Hypercuboid<N>

Source§

impl<const N: usize> Scale for Hypersphere<N>