circle 0.1.9

Definition of circle and ellipse
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::elements::point::Point;

impl Point {
    /// Construct new point
    pub fn new(x: f32, y: f32) -> Self {
        Self { x, y, ..Default::default() }
    }
}

impl Point {
    /// Distance between two points.
    pub fn distance_to(&self, other: &Self) -> f32 {
        let dx = self.x - other.x;
        let dy = self.y - other.y;
        (dx * dx + dy * dy).sqrt()
    }
}