mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-06 07:15:55 +00:00
Remove GlobalCurve
reference from GlobalEdge
This commit is contained in:
parent
2e8320699b
commit
abfc679374
@ -2,7 +2,7 @@ use fj_math::Vector;
|
||||
|
||||
use crate::{
|
||||
insert::Insert,
|
||||
objects::{GlobalCurve, GlobalEdge, GlobalVertex, Objects},
|
||||
objects::{GlobalEdge, GlobalVertex, Objects},
|
||||
services::Service,
|
||||
storage::Handle,
|
||||
};
|
||||
@ -18,8 +18,6 @@ impl Sweep for Handle<GlobalVertex> {
|
||||
cache: &mut SweepCache,
|
||||
objects: &mut Service<Objects>,
|
||||
) -> Self::Swept {
|
||||
let curve = GlobalCurve.insert(objects);
|
||||
|
||||
let a = self.clone();
|
||||
let b = cache
|
||||
.global_vertex
|
||||
@ -30,8 +28,7 @@ impl Sweep for Handle<GlobalVertex> {
|
||||
.clone();
|
||||
|
||||
let vertices = [a, b];
|
||||
let global_edge =
|
||||
GlobalEdge::new(curve, vertices.clone()).insert(objects);
|
||||
let global_edge = GlobalEdge::new(vertices.clone()).insert(objects);
|
||||
|
||||
// The vertices of the returned `GlobalEdge` are in normalized order,
|
||||
// which means the order can't be relied upon by the caller. Return the
|
||||
|
@ -43,15 +43,11 @@ impl TransformObject for GlobalEdge {
|
||||
objects: &mut Service<Objects>,
|
||||
cache: &mut TransformCache,
|
||||
) -> Self {
|
||||
let curve = self
|
||||
.curve()
|
||||
.clone()
|
||||
.transform_with_cache(transform, objects, cache);
|
||||
let vertices =
|
||||
self.vertices().access_in_normalized_order().map(|vertex| {
|
||||
vertex.transform_with_cache(transform, objects, cache)
|
||||
});
|
||||
|
||||
Self::new(curve, vertices)
|
||||
Self::new(vertices)
|
||||
}
|
||||
}
|
||||
|
@ -223,9 +223,6 @@ impl HalfEdgeBuilder for PartialHalfEdge {
|
||||
other: &Partial<HalfEdge>,
|
||||
surface: &SurfaceGeometry,
|
||||
) {
|
||||
let global_curve = other.read().global_form.read().curve.clone();
|
||||
self.global_form.write().curve = global_curve;
|
||||
|
||||
self.curve.write().path =
|
||||
other.read().curve.read().path.as_ref().and_then(|path| {
|
||||
// We have information about the other edge's surface available.
|
||||
|
@ -2,8 +2,8 @@ use fj_interop::ext::ArrayExt;
|
||||
use fj_math::Point;
|
||||
|
||||
use crate::{
|
||||
objects::{Curve, GlobalCurve, GlobalVertex, SurfaceVertex},
|
||||
storage::{Handle, HandleWrapper},
|
||||
objects::{Curve, GlobalVertex, SurfaceVertex},
|
||||
storage::Handle,
|
||||
};
|
||||
|
||||
/// A directed edge, defined in a surface's 2D space
|
||||
@ -104,7 +104,6 @@ impl HalfEdge {
|
||||
/// between [`HalfEdge`] and `GlobalEdge`.
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
|
||||
pub struct GlobalEdge {
|
||||
curve: HandleWrapper<GlobalCurve>,
|
||||
vertices: VerticesInNormalizedOrder,
|
||||
}
|
||||
|
||||
@ -114,19 +113,10 @@ impl GlobalEdge {
|
||||
/// The order of `vertices` is irrelevant. Two `GlobalEdge`s with the same
|
||||
/// `curve` and `vertices` will end up being equal, regardless of the order
|
||||
/// of `vertices` here.
|
||||
pub fn new(
|
||||
curve: impl Into<HandleWrapper<GlobalCurve>>,
|
||||
vertices: [Handle<GlobalVertex>; 2],
|
||||
) -> Self {
|
||||
let curve = curve.into();
|
||||
pub fn new(vertices: [Handle<GlobalVertex>; 2]) -> Self {
|
||||
let (vertices, _) = VerticesInNormalizedOrder::new(vertices);
|
||||
|
||||
Self { curve, vertices }
|
||||
}
|
||||
|
||||
/// Access the curve that defines the edge's geometry
|
||||
pub fn curve(&self) -> &Handle<GlobalCurve> {
|
||||
&self.curve
|
||||
Self { vertices }
|
||||
}
|
||||
|
||||
/// Access the vertices that bound the edge on the curve
|
||||
|
@ -5,8 +5,7 @@ use fj_math::Point;
|
||||
|
||||
use crate::{
|
||||
objects::{
|
||||
Curve, GlobalCurve, GlobalEdge, GlobalVertex, HalfEdge, Objects,
|
||||
SurfaceVertex,
|
||||
Curve, GlobalEdge, GlobalVertex, HalfEdge, Objects, SurfaceVertex,
|
||||
},
|
||||
partial::{FullToPartialCache, Partial, PartialObject},
|
||||
services::Service,
|
||||
@ -84,7 +83,6 @@ impl Default for PartialHalfEdge {
|
||||
|
||||
let global_form = Partial::from_partial(PartialGlobalEdge {
|
||||
vertices: global_vertices,
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
Self {
|
||||
@ -98,9 +96,6 @@ impl Default for PartialHalfEdge {
|
||||
/// A partial [`GlobalEdge`]
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct PartialGlobalEdge {
|
||||
/// The curve that defines the edge's geometry
|
||||
pub curve: Partial<GlobalCurve>,
|
||||
|
||||
/// The vertices that bound the edge on the curve
|
||||
pub vertices: [Partial<GlobalVertex>; 2],
|
||||
}
|
||||
@ -113,7 +108,6 @@ impl PartialObject for PartialGlobalEdge {
|
||||
cache: &mut FullToPartialCache,
|
||||
) -> Self {
|
||||
Self {
|
||||
curve: Partial::from_full(global_edge.curve().clone(), cache),
|
||||
vertices: global_edge
|
||||
.vertices()
|
||||
.access_in_normalized_order()
|
||||
@ -122,9 +116,7 @@ impl PartialObject for PartialGlobalEdge {
|
||||
}
|
||||
|
||||
fn build(self, objects: &mut Service<Objects>) -> Self::Full {
|
||||
let curve = self.curve.build(objects);
|
||||
let vertices = self.vertices.map(|vertex| vertex.build(objects));
|
||||
|
||||
GlobalEdge::new(curve, vertices)
|
||||
GlobalEdge::new(vertices)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user