pub struct Vector {
pub x: f64,
pub y: f64,
}Expand description
二维向量。
Fields§
§x: f64X 分量。
y: f64Y 分量。
Implementations§
Source§impl Vector
impl Vector
Sourcepub const fn length_squared(self) -> f64
pub const fn length_squared(self) -> f64
返回向量长度的平方。
Sourcepub fn normalized(self) -> Option<Vector>
pub fn normalized(self) -> Option<Vector>
返回单位向量;零长度或非有限向量返回 None。
Sourcepub fn angle_between(self, other: Vector) -> Option<f64>
pub fn angle_between(self, other: Vector) -> Option<f64>
返回两个向量之间的夹角,单位为弧度。
Trait Implementations§
impl Copy for Vector
impl StructuralPartialEq for Vector
Auto Trait Implementations§
impl Freeze for Vector
impl RefUnwindSafe for Vector
impl Send for Vector
impl Sync for Vector
impl Unpin for Vector
impl UnsafeUnpin for Vector
impl UnwindSafe for Vector
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