[−][src]Struct sfml::system::Vector2
Utility type for manipulating 2-dimensional vectors.
Vector2 is a simple type that defines
a mathematical vector with two coordinates (x and y).
It can be used to represent anything that has two 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 (Vector2<T>), the most common
specializations have special type aliases:
The Vector2 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 = Vector2f::new(16.5, 24.0); v1.x = 18.2; let y = v1.y; let v2 = v1 * 5.0; let v3 = v1 + v2; assert_ne!(v2, v3);
Note: for 3-dimensional vectors, see Vector3.
Fields
x: TX coordinate of the vector.
y: TY coordinate of the vector.
Methods
impl<T> Vector2<T>[src]
Trait Implementations
impl<T> From<(T, T)> for Vector2<T>[src]
impl<T: Clone> Clone for Vector2<T>[src]
impl<T: Copy> Copy for Vector2<T>[src]
impl<T: Default> Default for Vector2<T>[src]
impl<T: Eq> Eq for Vector2<T>[src]
impl<T: Ord> Ord for Vector2<T>[src]
fn cmp(&self, other: &Vector2<T>) -> Ordering[src]
fn max(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> Self1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self[src]
impl<T: PartialEq> PartialEq<Vector2<T>> for Vector2<T>[src]
impl<T: PartialOrd> PartialOrd<Vector2<T>> for Vector2<T>[src]
fn partial_cmp(&self, other: &Vector2<T>) -> Option<Ordering>[src]
fn lt(&self, other: &Vector2<T>) -> bool[src]
fn le(&self, other: &Vector2<T>) -> bool[src]
fn gt(&self, other: &Vector2<T>) -> bool[src]
fn ge(&self, other: &Vector2<T>) -> bool[src]
impl<T: Debug> Debug for Vector2<T>[src]
impl<T: Div + Copy> Div<T> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the / operator.
fn div(self, rhs: T) -> Vector2<T::Output>[src]
impl Div<Vector2<i32>> for i32[src]
type Output = Vector2<i32>
The resulting type after applying the / operator.
fn div(self, rhs: Vector2<i32>) -> Vector2<i32>[src]
impl Div<Vector2<u32>> for u32[src]
type Output = Vector2<u32>
The resulting type after applying the / operator.
fn div(self, rhs: Vector2<u32>) -> Vector2<u32>[src]
impl Div<Vector2<f32>> for f32[src]
type Output = Vector2<f32>
The resulting type after applying the / operator.
fn div(self, rhs: Vector2<f32>) -> Vector2<f32>[src]
impl<T: Div> Div<Vector2<T>> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the / operator.
fn div(self, rhs: Vector2<T>) -> Vector2<T::Output>[src]
impl<T: Sub + Copy> Sub<T> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the - operator.
fn sub(self, rhs: T) -> Vector2<T::Output>[src]
impl Sub<Vector2<i32>> for i32[src]
type Output = Vector2<i32>
The resulting type after applying the - operator.
fn sub(self, rhs: Vector2<i32>) -> Vector2<i32>[src]
impl Sub<Vector2<u32>> for u32[src]
type Output = Vector2<u32>
The resulting type after applying the - operator.
fn sub(self, rhs: Vector2<u32>) -> Vector2<u32>[src]
impl Sub<Vector2<f32>> for f32[src]
type Output = Vector2<f32>
The resulting type after applying the - operator.
fn sub(self, rhs: Vector2<f32>) -> Vector2<f32>[src]
impl<T: Sub> Sub<Vector2<T>> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the - operator.
fn sub(self, rhs: Vector2<T>) -> Vector2<T::Output>[src]
impl<T: Add + Copy> Add<T> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the + operator.
fn add(self, rhs: T) -> Vector2<T::Output>[src]
impl Add<Vector2<i32>> for i32[src]
type Output = Vector2<i32>
The resulting type after applying the + operator.
fn add(self, rhs: Vector2<i32>) -> Vector2<i32>[src]
impl Add<Vector2<u32>> for u32[src]
type Output = Vector2<u32>
The resulting type after applying the + operator.
fn add(self, rhs: Vector2<u32>) -> Vector2<u32>[src]
impl Add<Vector2<f32>> for f32[src]
type Output = Vector2<f32>
The resulting type after applying the + operator.
fn add(self, rhs: Vector2<f32>) -> Vector2<f32>[src]
impl<T: Add> Add<Vector2<T>> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the + operator.
fn add(self, rhs: Vector2<T>) -> Vector2<T::Output>[src]
impl<T: Mul + Copy> Mul<T> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the * operator.
fn mul(self, rhs: T) -> Vector2<T::Output>[src]
impl Mul<Vector2<i32>> for i32[src]
type Output = Vector2<i32>
The resulting type after applying the * operator.
fn mul(self, rhs: Vector2<i32>) -> Vector2<i32>[src]
impl Mul<Vector2<u32>> for u32[src]
type Output = Vector2<u32>
The resulting type after applying the * operator.
fn mul(self, rhs: Vector2<u32>) -> Vector2<u32>[src]
impl Mul<Vector2<f32>> for f32[src]
type Output = Vector2<f32>
The resulting type after applying the * operator.
fn mul(self, rhs: Vector2<f32>) -> Vector2<f32>[src]
impl<T: Mul> Mul<Vector2<T>> for Vector2<T>[src]
type Output = Vector2<T::Output>
The resulting type after applying the * operator.
fn mul(self, rhs: Vector2<T>) -> Vector2<T::Output>[src]
impl<T: Neg<Output = T>> Neg for Vector2<T>[src]
impl<T: AddAssign> AddAssign<Vector2<T>> for Vector2<T>[src]
fn add_assign(&mut self, rhs: Self)[src]
impl<T: SubAssign> SubAssign<Vector2<T>> for Vector2<T>[src]
fn sub_assign(&mut self, rhs: Self)[src]
impl<T: MulAssign + Copy> MulAssign<T> for Vector2<T>[src]
fn mul_assign(&mut self, rhs: T)[src]
impl<T: DivAssign + Copy> DivAssign<T> for Vector2<T>[src]
fn div_assign(&mut self, rhs: T)[src]
Auto Trait Implementations
impl<T> Send for Vector2<T> where
T: Send,
T: Send,
impl<T> Sync for Vector2<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Vector2<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Vector2<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Vector2<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,