[−][src]Struct pbrt::core::geometry::Vector2
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]
T: Number,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Vector2<T>) -> Self::Output
[src]
Implement +
for Point2
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]
T: Number,
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]
T: Number,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Vector2<T>) -> Self::Output
[src]
Implement -
for Point2
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,
T: RefUnwindSafe,
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,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
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>,