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
43
44
45
use crate::geom::Vector;
use std::cmp::{Eq, PartialEq};
#[derive(Clone, Copy, Default, Debug)]
pub struct Line {
pub a: Vector,
pub b: Vector,
pub t: f32,
}
impl Line {
#[deprecated(
since = "0.4.0-alpha0.5",
note = "Use another collision library like `vek` instead; please comment on issue #552 for use-cases other libraries don't solve"
)]
pub fn new(start: Vector, end: Vector) -> Line {
Line {
a: start,
b: end,
t: 1.0,
}
}
#[must_use]
pub fn with_thickness(self, thickness: f32) -> Line {
Line {
t: thickness,
..self
}
}
}
impl PartialEq for Line {
fn eq(&self, other: &Line) -> bool {
self.a == other.a && self.b == other.b
}
}
impl Eq for Line {}