Struct tiny_skia_path::Point
source · #[repr(C)]pub struct Point {
pub x: f32,
pub y: f32,
}
Expand description
A point.
Doesn’t guarantee to be finite.
Fields§
§x: f32
§y: f32
Implementations§
source§impl Point
impl Point
sourcepub fn from_f32x2(r: f32x2) -> Self
pub fn from_f32x2(r: f32x2) -> Self
Creates a new Point
from f32x2
.
sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Returns true if both x and y are measurable values.
Both values are other than infinities and NaN.
sourcepub fn normalize(&mut self) -> bool
pub fn normalize(&mut self) -> bool
Scales (fX, fY) so that length() returns one, while preserving ratio of fX to fY, if possible.
If prior length is nearly zero, sets vector to (0, 0) and returns false; otherwise returns true.
sourcepub fn set_normalize(&mut self, x: f32, y: f32) -> bool
pub fn set_normalize(&mut self, x: f32, y: f32) -> bool
Sets vector to (x, y) scaled so length() returns one, and so that (x, y) is proportional to (x, y).
If (x, y) length is nearly zero, sets vector to (0, 0) and returns false; otherwise returns true.
sourcepub fn set_length(&mut self, length: f32) -> bool
pub fn set_length(&mut self, length: f32) -> bool
Scales vector so that distanceToOrigin() returns length, if possible.
If former length is nearly zero, sets vector to (0, 0) and return false; otherwise returns true.
sourcepub fn set_length_from(&mut self, x: f32, y: f32, length: f32) -> bool
pub fn set_length_from(&mut self, x: f32, y: f32, length: f32) -> bool
Sets vector to (x, y) scaled to length, if possible.
If former length is nearly zero, sets vector to (0, 0) and return false; otherwise returns true.
sourcepub fn cross(&self, other: Point) -> f32
pub fn cross(&self, other: Point) -> f32
Returns the cross product of vector and vec.
Vector and vec form three-dimensional vectors with z-axis value equal to zero. The cross product is a three-dimensional vector with x-axis and y-axis values equal to zero. The cross product z-axis component is returned.
Trait Implementations§
source§impl AddAssign for Point
impl AddAssign for Point
source§fn add_assign(&mut self, other: Point)
fn add_assign(&mut self, other: Point)
+=
operation. Read moresource§impl MulAssign for Point
impl MulAssign for Point
source§fn mul_assign(&mut self, other: Point)
fn mul_assign(&mut self, other: Point)
*=
operation. Read moresource§impl PartialEq for Point
impl PartialEq for Point
source§impl SubAssign for Point
impl SubAssign for Point
source§fn sub_assign(&mut self, other: Point)
fn sub_assign(&mut self, other: Point)
-=
operation. Read more