Struct rust_sc2::geometry::Point2 [−][src]
Point on 2D grid, the most frequently used geometric primitive.
Fields
x: f32
y: 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.
fn add(self, other: Self) -> Self
[src]
impl Add<f32> for Point2
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: f32) -> Self
[src]
impl AddAssign<Point2> for Point2
[src]
fn add_assign(&mut self, other: Self)
[src]
impl AddAssign<f32> for Point2
[src]
fn add_assign(&mut self, other: f32)
[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.
fn div(self, other: Self) -> Self
[src]
impl Div<f32> for Point2
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, other: f32) -> Self
[src]
impl DivAssign<Point2> for Point2
[src]
fn div_assign(&mut self, other: Self)
[src]
impl DivAssign<f32> for Point2
[src]
fn div_assign(&mut self, other: f32)
[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]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Mul<Point2> for Point2
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, other: Self) -> Self
[src]
impl Mul<f32> for Point2
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, other: f32) -> Self
[src]
impl MulAssign<Point2> for Point2
[src]
fn mul_assign(&mut self, other: Self)
[src]
impl MulAssign<f32> for Point2
[src]
fn mul_assign(&mut self, other: f32)
[src]
impl Neg for Point2
[src]
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.
fn sub(self, other: Self) -> Self
[src]
impl Sub<f32> for Point2
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: f32) -> Self
[src]
impl SubAssign<Point2> for Point2
[src]
fn sub_assign(&mut self, other: Self)
[src]
impl SubAssign<f32> for Point2
[src]
fn sub_assign(&mut self, other: f32)
[src]
impl Sum<Point2> for Point2
[src]
Auto Trait Implementations
impl RefUnwindSafe for Point2
[src]
impl Send for Point2
[src]
impl Sync for Point2
[src]
impl Unpin for Point2
[src]
impl UnwindSafe for Point2
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Distance for T where
T: Into<Point2>,
[src]
T: Into<Point2>,
fn distance_squared<P: Into<Point2>>(self, other: P) -> f32
[src]
fn distance<P: Into<Point2>>(self, other: P) -> f32
[src]
fn is_closer<P: Into<Point2>>(self, distance: f32, other: P) -> bool
[src]
fn is_further<P: Into<Point2>>(self, distance: f32, other: P) -> bool
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,