Struct rust_sc2::geometry::Point2 [−][src]
Point on 2D grid, the most frequently used geometric primitive.
Fields
x: f32y: f32Implementations
impl Point2[src]
impl Point2[src]pub fn new(x: f32, y: f32) -> Self[src]
Constructs new 2D Point with given coordinates.
pub fn towards(self, other: Self, offset: f32) -> Self[src]
Returns new point with offset towards other on given distance.
pub fn towards_angle(self, angle: f32, offset: f32) -> Self[src]
Returns new point with offset towards given angle on given distance.
pub fn offset(self, x: f32, y: f32) -> Self[src]
Returns new point with given offset.
pub fn circle_intersection(self, other: Self, radius: f32) -> Option<[Self; 2]>[src]
Returns points where circles with centers self and other,
and given radius intersect, or None if they aren’t intersect.
pub fn len_squared(self) -> f32[src]
Returns squared length of the vector.
pub fn len(self) -> f32[src]
Returns length of the vector.
pub fn normalize(self) -> Self[src]
Normalizes the vector.
pub fn rotate(self, angle: f32) -> Self[src]
Rotates the vector on given angle.
pub fn rotate90(self, clockwise: bool) -> Self[src]
Fast rotation of the vector on 90 degrees.
pub fn dot(self, other: Self) -> f32[src]
Dot product.
pub fn round(self) -> Self[src]
Returns rounded point.
pub fn floor(self) -> Self[src]
Returns point rounded to closest lower integer.
pub fn ceil(self) -> Self[src]
Returns point rounded to closest greater integer.
pub fn abs(self) -> Self[src]
Returns point with absolute coordinates.
pub fn neighbors4(self) -> [Self; 4][src]
Returns 4 closest neighbors of point.
pub fn neighbors4diagonal(self) -> [Self; 4][src]
Returns 4 closest diagonal neighbors of point.
pub fn neighbors8(self) -> [Self; 8][src]
Returns 8 closest neighbors of point.
pub fn as_tuple(self) -> (f32, f32)[src]
Returns tuple with point’s coordinates.
pub fn to3(self, z: f32) -> Point3[src]
Converts 2D Point to 3D Point using given z value.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Point2
impl RefUnwindSafe for Point2impl UnwindSafe for Point2
impl UnwindSafe for Point2Blanket Implementations
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]pub fn equivalent(&self, key: &K) -> bool[src]
impl<T> Same<T> for T
impl<T> Same<T> for Ttype Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,