Enum bvh::axis::Axis [−][src]
pub enum Axis { X, Y, Z, }
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 Debug for Axis
[src]
impl Debug for Axis
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Copy for Axis
[src]
impl Copy for Axis
impl Clone for Axis
[src]
impl Clone for Axis
fn clone(&self) -> Axis
[src]
fn clone(&self) -> Axis
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Axis
[src]
impl PartialEq for Axis
fn eq(&self, other: &Axis) -> bool
[src]
fn eq(&self, other: &Axis) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Display for Axis
[src]
impl Display for Axis
Display implementation for Axis
.
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Index<Axis> for [f32]
[src]
impl Index<Axis> for [f32]
Make slices indexable by Axis
.
type Output = f32
The returned type after indexing.
fn index(&self, axis: Axis) -> &f32
[src]
fn index(&self, axis: Axis) -> &f32
Performs the indexing (container[index]
) operation.
impl Index<Axis> for Point3<f32>
[src]
impl Index<Axis> for Point3<f32>
Make Point3
indexable by Axis
.
type Output = f32
The returned type after indexing.
fn index(&self, axis: Axis) -> &f32
[src]
fn index(&self, axis: Axis) -> &f32
Performs the indexing (container[index]
) operation.
impl IndexMut<Axis> for [f32]
[src]
impl IndexMut<Axis> for [f32]
Make slices mutably accessible by Axis
.
fn index_mut(&mut self, axis: Axis) -> &mut f32
[src]
fn index_mut(&mut self, axis: Axis) -> &mut f32
Performs the mutable indexing (container[index]
) operation.
impl IndexMut<Axis> for Point3<f32>
[src]
impl IndexMut<Axis> for Point3<f32>
Make Point3
mutably accessible by Axis
.