[−][src]Struct helixiser::helix::Helix
A Helix struct
Fields
radius: f64
A Helix has a radius value, which should be positive
rise: f64
The helical rise is the distance between subunits along the helix axis (i.e. z axis)
frequency: f64
The amount of subunits in a full turn of a helix. Can be decimal value.
unit_size: f64
The size of each subunit
offset: f64
Translational offset along helix axis (i.e. z)
rotation: f64
Rotational offset of helix around helix axis (i.e. z)
handedness: Handedness
Handedness (left- or righthanded) of the helix.
Implementations
impl Helix
[src]
pub fn new(
radius: f64,
rise: f64,
frequency: f64,
unit_size: f64,
offset: f64,
rotation: f64,
handedness: Handedness
) -> Helix
[src]
radius: f64,
rise: f64,
frequency: f64,
unit_size: f64,
offset: f64,
rotation: f64,
handedness: Handedness
) -> Helix
Create a new Helix
Directly instantiating is also permitted, as it is more human readable, so may be preferred for example code. When programmatically generating helices, it is best to use the Helix::new() approach as it panics when it encounters invalid values.
Examples
use helixiser::helix::{Helix, Handedness}; let my_helix = Helix::new(0.1, 0.4, 12., 0.1, 5.6, 180., Handedness::Right); let second = my_helix.clone();
Panics
The new function will panic if any of radius, rise, frequency, unit_size or offset are smaller than or equal to zero.
pub fn pitch(&self) -> f64
[src]
Compute the pitch of the helix. This is the distance between the helix backbone along
the helix axis (i.e. z axis) after a full rotation. Does not need to be an integer
multiple of the rise. Is computed as pitch
= rise
* frequency
.
Examples
use std::f64::consts::PI; let my_helix = Helix::new( 18.9, 0.55, 11.5, 0.1, 0., 0., Handedness::Right ); let myPitch = my_helix.pitch(); assert_eq!(myPitch, 11.5 * 0.55)
pub fn rotation_to_rad(&self) -> f64
[src]
Convert the helix' rotation to radians insted of the default (degrees)
Examples
use std::f64::consts::PI; let my_helix = Helix::new ( 1.0, 0.34, 10., 0.18, 0., 90., Handedness::Right ); let rotation = my_helix.rotation_to_rad(); assert_eq!(rotation, PI/2f64)
pub fn rad_per_subunit(&self) -> f64
[src]
Determine the rotational offset between subunits. This is related only to the frequency
by: rotational offset = 2*Pi / frequency
Examples
use std::f64::consts::PI; let my_helix = Helix::new ( 2.0, 0.34, 8., 0.1, 0., 90., Handedness::Right ); let angle_per_subunit = my_helix.rad_per_subunit(); assert_eq!(angle_per_subunit, PI/4f64)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Helix
[src]
impl Send for Helix
[src]
impl Sync for Helix
[src]
impl Unpin for Helix
[src]
impl UnwindSafe for Helix
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,