pub struct Position {
pub system: CoordinateSystem,
pub coords: [f64; 3],
}Expand description
A point expressed in a particular coordinate system.
Fields§
§system: CoordinateSystem§coords: [f64; 3]Implementations§
Source§impl Position
impl Position
pub fn cartesian(x: f64, y: f64, z: f64) -> Self
pub fn spherical(r: f64, theta: f64, phi: f64) -> Self
pub fn cylindrical(rho: f64, phi: f64, z: f64) -> Self
Sourcepub fn to_cartesian(&self) -> [f64; 3]
pub fn to_cartesian(&self) -> [f64; 3]
The Cartesian coordinates [x, y, z].
Sourcepub fn in_system(&self, system: CoordinateSystem) -> Position
pub fn in_system(&self, system: CoordinateSystem) -> Position
The same point expressed in system. Angles are carried over directly between the
spherical and cylindrical systems (they share φ), so no information is lost on the axis.
Sourcepub fn scale_factors(&self, system: CoordinateSystem) -> [f64; 3]
pub fn scale_factors(&self, system: CoordinateSystem) -> [f64; 3]
The scale factors (h₁, h₂, h₃) of system at this point, so that
ds² = Σ hᵢ² duᵢ²: (1, 1, 1), (1, r, r sin θ) or (1, ρ, 1).
Sourcepub fn frame(&self, system: CoordinateSystem) -> [[f64; 3]; 3]
pub fn frame(&self, system: CoordinateSystem) -> [[f64; 3]; 3]
The orthonormal, right-handed unit vectors (û₁, û₂, û₃) of system at this point, each
as Cartesian components (frame[i] is ûᵢ). Built from the angles, so it is defined even
where the position alone is degenerate (r = 0, ρ = 0, the poles).
Trait Implementations§
impl Copy for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
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