pub struct Vec2<T> {
pub x: T,
pub y: T,
}
Expand description
A vector in 2D cartesian space.
The Vec2
struct represents a two-dimensional vector with x and y components.
Fields§
§x: T
The cartesian x coordinate.
y: T
The cartesian y coordinate.
Implementations§
Source§impl<T: Float + Copy + Mul<Output = T>> Vec2<T>
impl<T: Float + Copy + Mul<Output = T>> Vec2<T>
Sourcepub fn from_polar(r: T, theta: T) -> Self
pub fn from_polar(r: T, theta: T) -> Self
Construct a Vec2
from polar coordinates.
Trait Implementations§
Source§impl<T: AddAssign> AddAssign for Vec2<T>
impl<T: AddAssign> AddAssign for Vec2<T>
Source§fn add_assign(&mut self, other: Vec2<T>)
fn add_assign(&mut self, other: Vec2<T>)
Performs vector add-assignment.
Source§impl<T: DivAssign + Copy> DivAssign<T> for Vec2<T>
impl<T: DivAssign + Copy> DivAssign<T> for Vec2<T>
Source§fn div_assign(&mut self, scalar: T)
fn div_assign(&mut self, scalar: T)
Performs scalar div-assignment.
Source§impl<T: MulAssign + Copy> MulAssign<T> for Vec2<T>
impl<T: MulAssign + Copy> MulAssign<T> for Vec2<T>
Source§fn mul_assign(&mut self, scalar: T)
fn mul_assign(&mut self, scalar: T)
Performs scalar mul-assignment.
Source§impl<T: SubAssign> SubAssign for Vec2<T>
impl<T: SubAssign> SubAssign for Vec2<T>
Source§fn sub_assign(&mut self, other: Vec2<T>)
fn sub_assign(&mut self, other: Vec2<T>)
Performs vector sub-assignment.
impl<T: Copy> Copy for Vec2<T>
impl<T: Eq> Eq for Vec2<T>
impl<T> StructuralPartialEq for Vec2<T>
Auto Trait Implementations§
impl<T> Freeze for Vec2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vec2<T>where
T: RefUnwindSafe,
impl<T> Send for Vec2<T>where
T: Send,
impl<T> Sync for Vec2<T>where
T: Sync,
impl<T> Unpin for Vec2<T>where
T: Unpin,
impl<T> UnwindSafe for Vec2<T>where
T: UnwindSafe,
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