Skip to content

Commit a3d9ea4

Browse files
committed
Avoid using Plane with Handle
`Plane` is not an operation (i.e. it doesn't implement the `Operation` trait), and I'm working on change that will restrict `Handle` to working with operations.
1 parent e1daf4b commit a3d9ea4

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

experiments/2024-12-09/src/geometry/sketch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub struct Sketch {
1010
}
1111

1212
impl Sketch {
13-
pub fn to_face(&self, surface: Handle<Plane>) -> Face {
13+
pub fn to_face(&self, surface: Plane) -> Face {
1414
let vertices = self
1515
.points
1616
.iter()

experiments/2024-12-09/src/model.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ pub fn model() -> AnyOp {
99
let sketch =
1010
Sketch::from([[-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [-0.5, 0.5]]);
1111

12-
let surface = Handle::new(Plane {
12+
let surface = Plane {
1313
origin: Point::from([0., 0., 0.5]),
1414
coords: Bivector {
1515
a: Vector::from([1., 0., 0.]),
1616
b: Vector::from([0., 1., 0.]),
1717
},
18-
});
18+
};
1919

2020
sketch.to_face(surface)
2121
};

experiments/2024-12-09/src/topology/connect.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ impl ConnectExt for Handle<Face> {
3939
.half_edges()
4040
.zip(other.half_edges())
4141
.map(|([q, r], [t, s])| {
42-
let surface = Handle::new(Plane::from_points(
43-
[q, r, s].map(|vertex| vertex.point),
44-
));
42+
let surface =
43+
Plane::from_points([q, r, s].map(|vertex| vertex.point));
4544
let face = Face::new(
4645
surface,
4746
[q, r, s, t].map(|vertex| vertex.clone()),

experiments/2024-12-09/src/topology/face.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use super::vertex::Vertex;
1212

1313
#[derive(Debug)]
1414
pub struct Face {
15-
surface: Handle<Plane>,
15+
surface: Plane,
1616
vertices: Vec<Handle<Vertex>>,
1717
}
1818

1919
impl Face {
2020
pub fn new(
21-
surface: Handle<Plane>,
21+
surface: Plane,
2222
vertices: impl IntoIterator<Item = Handle<Vertex>>,
2323
) -> Self {
2424
Self {
@@ -41,7 +41,7 @@ impl Face {
4141

4242
pub fn flip(&self) -> Self {
4343
Self {
44-
surface: Handle::new(self.surface.flip()),
44+
surface: self.surface.flip(),
4545
vertices: self.vertices.clone(),
4646
}
4747
}
@@ -50,7 +50,7 @@ impl Face {
5050
let offset = offset.into();
5151

5252
Self {
53-
surface: Handle::new(self.surface.translate(offset)),
53+
surface: self.surface.translate(offset),
5454
vertices: self
5555
.vertices
5656
.iter()

0 commit comments

Comments
 (0)