mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-06 02:48:27 +00:00
Add infrastructure for defining new curve geometry
This commit is contained in:
parent
9088ebb155
commit
d32cdd2ecf
@ -80,6 +80,14 @@ impl Geometry {
|
||||
.insert(surface, geometry);
|
||||
}
|
||||
|
||||
pub(crate) fn define_curve_inner_2(
|
||||
&mut self,
|
||||
curve: Handle<Curve>,
|
||||
geometry: CurveGeom2,
|
||||
) {
|
||||
self.curve2.insert(curve, geometry);
|
||||
}
|
||||
|
||||
pub(crate) fn define_surface_inner(
|
||||
&mut self,
|
||||
surface: Handle<Surface>,
|
||||
|
@ -1,7 +1,9 @@
|
||||
//! Layer infrastructure for [`Geometry`]
|
||||
|
||||
use crate::{
|
||||
geometry::{Geometry, LocalCurveGeom, LocalVertexGeom, SurfaceGeom},
|
||||
geometry::{
|
||||
CurveGeom2, Geometry, LocalCurveGeom, LocalVertexGeom, SurfaceGeom,
|
||||
},
|
||||
storage::Handle,
|
||||
topology::{Curve, Surface, Vertex},
|
||||
};
|
||||
@ -27,6 +29,23 @@ impl Layer<Geometry> {
|
||||
);
|
||||
}
|
||||
|
||||
/// # Define the geometry of the provided curve
|
||||
///
|
||||
/// ## Implementation Note
|
||||
///
|
||||
/// There currently is an ongoing transition to a new geometry system. This
|
||||
/// method defines new-style geometry. Its name is temporary, while the
|
||||
/// method defining the old-style geometry is still taking up the more
|
||||
/// concise name.
|
||||
pub fn define_curve_2(
|
||||
&mut self,
|
||||
curve: Handle<Curve>,
|
||||
geometry: CurveGeom2,
|
||||
) {
|
||||
let mut events = Vec::new();
|
||||
self.process(DefineCurve2 { curve, geometry }, &mut events);
|
||||
}
|
||||
|
||||
/// # Define the geometry of the provided surface
|
||||
///
|
||||
/// ## Panics
|
||||
@ -91,6 +110,40 @@ impl Event<Geometry> for DefineCurve {
|
||||
}
|
||||
}
|
||||
|
||||
/// # Define the geometry of a curve
|
||||
///
|
||||
/// ## Implementation Note
|
||||
///
|
||||
/// There currently is an ongoing transition to a new geometry representation.
|
||||
/// This type is involved in defining the new-style geometry. Its name is
|
||||
/// temporary, while the respective type that defines old-style geometry is
|
||||
/// still taking up the more compact name.
|
||||
pub struct DefineCurve2 {
|
||||
curve: Handle<Curve>,
|
||||
geometry: CurveGeom2,
|
||||
}
|
||||
|
||||
impl Command<Geometry> for DefineCurve2 {
|
||||
type Result = ();
|
||||
type Event = Self;
|
||||
|
||||
fn decide(
|
||||
self,
|
||||
_: &Geometry,
|
||||
events: &mut Vec<Self::Event>,
|
||||
) -> Self::Result {
|
||||
events.push(self);
|
||||
}
|
||||
}
|
||||
|
||||
impl Event<Geometry> for DefineCurve2 {
|
||||
fn evolve(&self, state: &mut Geometry) {
|
||||
// TASK: This can't work, as designed. I need to clone the geometry
|
||||
// here, but I can't just clone a `Box`.
|
||||
state.define_curve_inner_2(self.curve.clone(), self.geometry.clone());
|
||||
}
|
||||
}
|
||||
|
||||
/// Define the geometry of a surface
|
||||
pub struct DefineSurface {
|
||||
surface: Handle<Surface>,
|
||||
|
Loading…
Reference in New Issue
Block a user