logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use super::*;

mod dim2;
mod dim3;
mod traits;

/// A circle.
#[derive(Clone, Copy, Debug)]
pub struct Line<T> {
    pub start: Point<T>,
    pub end: Point<T>,
}

#[derive(Clone, Copy, Debug)]
pub struct Vector<T> {
    pub dx: T,
    pub dy: T,
}

#[derive(Clone, Copy, Debug)]
pub struct Vector3D<T> {
    pub dx: T,
    pub dy: T,
    pub dz: T,
}

impl<T> PartialEq for Line<T>
where
    T: PartialEq,
{
    /// If two vectors are collinear, then the two lines coincide
    fn eq(&self, other: &Self) -> bool {
        self.start == other.start && self.end == other.end
    }
}

/// A circle.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Line3D<T> {
    pub start: Point3D<T>,
    pub end: Point3D<T>,
}