Prepare to support curved surfaces

This commit is contained in:
Hanno Braun 2025-02-28 20:50:20 +01:00
parent 9ba7e0873e
commit 7c05520554
2 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet};
use itertools::Itertools; use itertools::Itertools;
use crate::{ use crate::{
math::{Plane, Point}, math::Point,
object::Handle, object::Handle,
topology::{ topology::{
face::Face, half_edge::HalfEdge, surface::Surface, vertex::Vertex, face::Face, half_edge::HalfEdge, surface::Surface, vertex::Vertex,
@ -15,14 +15,14 @@ pub struct Sketch {
} }
impl Sketch { impl Sketch {
pub fn to_face(&self, surface: Plane) -> Face { pub fn to_face(&self, surface: Surface) -> Face {
let mut vertices_by_local_point: BTreeMap<_, Vec<_>> = BTreeMap::new(); let mut vertices_by_local_point: BTreeMap<_, Vec<_>> = BTreeMap::new();
let vertices = self let vertices = self
.points .points
.iter() .iter()
.copied() .copied()
.map(|point| { .map(|point| {
let point = surface.point_from_local(point); let point = surface.geometry.point_from_local(point);
let vertex = Handle::new(Vertex::new(point)); let vertex = Handle::new(Vertex::new(point));
vertices_by_local_point vertices_by_local_point
@ -50,7 +50,7 @@ impl Sketch {
}, },
); );
Face::new(Surface { geometry: surface }, half_edges, false) Face::new(surface, half_edges, false)
} }
} }

View File

@ -3,6 +3,7 @@ use crate::{
math::{Bivector, Plane, Point, Vector}, math::{Bivector, Plane, Point, Vector},
object::{Handle, HandleAny}, object::{Handle, HandleAny},
operations::sweep::SweepExt, operations::sweep::SweepExt,
topology::surface::Surface,
}; };
pub fn model() -> HandleAny { pub fn model() -> HandleAny {
@ -33,7 +34,7 @@ pub fn model() -> HandleAny {
}, },
}; };
let face = sketch.to_face(surface); let face = sketch.to_face(Surface { geometry: surface });
Handle::new(face) Handle::new(face)
}; };