Struct sfml::system::Vector3
[−]
[src]
#[repr(C)]pub struct Vector3<T> { pub x: T, pub y: T, pub z: T, }
Utility type for manipulating 3-dimensional vectors.
Vector3
is a simple type that defines a mathematical vector with
three coordinates (x, y and z).
It can be used to represent anything that has three dimensions: a size, a point, a velocity, etc.
The type parameter T is the type of the coordinates.
You generally don't have to care about the generic form (Vector3<T>
),
the most common specializations have special type aliases:
Vector3<f32>
isVector3f
Vector3<i32>
isVector3i
The Vector3
type has a small and simple interface, its x and y members can be
accessed directly (there are no accessors like set_x()
, get_x()
) and it contains no
mathematical function like dot product, cross product, length, etc.
Usage example
let mut v1 = Vector3f::new(16.5, 24.0, -8.2); v1.x = 18.2; let y = v1.y; let z = v1.z; let v2 = v1 * 5.0; let v3 = v1 + v2; assert_ne!(v2, v3);
Note: for 2-dimensional vectors, see Vector2
.
Fields
x: T
X coordinate of the vector.
y: T
Y coordinate of the vector.
z: T
Z coordinate of the vector.
Methods
impl<T> Vector3<T>
[src]
Trait Implementations
impl<T: Clone> Clone for Vector3<T>
[src]
fn clone(&self) -> Vector3<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialOrd> PartialOrd for Vector3<T>
[src]
fn partial_cmp(&self, __arg_0: &Vector3<T>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Vector3<T>) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Vector3<T>) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Vector3<T>) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Vector3<T>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: PartialEq> PartialEq for Vector3<T>
[src]
fn eq(&self, __arg_0: &Vector3<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Vector3<T>) -> bool
[src]
This method tests for !=
.
impl<T: Debug> Debug for Vector3<T>
[src]
impl<T: Copy> Copy for Vector3<T>
[src]
impl<T: Default> Default for Vector3<T>
[src]
impl<T: Add + Copy> Add<T> for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the +
operator.
fn add(self, rhs: T) -> Vector3<T::Output>
[src]
Performs the +
operation.
impl<T: Sub + Copy> Sub<T> for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the -
operator.
fn sub(self, rhs: T) -> Vector3<T::Output>
[src]
Performs the -
operation.
impl<T: Mul + Copy> Mul<T> for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the *
operator.
fn mul(self, rhs: T) -> Vector3<T::Output>
[src]
Performs the *
operation.
impl<T: Div + Copy> Div<T> for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the /
operator.
fn div(self, rhs: T) -> Vector3<T::Output>
[src]
Performs the /
operation.
impl<T: Add> Add for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the +
operator.
fn add(self, rhs: Vector3<T>) -> Vector3<T::Output>
[src]
Performs the +
operation.
impl<T: AddAssign> AddAssign for Vector3<T>
[src]
fn add_assign(&mut self, rhs: Self)
[src]
Performs the +=
operation.
impl<T: Sub> Sub for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the -
operator.
fn sub(self, rhs: Vector3<T>) -> Vector3<T::Output>
[src]
Performs the -
operation.
impl<T: SubAssign> SubAssign for Vector3<T>
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
Performs the -=
operation.
impl<T: Mul> Mul for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the *
operator.
fn mul(self, rhs: Vector3<T>) -> Vector3<T::Output>
[src]
Performs the *
operation.
impl<T: MulAssign + Copy> MulAssign<T> for Vector3<T>
[src]
fn mul_assign(&mut self, rhs: T)
[src]
Performs the *=
operation.
impl<T: Div> Div for Vector3<T>
[src]
type Output = Vector3<T::Output>
The resulting type after applying the /
operator.
fn div(self, rhs: Vector3<T>) -> Vector3<T::Output>
[src]
Performs the /
operation.
impl<T: DivAssign + Copy> DivAssign<T> for Vector3<T>
[src]
fn div_assign(&mut self, rhs: T)
[src]
Performs the /=
operation.
impl<T: Neg<Output = T>> Neg for Vector3<T>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self
[src]
Performs the unary -
operation.