Prepare to support curved surfaces

This commit is contained in:
Hanno Braun 2025-02-28 20:48:34 +01:00
parent 640c124c5f
commit 9ba7e0873e
5 changed files with 12 additions and 9 deletions

View File

@ -5,7 +5,9 @@ use itertools::Itertools;
use crate::{
math::{Plane, Point},
object::Handle,
topology::{face::Face, half_edge::HalfEdge, vertex::Vertex},
topology::{
face::Face, half_edge::HalfEdge, surface::Surface, vertex::Vertex,
},
};
pub struct Sketch {
@ -48,7 +50,7 @@ impl Sketch {
},
);
Face::new(surface, half_edges, false)
Face::new(Surface { geometry: surface }, half_edges, false)
}
}

View File

@ -1,7 +1,9 @@
use crate::{
math::Plane,
object::Handle,
topology::{face::Face, half_edge::HalfEdge, solid::Solid},
topology::{
face::Face, half_edge::HalfEdge, solid::Solid, surface::Surface,
},
};
pub trait ConnectExt {
@ -54,7 +56,7 @@ impl ConnectExt for Handle<Face> {
[&q.start, r, s].map(|vertex| vertex.point),
);
let face = Face::new(
surface,
Surface { geometry: surface },
[&q.start, r, s, &t.start].map(|vertex| {
Handle::new(HalfEdge {
start: vertex.clone(),

View File

@ -7,7 +7,7 @@ pub trait FlipExt {
impl FlipExt for Face {
fn flip(&self) -> Self {
Face::new(
self.surface.flip().geometry,
self.surface.flip(),
self.half_edges.clone(),
self.is_internal,
)

View File

@ -15,7 +15,7 @@ impl TranslateExt for Face {
let offset = offset.into();
Face::new(
self.surface.translate(offset).geometry,
self.surface.translate(offset),
self.half_edges
.iter()
.map(|half_edge| Handle::new(half_edge.translate(offset))),

View File

@ -5,7 +5,6 @@ use itertools::Itertools;
use crate::{
extra::triangulate::triangulate,
geometry::TriMesh,
math::Plane,
object::{Handle, HandleAny, Object},
};
@ -20,12 +19,12 @@ pub struct Face {
impl Face {
pub fn new(
surface: Plane,
surface: Surface,
half_edges: impl IntoIterator<Item = Handle<HalfEdge>>,
is_internal: bool,
) -> Self {
Self {
surface: Surface { geometry: surface },
surface,
half_edges: half_edges.into_iter().collect(),
is_internal,
}