Struct rust_sc2::geometry::Point2[][src]

pub struct Point2 {
    pub x: f32,
    pub y: f32,
}

Point on 2D grid, the most frequently used geometric primitive.

Fields

x: f32y: f32

Implementations

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(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 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

impl Add<Point2> for Point2[src]

type Output = Self

The resulting type after applying the + operator.

impl Add<f32> for Point2[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<Point2> for Point2[src]

impl AddAssign<f32> for Point2[src]

impl Clone for Point2[src]

impl Copy for Point2[src]

impl Debug for Point2[src]

impl Default for Point2[src]

impl Div<Point2> for Point2[src]

type Output = Self

The resulting type after applying the / operator.

impl Div<f32> for Point2[src]

type Output = Self

The resulting type after applying the / operator.

impl DivAssign<Point2> for Point2[src]

impl DivAssign<f32> for Point2[src]

impl Eq for Point2[src]

impl From<&'_ Point2> for Point2[src]

impl From<&'_ Unit> for Point2[src]

impl From<(f32, f32)> for Point2[src]

impl From<(usize, usize)> for Point2[src]

impl From<Point3> for Point2[src]

impl From<Unit> for Point2[src]

impl Hash for Point2[src]

impl Mul<Point2> for Point2[src]

type Output = Self

The resulting type after applying the * operator.

impl Mul<f32> for Point2[src]

type Output = Self

The resulting type after applying the * operator.

impl MulAssign<Point2> for Point2[src]

impl MulAssign<f32> for Point2[src]

impl Neg for Point2[src]

type Output = Self

The resulting type after applying the - operator.

impl PartialEq<Point2> for Point2[src]

impl Radius for Point2[src]

impl Radius for &Point2[src]

impl Sub<Point2> for Point2[src]

type Output = Self

The resulting type after applying the - operator.

impl Sub<f32> for Point2[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<Point2> for Point2[src]

impl SubAssign<f32> for Point2[src]

impl Sum<Point2> for Point2[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Distance for T where
    T: Into<Point2>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,