pub enum Axis {
X,
Y,
Z,
}
Expand description
An Axis
in a three-dimensional coordinate system.
Used to access Vector3
/Point3
structs via index.
Examples
use bvh::axis::Axis;
let mut position = [1.0, 0.5, 42.0];
position[Axis::Y] *= 4.0;
assert_eq!(position[Axis::Y], 2.0);
nalgebra
structures are also indexable using Axis
.
For reference see [the documentation]
(http://nalgebra.org/doc/nalgebra/struct.Vector3.html#method.index).
extern crate bvh;
extern crate nalgebra;
use bvh::axis::Axis;
use nalgebra::Point3;
let mut position: Point3<f32> = Point3::new(1.0, 2.0, 3.0);
position[Axis::X] = 1000.0;
assert_eq!(position[Axis::X], 1000.0);
Variants
X
Index of the X axis.
Y
Index of the Y axis.
Z
Index of the Z axis.
Trait Implementations
impl Copy for Axis
impl StructuralPartialEq for Axis
Auto Trait Implementations
impl RefUnwindSafe for Axis
impl Send for Axis
impl Sync for Axis
impl Unpin for Axis
impl UnwindSafe for Axis
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read morefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.