pub struct Vector3 {
pub x: f64,
pub y: f64,
pub z: f64,
}
Expand description
A 3D vector with x
, y
, and z
components.
The Vector3
struct represents a point or direction in 3D space.
§Examples
use transforms::geometry::Vector3;
let vector = Vector3 { x: 1.0, y: 2.0, z: 3.0 };
assert_eq!(vector.x, 1.0);
assert_eq!(vector.y, 2.0);
assert_eq!(vector.z, 3.0);
Fields§
§x: f64
§y: f64
§z: f64
Implementations§
Source§impl Vector3
impl Vector3
Sourcepub fn new(x: f64, y: f64, z: f64) -> Self
pub fn new(x: f64, y: f64, z: f64) -> Self
Creates a new Vector3 with the given x, y, z coordinates.
§Examples
use transforms::geometry::Vector3;
let v = Vector3::new(1.0, 2.0, 3.0);
assert_eq!(v.x, 1.0);
assert_eq!(v.y, 2.0);
assert_eq!(v.z, 3.0);
pub fn zero() -> Self
pub fn unit_x() -> Self
pub fn unit_y() -> Self
pub fn unit_z() -> Self
Trait Implementations§
Source§impl AbsDiffEq for Vector3
impl AbsDiffEq for Vector3
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq
.Source§impl PartialOrd for Vector3
impl PartialOrd for Vector3
Source§impl RelativeEq for Vector3
impl RelativeEq for Vector3
Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
The inverse of
RelativeEq::relative_eq
.impl Copy for Vector3
impl StructuralPartialEq for Vector3
Auto Trait Implementations§
impl Freeze for Vector3
impl RefUnwindSafe for Vector3
impl Send for Vector3
impl Sync for Vector3
impl Unpin for Vector3
impl UnwindSafe for Vector3
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