mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 01:48:28 +00:00
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.
This commit is contained in:
parent
e1daf4ba91
commit
a3d9ea4674
@ -10,7 +10,7 @@ pub struct Sketch {
|
||||
}
|
||||
|
||||
impl Sketch {
|
||||
pub fn to_face(&self, surface: Handle<Plane>) -> Face {
|
||||
pub fn to_face(&self, surface: Plane) -> Face {
|
||||
let vertices = self
|
||||
.points
|
||||
.iter()
|
||||
|
@ -9,13 +9,13 @@ pub fn model() -> AnyOp {
|
||||
let sketch =
|
||||
Sketch::from([[-0.5, -0.5], [0.5, -0.5], [0.5, 0.5], [-0.5, 0.5]]);
|
||||
|
||||
let surface = Handle::new(Plane {
|
||||
let surface = Plane {
|
||||
origin: Point::from([0., 0., 0.5]),
|
||||
coords: Bivector {
|
||||
a: Vector::from([1., 0., 0.]),
|
||||
b: Vector::from([0., 1., 0.]),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
sketch.to_face(surface)
|
||||
};
|
||||
|
@ -39,9 +39,8 @@ impl ConnectExt for Handle<Face> {
|
||||
.half_edges()
|
||||
.zip(other.half_edges())
|
||||
.map(|([q, r], [t, s])| {
|
||||
let surface = Handle::new(Plane::from_points(
|
||||
[q, r, s].map(|vertex| vertex.point),
|
||||
));
|
||||
let surface =
|
||||
Plane::from_points([q, r, s].map(|vertex| vertex.point));
|
||||
let face = Face::new(
|
||||
surface,
|
||||
[q, r, s, t].map(|vertex| vertex.clone()),
|
||||
|
@ -12,13 +12,13 @@ use super::vertex::Vertex;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Face {
|
||||
surface: Handle<Plane>,
|
||||
surface: Plane,
|
||||
vertices: Vec<Handle<Vertex>>,
|
||||
}
|
||||
|
||||
impl Face {
|
||||
pub fn new(
|
||||
surface: Handle<Plane>,
|
||||
surface: Plane,
|
||||
vertices: impl IntoIterator<Item = Handle<Vertex>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
@ -41,7 +41,7 @@ impl Face {
|
||||
|
||||
pub fn flip(&self) -> Self {
|
||||
Self {
|
||||
surface: Handle::new(self.surface.flip()),
|
||||
surface: self.surface.flip(),
|
||||
vertices: self.vertices.clone(),
|
||||
}
|
||||
}
|
||||
@ -50,7 +50,7 @@ impl Face {
|
||||
let offset = offset.into();
|
||||
|
||||
Self {
|
||||
surface: Handle::new(self.surface.translate(offset)),
|
||||
surface: self.surface.translate(offset),
|
||||
vertices: self
|
||||
.vertices
|
||||
.iter()
|
||||
|
Loading…
Reference in New Issue
Block a user