Point2D

Type Alias Point2D 

Source
pub type Point2D = Vec2;
Expand description

Represents a 2D point in space.

Alias for Vec2.

Aliased Type§

pub struct Point2D {
    pub x: f64,
    pub y: f64,
}

Fields§

§x: f64

X component of the vector.

§y: f64

Y component of the vector.

Implementations§

Source§

impl Point2D

Source

pub fn dist(&self, other: &Point2D) -> f64

Finds the unsigned distance between self and another 3D point Other.

#examples

use lars::Point2D;
let a = Point2D::new(1.0, 0.0);
let b = Point2D::new(0.0, 0.0);
assert_eq!(a.dist(&b), 1.0)



Source

pub fn dist_sq(&self, other: &Point2D) -> f64

Finds the unsigned distance between self and another 3D point Other, squared

#examples


use lars::Point2D;
let a = Point2D::new(2.0, 0.0);
let b = Point2D::new(0.0, 0.0);
assert_eq!(a.dist_sq(&b), 4.0)