[][src]Struct pbrt::core::geometry::Vector2

pub struct Vector2<T> {
    pub x: T,
    pub y: T,
}

Generic type for any 2D vector.

Fields

x: T

The x coordinate of this vector.

y: T

The y coordinate of this vector.

Trait Implementations

impl<T> Add<Vector2<T>> for Point2<T> where
    T: Number
[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, rhs: Vector2<T>) -> Self::Output[src]

Implement + for Point2 + Vector2

Examples

use pbrt::core::geometry::Point2i;
use pbrt::core::geometry::Vector2i;

let p1: Point2i = [4, 5].into();
let v1: Vector2i = [2, 3].into();
assert_eq!(p1 + v1, Point2i::from([6, 8]));

use pbrt::core::geometry::Point2f;
use pbrt::core::geometry::Vector2f;

let p1: Point2f = [4., 5.].into();
let v1: Vector2f = [2., 3.].into();
assert_eq!(p1 + v1, Point2f::from([6., 8.]));

impl<T: Clone> Clone for Vector2<T>[src]

impl<T: Copy> Copy for Vector2<T>[src]

impl<T: Debug> Debug for Vector2<T>[src]

impl<T: Default> Default for Vector2<T>[src]

impl<T> From<[T; 2]> for Vector2<T> where
    T: Number
[src]

impl<T: PartialEq> PartialEq<Vector2<T>> for Vector2<T>[src]

impl<T> StructuralPartialEq for Vector2<T>[src]

impl<T> Sub<Vector2<T>> for Point2<T> where
    T: Number
[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, rhs: Vector2<T>) -> Self::Output[src]

Implement - for Point2 - Vector2

Mathematically a point minus a point is a vector, and a point minus a vector is a point.

Examples

use pbrt::core::geometry::Point2i;
use pbrt::core::geometry::Vector2i;

let p1: Point2i = [4, 5].into();
let v1: Vector2i = [2, 3].into();
assert_eq!(p1 - v1, Point2i::from([2, 2]));

use pbrt::core::geometry::Point2f;
use pbrt::core::geometry::Vector2f;

let p1: Point2f = [4., 5.].into();
let v1: Vector2f = [2., 3.].into();
assert_eq!(p1 - v1, Point2f::from([2., 2.]));

Auto Trait Implementations

impl<T> RefUnwindSafe for Vector2<T> where
    T: RefUnwindSafe

impl<T> Send for Vector2<T> where
    T: Send

impl<T> Sync for Vector2<T> where
    T: Sync

impl<T> Unpin for Vector2<T> where
    T: Unpin

impl<T> UnwindSafe for Vector2<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.