Remove path field from HalfEdgeGeom

This is a big milestone, as it means that all curve geometry is now
exclusively defined within `CurveGeom`.
This commit is contained in:
Hanno Braun 2024-06-19 21:42:52 +02:00
parent 082dd9f1a9
commit 72efa214aa
7 changed files with 6 additions and 77 deletions

View File

@ -203,7 +203,7 @@ mod tests {
let curve =
Curve::from_path_and_surface(path, surface.clone(), &mut core);
let boundary = CurveBoundary::from(boundary);
let half_edge = HalfEdgeGeom { path, boundary };
let half_edge = HalfEdgeGeom { boundary };
let tolerance = 1.;
let approx = (&curve, &half_edge, &surface)
@ -226,7 +226,7 @@ mod tests {
let curve =
Curve::from_path_and_surface(path, surface.clone(), &mut core);
let boundary = CurveBoundary::from(boundary);
let half_edge = HalfEdgeGeom { path, boundary };
let half_edge = HalfEdgeGeom { boundary };
let tolerance = 1.;
let approx = (&curve, &half_edge, &surface)
@ -248,7 +248,7 @@ mod tests {
let curve =
Curve::from_path_and_surface(path, surface.clone(), &mut core);
let boundary = CurveBoundary::from([[0.], [TAU]]);
let half_edge = HalfEdgeGeom { path, boundary };
let half_edge = HalfEdgeGeom { boundary };
let tolerance = 1.;
let approx = (&curve, &half_edge, &surface)
@ -279,7 +279,7 @@ mod tests {
let curve =
Curve::from_path_and_surface(path, surface.clone(), &mut core);
let boundary = CurveBoundary::from([[0.], [TAU]]);
let half_edge = HalfEdgeGeom { path, boundary };
let half_edge = HalfEdgeGeom { boundary };
let tolerance = 1.;
let approx = (&curve, &half_edge, &surface)

View File

@ -5,33 +5,6 @@ use super::{CurveBoundary, SurfacePath};
/// The geometry of a half-edge
#[derive(Copy, Clone, Debug)]
pub struct HalfEdgeGeom {
/// # The path of the half-edge
///
/// ## Implementation Note
///
/// Currently, all curve-related geometry is defined locally, in terms of
/// the surface that the curve is on (or purely in 2D, if there is no
/// surface associated with this geometry). However, curves exist globally,
/// independently of surfaces. Half-edges in multiple surfaces can refer to
/// the same curve, and in fact, that is the whole reason for their
/// existence as a topological object.
///
/// This contradiction, globally defined curves but locally defined curve
/// geometry, is the reason that this curve geometry is defined right here,
/// associated with a locally existing half-edge. (And, I might add,
/// redundantly so, as multiple half-edges within the same surface context
/// can refer to the same curve.)
///
/// Instead, it should be possible to define curve geometry *either* locally
/// or globally. Then that respective definition can be associated with the
/// curve (and possibly, in addition, a surface). How exactly that is going
/// to work is up in the air.
///
/// The point of all this exposition is to clarify that this field doesn't
/// really belong here. It exists here for practical reasons that are,
/// hopefully, temporary.
pub path: SurfacePath,
/// # The boundary of the half-edge on its curve
pub boundary: CurveBoundary<Point<1>>,
}

View File

@ -73,7 +73,6 @@ pub trait BuildHalfEdge {
core.layers.geometry.define_half_edge(
half_edge.clone(),
HalfEdgeGeom {
path,
boundary: boundary.into(),
},
);
@ -100,14 +99,6 @@ pub trait BuildHalfEdge {
core.layers.geometry.define_half_edge(
half_edge.clone(),
HalfEdgeGeom {
path: core
.layers
.geometry
.of_curve(half_edge.curve())
.expect("Curve geometry was just defined in same function")
.local_on(&surface)
.expect("Curve geometry was just defined in same function")
.path,
boundary: boundary.unwrap_or_default(),
},
);

View File

@ -102,23 +102,7 @@ pub trait BuildShell {
.update_curve(|_, _| curve.clone(), core)
.insert(core)
.set_geometry(
HalfEdgeGeom {
path: core
.layers
.geometry
.of_curve(&curve)
.expect(
"Curve geometry was just \
defined in same function",
)
.local_on(&surface)
.expect(
"Curve geometry was just \
defined in same function",
)
.path,
boundary,
},
HalfEdgeGeom { boundary },
&mut core.layers.geometry,
)
})

View File

@ -17,7 +17,6 @@ impl ReverseCurveCoordinateSystems for (&Handle<HalfEdge>, &Handle<Surface>) {
let (half_edge, surface) = self;
let mut half_edge_geom = *core.layers.geometry.of_half_edge(half_edge);
half_edge_geom.path = half_edge_geom.path.reverse();
half_edge_geom.boundary = half_edge_geom.boundary.reverse();
let curve =

View File

@ -143,23 +143,7 @@ impl SweepHalfEdge for Handle<HalfEdge> {
.update_curve(|_, _| curve.clone(), core)
.insert(core)
.set_geometry(
HalfEdgeGeom {
path: core
.layers
.geometry
.of_curve(&curve)
.expect(
"Curve geometry was just defined in same \
function",
)
.local_on(&surface)
.expect(
"Curve geometry was just defined in same \
function",
)
.path,
boundary,
},
HalfEdgeGeom { boundary },
&mut core.layers.geometry,
);

View File

@ -212,8 +212,6 @@ mod tests {
.layers
.geometry
.of_half_edge(half_edge);
half_edge_geom.path =
half_edge_geom.path.reverse();
half_edge_geom.boundary =
half_edge_geom.boundary.reverse();