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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use fj_math::{Circle, Line, Vector};
use crate::{
objects::{Curve, Objects, Surface},
path::{GlobalPath, SurfacePath},
storage::Handle,
};
use super::{Sweep, SweepCache};
impl Sweep for Handle<Curve> {
type Swept = Handle<Surface>;
fn sweep_with_cache(
self,
path: impl Into<Vector<3>>,
_: &mut SweepCache,
objects: &Objects,
) -> Self::Swept {
match self.surface().u() {
GlobalPath::Circle(_) => {
todo!(
"Sweeping a curve that is defined on a curved surface is \
not supported yet."
)
}
GlobalPath::Line(_) => {
}
}
let u = match self.path() {
SurfacePath::Circle(circle) => {
let center =
self.surface().point_from_surface_coords(circle.center());
let a = self.surface().vector_from_surface_coords(circle.a());
let b = self.surface().vector_from_surface_coords(circle.b());
let circle = Circle::new(center, a, b);
GlobalPath::Circle(circle)
}
SurfacePath::Line(line) => {
let origin =
self.surface().point_from_surface_coords(line.origin());
let direction =
self.surface().vector_from_surface_coords(line.direction());
let line = Line::from_origin_and_direction(origin, direction);
GlobalPath::Line(line)
}
};
objects.surfaces.insert(Surface::new(u, path))
}
}