From a53193ba627c850ab636cfd20a615d85be9169dd Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 11:42:39 +0200 Subject: [PATCH 01/97] Rename `HalfEdge` to `Edge` With `GlobalEdge` having been removed, it makes sense to simplify the name of the only remainging edge object. --- crates/fj-core/src/algorithms/approx/edge.rs | 16 +++++----- .../src/algorithms/bounding_volume/edge.rs | 4 +-- .../src/algorithms/intersect/curve_edge.rs | 29 +++++++------------ .../src/algorithms/intersect/face_point.rs | 4 +-- .../src/algorithms/intersect/ray_edge.rs | 4 +-- .../src/algorithms/intersect/ray_face.rs | 4 +-- crates/fj-core/src/algorithms/sweep/edge.rs | 8 ++--- .../fj-core/src/algorithms/transform/edge.rs | 4 +-- crates/fj-core/src/objects/kinds/curve.rs | 8 ++--- crates/fj-core/src/objects/kinds/cycle.rs | 18 ++++++------ crates/fj-core/src/objects/kinds/edge.rs | 4 +-- crates/fj-core/src/objects/kinds/face.rs | 6 ++-- crates/fj-core/src/objects/kinds/region.rs | 4 +-- crates/fj-core/src/objects/mod.rs | 2 +- crates/fj-core/src/objects/object.rs | 4 +-- crates/fj-core/src/objects/set.rs | 6 ++-- crates/fj-core/src/objects/stores.rs | 6 ++-- crates/fj-core/src/operations/build/cycle.rs | 7 ++--- crates/fj-core/src/operations/build/edge.rs | 22 +++++++------- crates/fj-core/src/operations/build/face.rs | 11 ++++--- .../src/operations/insert/insert_trait.rs | 5 ++-- crates/fj-core/src/operations/join/cycle.rs | 8 ++--- .../fj-core/src/operations/reverse/cycle.rs | 4 +-- crates/fj-core/src/operations/reverse/edge.rs | 6 ++-- crates/fj-core/src/operations/update/cycle.rs | 18 ++++++------ crates/fj-core/src/operations/update/edge.rs | 14 ++++----- .../src/queries/all_edges_with_surface.rs | 8 ++--- .../src/queries/bounding_vertices_of_edge.rs | 12 ++++---- crates/fj-core/src/validate/cycle.rs | 22 +++++--------- crates/fj-core/src/validate/edge.rs | 18 ++++++------ crates/fj-core/src/validate/shell.rs | 22 +++++++------- 31 files changed, 144 insertions(+), 164 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index 31eb62216..9065a7a2e 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -11,13 +11,13 @@ use fj_math::Point; use crate::{ geometry::{CurveBoundary, GlobalPath, SurfacePath}, - objects::{Curve, HalfEdge, Surface, Vertex}, + objects::{Curve, Edge, Surface, Vertex}, storage::{Handle, HandleWrapper}, }; use super::{curve::CurveApproxSegment, Approx, ApproxPoint, Tolerance}; -impl Approx for (&HalfEdge, &Surface) { +impl Approx for (&Edge, &Surface) { type Approximation = HalfEdgeApprox; type Cache = EdgeCache; @@ -115,7 +115,7 @@ impl Approx for (&HalfEdge, &Surface) { } } -/// An approximation of an [`HalfEdge`] +/// An approximation of an [`Edge`] #[derive(Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct HalfEdgeApprox { /// The point that approximates the first vertex of the edge @@ -287,7 +287,7 @@ mod tests { use crate::{ algorithms::approx::{Approx, ApproxPoint}, geometry::{CurveBoundary, GlobalPath, SurfaceGeometry}, - objects::{HalfEdge, Surface}, + objects::{Edge, Surface}, operations::BuildHalfEdge, services::Services, }; @@ -298,7 +298,7 @@ mod tests { let surface = services.objects.surfaces.xz_plane(); let half_edge = - HalfEdge::line_segment([[1., 1.], [2., 1.]], None, &mut services); + Edge::line_segment([[1., 1.], [2., 1.]], None, &mut services); let tolerance = 1.; let approx = (&half_edge, surface.deref()).approx(tolerance); @@ -315,7 +315,7 @@ mod tests { v: [0., 0., 1.].into(), }); let half_edge = - HalfEdge::line_segment([[1., 1.], [2., 1.]], None, &mut services); + Edge::line_segment([[1., 1.], [2., 1.]], None, &mut services); let tolerance = 1.; let approx = (&half_edge, &surface).approx(tolerance); @@ -334,7 +334,7 @@ mod tests { u: path, v: [0., 0., 1.].into(), }); - let half_edge = HalfEdge::line_segment( + let half_edge = Edge::line_segment( [[0., 1.], [TAU, 1.]], Some(boundary.inner), &mut services, @@ -362,7 +362,7 @@ mod tests { let mut services = Services::new(); let surface = services.objects.surfaces.xz_plane(); - let half_edge = HalfEdge::circle([0., 0.], 1., &mut services); + let half_edge = Edge::circle([0., 0.], 1., &mut services); let tolerance = 1.; let approx = (&half_edge, surface.deref()).approx(tolerance); diff --git a/crates/fj-core/src/algorithms/bounding_volume/edge.rs b/crates/fj-core/src/algorithms/bounding_volume/edge.rs index 50be621af..507f6040d 100644 --- a/crates/fj-core/src/algorithms/bounding_volume/edge.rs +++ b/crates/fj-core/src/algorithms/bounding_volume/edge.rs @@ -1,8 +1,8 @@ use fj_math::{Aabb, Vector}; -use crate::{geometry::SurfacePath, objects::HalfEdge}; +use crate::{geometry::SurfacePath, objects::Edge}; -impl super::BoundingVolume<2> for HalfEdge { +impl super::BoundingVolume<2> for Edge { fn aabb(&self) -> Option> { match self.path() { SurfacePath::Circle(circle) => { diff --git a/crates/fj-core/src/algorithms/intersect/curve_edge.rs b/crates/fj-core/src/algorithms/intersect/curve_edge.rs index 934b79fe9..9ea11b417 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_edge.rs @@ -1,10 +1,10 @@ use fj_math::{Point, Segment}; -use crate::{geometry::SurfacePath, objects::HalfEdge}; +use crate::{geometry::SurfacePath, objects::Edge}; use super::LineSegmentIntersection; -/// The intersection between a curve and a [`HalfEdge`] +/// The intersection between a curve and an [`Edge`] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub enum CurveEdgeIntersection { /// The curve and edge intersect at a point @@ -26,9 +26,8 @@ impl CurveEdgeIntersection { /// # Panics /// /// Currently, only intersections between lines and line segments can be - /// computed. Panics, if a different type of curve or [`HalfEdge`] is - /// passed. - pub fn compute(path: &SurfacePath, half_edge: &HalfEdge) -> Option { + /// computed. Panics, if a different type of curve or [`Edge`] is passed. + pub fn compute(path: &SurfacePath, half_edge: &Edge) -> Option { let path_as_line = match path { SurfacePath::Line(line) => line, _ => todo!("Curve-edge intersection only supports lines"), @@ -73,7 +72,7 @@ mod tests { use fj_math::Point; use crate::{ - geometry::SurfacePath, objects::HalfEdge, operations::BuildHalfEdge, + geometry::SurfacePath, objects::Edge, operations::BuildHalfEdge, services::Services, }; @@ -85,7 +84,7 @@ mod tests { let path = SurfacePath::u_axis(); let half_edge = - HalfEdge::line_segment([[1., -1.], [1., 1.]], None, &mut services); + Edge::line_segment([[1., -1.], [1., 1.]], None, &mut services); let intersection = CurveEdgeIntersection::compute(&path, &half_edge); @@ -102,11 +101,8 @@ mod tests { let mut services = Services::new(); let path = SurfacePath::u_axis(); - let half_edge = HalfEdge::line_segment( - [[-1., -1.], [-1., 1.]], - None, - &mut services, - ); + let half_edge = + Edge::line_segment([[-1., -1.], [-1., 1.]], None, &mut services); let intersection = CurveEdgeIntersection::compute(&path, &half_edge); @@ -123,11 +119,8 @@ mod tests { let mut services = Services::new(); let path = SurfacePath::u_axis(); - let half_edge = HalfEdge::line_segment( - [[-1., -1.], [1., -1.]], - None, - &mut services, - ); + let half_edge = + Edge::line_segment([[-1., -1.], [1., -1.]], None, &mut services); let intersection = CurveEdgeIntersection::compute(&path, &half_edge); @@ -140,7 +133,7 @@ mod tests { let path = SurfacePath::u_axis(); let half_edge = - HalfEdge::line_segment([[-1., 0.], [1., 0.]], None, &mut services); + Edge::line_segment([[-1., 0.], [1., 0.]], None, &mut services); let intersection = CurveEdgeIntersection::compute(&path, &half_edge); diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index b18e48fbf..5c9ed4080 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -3,7 +3,7 @@ use fj_math::Point; use crate::{ - objects::{Face, HalfEdge}, + objects::{Edge, Face}, storage::Handle, }; @@ -122,7 +122,7 @@ pub enum FacePointIntersection { PointIsInsideFace, /// The point is coincident with an edge - PointIsOnEdge(Handle), + PointIsOnEdge(Handle), /// The point is coincident with a vertex PointIsOnVertex(Point<2>), diff --git a/crates/fj-core/src/algorithms/intersect/ray_edge.rs b/crates/fj-core/src/algorithms/intersect/ray_edge.rs index dab988e9d..2e8679b5c 100644 --- a/crates/fj-core/src/algorithms/intersect/ray_edge.rs +++ b/crates/fj-core/src/algorithms/intersect/ray_edge.rs @@ -5,13 +5,13 @@ use fj_math::Segment; use crate::{ algorithms::intersect::{HorizontalRayToTheRight, Intersect}, geometry::SurfacePath, - objects::HalfEdge, + objects::Edge, storage::Handle, }; use super::ray_segment::RaySegmentIntersection; -impl Intersect for (&HorizontalRayToTheRight<2>, &Handle) { +impl Intersect for (&HorizontalRayToTheRight<2>, &Handle) { type Intersection = RaySegmentIntersection; fn intersect(self) -> Option { diff --git a/crates/fj-core/src/algorithms/intersect/ray_face.rs b/crates/fj-core/src/algorithms/intersect/ray_face.rs index dcfcdb358..d984cbfcd 100644 --- a/crates/fj-core/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-core/src/algorithms/intersect/ray_face.rs @@ -5,7 +5,7 @@ use fj_math::{Plane, Point, Scalar}; use crate::{ algorithms::intersect::face_point::FacePointIntersection, geometry::GlobalPath, - objects::{Face, HalfEdge}, + objects::{Edge, Face}, storage::Handle, }; @@ -134,7 +134,7 @@ pub enum RayFaceIntersection { RayHitsFaceAndAreParallel, /// The ray hits an edge - RayHitsEdge(Handle), + RayHitsEdge(Handle), /// The ray hits a vertex RayHitsVertex(Point<2>), diff --git a/crates/fj-core/src/algorithms/sweep/edge.rs b/crates/fj-core/src/algorithms/sweep/edge.rs index f1a10d35a..c5d6a2ad3 100644 --- a/crates/fj-core/src/algorithms/sweep/edge.rs +++ b/crates/fj-core/src/algorithms/sweep/edge.rs @@ -2,7 +2,7 @@ use fj_interop::{ext::ArrayExt, mesh::Color}; use fj_math::{Point, Scalar, Vector}; use crate::{ - objects::{Cycle, Face, HalfEdge, Region, Surface, Vertex}, + objects::{Cycle, Edge, Face, Region, Surface, Vertex}, operations::{BuildHalfEdge, Insert, UpdateCycle, UpdateHalfEdge}, services::Services, storage::Handle, @@ -10,8 +10,8 @@ use crate::{ use super::{Sweep, SweepCache}; -impl Sweep for (&HalfEdge, &Handle, &Surface, Option) { - type Swept = (Handle, Handle); +impl Sweep for (&Edge, &Handle, &Surface, Option) { + type Swept = (Handle, Handle); fn sweep_with_cache( self, @@ -81,7 +81,7 @@ impl Sweep for (&HalfEdge, &Handle, &Surface, Option) { .zip_ext(curves) .map(|((((boundary, start), end), start_vertex), curve)| { let half_edge = { - let half_edge = HalfEdge::line_segment( + let half_edge = Edge::line_segment( [start, end], Some(boundary), services, diff --git a/crates/fj-core/src/algorithms/transform/edge.rs b/crates/fj-core/src/algorithms/transform/edge.rs index 11526bff0..b6c0b93e0 100644 --- a/crates/fj-core/src/algorithms/transform/edge.rs +++ b/crates/fj-core/src/algorithms/transform/edge.rs @@ -1,10 +1,10 @@ use fj_math::Transform; -use crate::{objects::HalfEdge, services::Services}; +use crate::{objects::Edge, services::Services}; use super::{TransformCache, TransformObject}; -impl TransformObject for HalfEdge { +impl TransformObject for Edge { fn transform_with_cache( self, transform: &Transform, diff --git a/crates/fj-core/src/objects/kinds/curve.rs b/crates/fj-core/src/objects/kinds/curve.rs index f68676e32..73e314e87 100644 --- a/crates/fj-core/src/objects/kinds/curve.rs +++ b/crates/fj-core/src/objects/kinds/curve.rs @@ -1,10 +1,10 @@ /// A curve /// /// `Curve` represents a curve in space, but holds no data to define that curve. -/// It is referenced by [`HalfEdge`], which defines the curve in the coordinates -/// of its surface. +/// It is referenced by [`Edge`], which defines the curve in the coordinates of +/// its surface. /// -/// `Curve` exists to allow identifying which [`HalfEdge`]s are supposed to be +/// `Curve` exists to allow identifying which [`Edge`]s are supposed to be /// coincident in global space. /// /// # Equality @@ -20,7 +20,7 @@ /// `Eq`/`Ord`/..., you can use `HandleWrapper` to do that. It will use /// `Handle::id` to provide those `Eq`/`Ord`/... implementations. /// -/// [`HalfEdge`]: crate::objects::HalfEdge +/// [`Edge`]: crate::objects::Edge #[derive(Clone, Debug, Default, Hash)] pub struct Curve {} diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 5c16028ec..3e85902c9 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -3,17 +3,17 @@ use std::slice; use fj_math::{Scalar, Winding}; use itertools::Itertools; -use crate::{geometry::SurfacePath, objects::HalfEdge, storage::Handle}; +use crate::{geometry::SurfacePath, objects::Edge, storage::Handle}; /// A cycle of connected half-edges #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Cycle { - half_edges: Vec>, + half_edges: Vec>, } impl Cycle { /// Create an instance of `Cycle` - pub fn new(half_edges: impl IntoIterator>) -> Self { + pub fn new(half_edges: impl IntoIterator>) -> Self { let half_edges = half_edges.into_iter().collect::>(); Self { half_edges } } @@ -26,12 +26,12 @@ impl Cycle { /// Access the half-edges in pairs pub fn half_edge_pairs( &self, - ) -> impl Iterator, &Handle)> { + ) -> impl Iterator, &Handle)> { self.half_edges.iter().circular_tuple_windows() } /// Access the half-edge with the provided index - pub fn nth_half_edge(&self, index: usize) -> Option<&Handle> { + pub fn nth_half_edge(&self, index: usize) -> Option<&Handle> { self.half_edges.get(index) } @@ -40,8 +40,8 @@ impl Cycle { /// Returns `None`, if the provided `HalfEdge` is not part of the cycle. pub fn half_edge_after( &self, - half_edge: &Handle, - ) -> Option<&Handle> { + half_edge: &Handle, + ) -> Option<&Handle> { self.index_of(half_edge).map(|index| { let next_index = (index + 1) % self.half_edges.len(); &self.half_edges[next_index] @@ -49,7 +49,7 @@ impl Cycle { } /// Return the index of the provided half-edge, if it is in this cycle - pub fn index_of(&self, half_edge: &Handle) -> Option { + pub fn index_of(&self, half_edge: &Handle) -> Option { self.half_edges .iter() .position(|edge| edge.id() == half_edge.id()) @@ -124,4 +124,4 @@ impl Cycle { /// An iterator over the half-edges of a [`Cycle`] /// /// Returned by [`Cycle::half_edges`]. -pub type HalfEdgesOfCycle<'a> = slice::Iter<'a, Handle>; +pub type HalfEdgesOfCycle<'a> = slice::Iter<'a, Handle>; diff --git a/crates/fj-core/src/objects/kinds/edge.rs b/crates/fj-core/src/objects/kinds/edge.rs index 321d6c210..5a2637f38 100644 --- a/crates/fj-core/src/objects/kinds/edge.rs +++ b/crates/fj-core/src/objects/kinds/edge.rs @@ -30,14 +30,14 @@ use crate::{ /// being lifted: /// #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] -pub struct HalfEdge { +pub struct Edge { path: SurfacePath, boundary: CurveBoundary>, curve: HandleWrapper, start_vertex: HandleWrapper, } -impl HalfEdge { +impl Edge { /// Create an instance of `HalfEdge` pub fn new( path: SurfacePath, diff --git a/crates/fj-core/src/objects/kinds/face.rs b/crates/fj-core/src/objects/kinds/face.rs index 45006d283..1a8df0b72 100644 --- a/crates/fj-core/src/objects/kinds/face.rs +++ b/crates/fj-core/src/objects/kinds/face.rs @@ -26,10 +26,10 @@ use crate::{ /// /// Interior cycles must have the opposite winding of the exterior cycle, /// meaning on the front side of the face, they must appear clockwise. This -/// means that all [`HalfEdge`]s that bound a `Face` have the interior of the -/// face on their left side (on the face's front side). +/// means that all [`Edge`]s that bound a `Face` have the interior of the face +/// on their left side (on the face's front side). /// -/// [`HalfEdge`]: crate::objects::HalfEdge +/// [`Edge`]: crate::objects::Edge /// [`Shell`]: crate::objects::Shell #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Face { diff --git a/crates/fj-core/src/objects/kinds/region.rs b/crates/fj-core/src/objects/kinds/region.rs index 1235c20b7..f39b8072f 100644 --- a/crates/fj-core/src/objects/kinds/region.rs +++ b/crates/fj-core/src/objects/kinds/region.rs @@ -7,10 +7,10 @@ use crate::{objects::Cycle, storage::Handle}; /// /// Interior cycles must have the opposite winding of the exterior cycle, /// meaning on the front side of the region, they must appear clockwise. This -/// means that all [`HalfEdge`]s that bound a `Region` have the interior of the +/// means that all [`Edge`]s that bound a `Region` have the interior of the /// region on their left side (on the region's front side). /// -/// [`HalfEdge`]: crate::objects::HalfEdge +/// [`Edge`]: crate::objects::Edge #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Region { exterior: Handle, diff --git a/crates/fj-core/src/objects/mod.rs b/crates/fj-core/src/objects/mod.rs index e14dab884..774565815 100644 --- a/crates/fj-core/src/objects/mod.rs +++ b/crates/fj-core/src/objects/mod.rs @@ -48,7 +48,7 @@ pub use self::{ kinds::{ curve::Curve, cycle::{Cycle, HalfEdgesOfCycle}, - edge::HalfEdge, + edge::Edge, face::{Face, FaceSet, Handedness}, region::Region, shell::Shell, diff --git a/crates/fj-core/src/objects/object.rs b/crates/fj-core/src/objects/object.rs index 3cddf3f7a..49702886b 100644 --- a/crates/fj-core/src/objects/object.rs +++ b/crates/fj-core/src/objects/object.rs @@ -1,6 +1,6 @@ use crate::{ objects::{ - Curve, Cycle, Face, HalfEdge, Objects, Region, Shell, Sketch, Solid, + Curve, Cycle, Edge, Face, Objects, Region, Shell, Sketch, Solid, Surface, Vertex, }, storage::{Handle, HandleWrapper, ObjectId}, @@ -94,7 +94,7 @@ object!( Curve, "curve", curves; Cycle, "cycle", cycles; Face, "face", faces; - HalfEdge, "half-edge", half_edges; + Edge, "half-edge", half_edges; Region, "region", regions; Shell, "shell", shells; Sketch, "sketch", sketches; diff --git a/crates/fj-core/src/objects/set.rs b/crates/fj-core/src/objects/set.rs index 8eebffc49..98ecafc5f 100644 --- a/crates/fj-core/src/objects/set.rs +++ b/crates/fj-core/src/objects/set.rs @@ -1,8 +1,6 @@ use std::collections::{btree_set, BTreeSet}; -use super::{ - BehindHandle, Curve, Cycle, Face, HalfEdge, Object, Surface, Vertex, -}; +use super::{BehindHandle, Curve, Cycle, Edge, Face, Object, Surface, Vertex}; /// A graph of objects and their relationships pub struct ObjectSet { @@ -89,7 +87,7 @@ impl InsertIntoSet for Face { } } -impl InsertIntoSet for HalfEdge { +impl InsertIntoSet for Edge { fn insert_into_set(&self, objects: &mut ObjectSet) { objects.inner.insert(self.curve().clone().into()); self.curve().insert_into_set(objects); diff --git a/crates/fj-core/src/objects/stores.rs b/crates/fj-core/src/objects/stores.rs index c9811c6a3..51f4df0c2 100644 --- a/crates/fj-core/src/objects/stores.rs +++ b/crates/fj-core/src/objects/stores.rs @@ -6,7 +6,7 @@ use crate::{ }; use super::{ - Curve, Cycle, Face, HalfEdge, Region, Shell, Sketch, Solid, Surface, Vertex, + Curve, Cycle, Edge, Face, Region, Shell, Sketch, Solid, Surface, Vertex, }; /// The available object stores @@ -21,8 +21,8 @@ pub struct Objects { /// Store for [`Face`]s pub faces: Store, - /// Store for [`HalfEdge`]s - pub half_edges: Store, + /// Store for [`Edge`]s + pub half_edges: Store, /// Store for [`Region`]s pub regions: Store, diff --git a/crates/fj-core/src/operations/build/cycle.rs b/crates/fj-core/src/operations/build/cycle.rs index 9533ef2ef..601175d82 100644 --- a/crates/fj-core/src/operations/build/cycle.rs +++ b/crates/fj-core/src/operations/build/cycle.rs @@ -2,7 +2,7 @@ use fj_math::{Point, Scalar}; use itertools::Itertools; use crate::{ - objects::{Cycle, HalfEdge}, + objects::{Cycle, Edge}, operations::{BuildHalfEdge, Insert, UpdateCycle}, services::Services, }; @@ -20,8 +20,7 @@ pub trait BuildCycle { radius: impl Into, services: &mut Services, ) -> Cycle { - let circle = - HalfEdge::circle(center, radius, services).insert(services); + let circle = Edge::circle(center, radius, services).insert(services); Cycle::empty().add_half_edges([circle]) } @@ -37,7 +36,7 @@ pub trait BuildCycle { .map(Into::into) .circular_tuple_windows() .map(|(start, end)| { - HalfEdge::line_segment([start, end], None, services) + Edge::line_segment([start, end], None, services) .insert(services) }); diff --git a/crates/fj-core/src/operations/build/edge.rs b/crates/fj-core/src/operations/build/edge.rs index e017d78ae..9bdf9ab83 100644 --- a/crates/fj-core/src/operations/build/edge.rs +++ b/crates/fj-core/src/operations/build/edge.rs @@ -3,23 +3,23 @@ use fj_math::{Arc, Point, Scalar}; use crate::{ geometry::{CurveBoundary, SurfacePath}, - objects::{Curve, HalfEdge, Vertex}, + objects::{Curve, Edge, Vertex}, operations::Insert, services::Services, }; -/// Build a [`HalfEdge`] +/// Build an [`Edge`] pub trait BuildHalfEdge { /// Create a half-edge that is not joined to another fn unjoined( path: SurfacePath, boundary: impl Into>>, services: &mut Services, - ) -> HalfEdge { + ) -> Edge { let curve = Curve::new().insert(services); let start_vertex = Vertex::new().insert(services); - HalfEdge::new(path, boundary, curve, start_vertex) + Edge::new(path, boundary, curve, start_vertex) } /// Create an arc @@ -32,7 +32,7 @@ pub trait BuildHalfEdge { end: impl Into>, angle_rad: impl Into, services: &mut Services, - ) -> HalfEdge { + ) -> Edge { let angle_rad = angle_rad.into(); if angle_rad <= -Scalar::TAU || angle_rad >= Scalar::TAU { panic!("arc angle must be in the range (-2pi, 2pi) radians"); @@ -45,7 +45,7 @@ pub trait BuildHalfEdge { let boundary = [arc.start_angle, arc.end_angle].map(|coord| Point::from([coord])); - HalfEdge::unjoined(path, boundary, services) + Edge::unjoined(path, boundary, services) } /// Create a circle @@ -53,12 +53,12 @@ pub trait BuildHalfEdge { center: impl Into>, radius: impl Into, services: &mut Services, - ) -> HalfEdge { + ) -> Edge { let path = SurfacePath::circle_from_center_and_radius(center, radius); let boundary = [Scalar::ZERO, Scalar::TAU].map(|coord| Point::from([coord])); - HalfEdge::unjoined(path, boundary, services) + Edge::unjoined(path, boundary, services) } /// Create a line segment @@ -66,15 +66,15 @@ pub trait BuildHalfEdge { points_surface: [impl Into>; 2], boundary: Option<[Point<1>; 2]>, services: &mut Services, - ) -> HalfEdge { + ) -> Edge { let boundary = boundary.unwrap_or_else(|| [[0.], [1.]].map(Point::from)); let path = SurfacePath::line_from_points_with_coords( boundary.zip_ext(points_surface), ); - HalfEdge::unjoined(path, boundary, services) + Edge::unjoined(path, boundary, services) } } -impl BuildHalfEdge for HalfEdge {} +impl BuildHalfEdge for Edge {} diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index 495000e73..c298e1992 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -4,7 +4,7 @@ use fj_interop::ext::ArrayExt; use fj_math::Point; use crate::{ - objects::{Cycle, Face, HalfEdge, Region, Surface, Vertex}, + objects::{Cycle, Edge, Face, Region, Surface, Vertex}, operations::{ BuildCycle, BuildRegion, BuildSurface, Insert, IsInserted, IsInsertedNo, }, @@ -40,10 +40,9 @@ pub trait BuildFace { .expect("Just asserted that there are three half-edges") }) }; - let vertices = - edges.each_ref_ext().map(|half_edge: &Handle| { - half_edge.start_vertex().clone() - }); + let vertices = edges + .each_ref_ext() + .map(|half_edge: &Handle| half_edge.start_vertex().clone()); Polygon { face, @@ -82,7 +81,7 @@ pub struct Polygon { pub face: I::T, /// The edges of the polygon - pub edges: [Handle; D], + pub edges: [Handle; D], /// The vertices of the polygon pub vertices: [Handle; D], diff --git a/crates/fj-core/src/operations/insert/insert_trait.rs b/crates/fj-core/src/operations/insert/insert_trait.rs index efa60ea9e..dc83965b8 100644 --- a/crates/fj-core/src/operations/insert/insert_trait.rs +++ b/crates/fj-core/src/operations/insert/insert_trait.rs @@ -1,7 +1,6 @@ use crate::{ objects::{ - Curve, Cycle, Face, HalfEdge, Region, Shell, Sketch, Solid, Surface, - Vertex, + Curve, Cycle, Edge, Face, Region, Shell, Sketch, Solid, Surface, Vertex, }, operations::{Polygon, TetrahedronShell}, services::Services, @@ -47,7 +46,7 @@ impl_insert!( Curve, curves; Cycle, cycles; Face, faces; - HalfEdge, half_edges; + Edge, half_edges; Region, regions; Shell, shells; Sketch, sketches; diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index af83d8306..88043b611 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -5,7 +5,7 @@ use itertools::Itertools; use crate::{ geometry::{CurveBoundary, SurfacePath}, - objects::{Cycle, HalfEdge}, + objects::{Cycle, Edge}, operations::{BuildHalfEdge, Insert, UpdateCycle, UpdateHalfEdge}, services::Services, storage::Handle, @@ -18,7 +18,7 @@ pub trait JoinCycle { fn add_joined_edges(&self, edges: Es, services: &mut Services) -> Self where Es: IntoIterator< - Item = (Handle, SurfacePath, CurveBoundary>), + Item = (Handle, SurfacePath, CurveBoundary>), >, Es::IntoIter: Clone + ExactSizeIterator; @@ -77,13 +77,13 @@ impl JoinCycle for Cycle { fn add_joined_edges(&self, edges: Es, services: &mut Services) -> Self where Es: IntoIterator< - Item = (Handle, SurfacePath, CurveBoundary>), + Item = (Handle, SurfacePath, CurveBoundary>), >, Es::IntoIter: Clone + ExactSizeIterator, { self.add_half_edges(edges.into_iter().circular_tuple_windows().map( |((prev, _, _), (half_edge, curve, boundary))| { - HalfEdge::unjoined(curve, boundary, services) + Edge::unjoined(curve, boundary, services) .replace_curve(half_edge.curve().clone()) .replace_start_vertex(prev.start_vertex().clone()) .insert(services) diff --git a/crates/fj-core/src/operations/reverse/cycle.rs b/crates/fj-core/src/operations/reverse/cycle.rs index 32421c724..5d4920c95 100644 --- a/crates/fj-core/src/operations/reverse/cycle.rs +++ b/crates/fj-core/src/operations/reverse/cycle.rs @@ -1,5 +1,5 @@ use crate::{ - objects::{Cycle, HalfEdge}, + objects::{Cycle, Edge}, operations::Insert, services::Services, }; @@ -11,7 +11,7 @@ impl Reverse for Cycle { let mut edges = self .half_edge_pairs() .map(|(current, next)| { - HalfEdge::new( + Edge::new( current.path(), current.boundary().reverse(), current.curve().clone(), diff --git a/crates/fj-core/src/operations/reverse/edge.rs b/crates/fj-core/src/operations/reverse/edge.rs index 3820d0422..4079289e5 100644 --- a/crates/fj-core/src/operations/reverse/edge.rs +++ b/crates/fj-core/src/operations/reverse/edge.rs @@ -1,13 +1,13 @@ -use crate::{objects::HalfEdge, services::Services}; +use crate::{objects::Edge, services::Services}; use super::ReverseCurveCoordinateSystems; -impl ReverseCurveCoordinateSystems for HalfEdge { +impl ReverseCurveCoordinateSystems for Edge { fn reverse_curve_coordinate_systems(&self, _: &mut Services) -> Self { let path = self.path().reverse(); let boundary = self.boundary().reverse(); - HalfEdge::new( + Edge::new( path, boundary, self.curve().clone(), diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 93682dd1a..b46012147 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -1,5 +1,5 @@ use crate::{ - objects::{Cycle, HalfEdge}, + objects::{Cycle, Edge}, storage::Handle, }; @@ -9,7 +9,7 @@ pub trait UpdateCycle { #[must_use] fn add_half_edges( &self, - half_edges: impl IntoIterator>, + half_edges: impl IntoIterator>, ) -> Self; /// Replace the provided half-edge @@ -20,8 +20,8 @@ pub trait UpdateCycle { #[must_use] fn replace_half_edge( &self, - original: &Handle, - replacement: Handle, + original: &Handle, + replacement: Handle, ) -> Self; /// Update the half-edge at the given index @@ -33,14 +33,14 @@ pub trait UpdateCycle { fn update_nth_half_edge( &self, index: usize, - f: impl FnMut(&Handle) -> Handle, + f: impl FnMut(&Handle) -> Handle, ) -> Self; } impl UpdateCycle for Cycle { fn add_half_edges( &self, - half_edges: impl IntoIterator>, + half_edges: impl IntoIterator>, ) -> Self { let half_edges = self.half_edges().cloned().chain(half_edges); Cycle::new(half_edges) @@ -48,8 +48,8 @@ impl UpdateCycle for Cycle { fn replace_half_edge( &self, - original: &Handle, - replacement: Handle, + original: &Handle, + replacement: Handle, ) -> Self { let mut num_replacements = 0; @@ -75,7 +75,7 @@ impl UpdateCycle for Cycle { fn update_nth_half_edge( &self, index: usize, - mut f: impl FnMut(&Handle) -> Handle, + mut f: impl FnMut(&Handle) -> Handle, ) -> Self { let mut num_replacements = 0; diff --git a/crates/fj-core/src/operations/update/edge.rs b/crates/fj-core/src/operations/update/edge.rs index 48c12fe68..41ad4252e 100644 --- a/crates/fj-core/src/operations/update/edge.rs +++ b/crates/fj-core/src/operations/update/edge.rs @@ -2,11 +2,11 @@ use fj_math::Point; use crate::{ geometry::{CurveBoundary, SurfacePath}, - objects::{Curve, HalfEdge, Vertex}, + objects::{Curve, Edge, Vertex}, storage::Handle, }; -/// Update a [`HalfEdge`] +/// Update a [`Edge`] pub trait UpdateHalfEdge { /// Replace the path of the half-edge #[must_use] @@ -25,9 +25,9 @@ pub trait UpdateHalfEdge { fn replace_start_vertex(&self, start_vertex: Handle) -> Self; } -impl UpdateHalfEdge for HalfEdge { +impl UpdateHalfEdge for Edge { fn replace_path(&self, path: SurfacePath) -> Self { - HalfEdge::new( + Edge::new( path, self.boundary(), self.curve().clone(), @@ -36,7 +36,7 @@ impl UpdateHalfEdge for HalfEdge { } fn replace_boundary(&self, boundary: CurveBoundary>) -> Self { - HalfEdge::new( + Edge::new( self.path(), boundary, self.curve().clone(), @@ -45,7 +45,7 @@ impl UpdateHalfEdge for HalfEdge { } fn replace_curve(&self, curve: Handle) -> Self { - HalfEdge::new( + Edge::new( self.path(), self.boundary(), curve, @@ -54,7 +54,7 @@ impl UpdateHalfEdge for HalfEdge { } fn replace_start_vertex(&self, start_vertex: Handle) -> Self { - HalfEdge::new( + Edge::new( self.path(), self.boundary(), self.curve().clone(), diff --git a/crates/fj-core/src/queries/all_edges_with_surface.rs b/crates/fj-core/src/queries/all_edges_with_surface.rs index ad6e012c0..b1aeaa07e 100644 --- a/crates/fj-core/src/queries/all_edges_with_surface.rs +++ b/crates/fj-core/src/queries/all_edges_with_surface.rs @@ -1,5 +1,5 @@ use crate::{ - objects::{Face, HalfEdge, Shell, Surface}, + objects::{Edge, Face, Shell, Surface}, storage::Handle, }; @@ -8,14 +8,14 @@ pub trait AllEdgesWithSurface { /// Access all edges referenced by the object and the surface they're on fn all_edges_with_surface( &self, - result: &mut Vec<(Handle, Handle)>, + result: &mut Vec<(Handle, Handle)>, ); } impl AllEdgesWithSurface for Face { fn all_edges_with_surface( &self, - result: &mut Vec<(Handle, Handle)>, + result: &mut Vec<(Handle, Handle)>, ) { for cycle in self.region().all_cycles() { result.extend( @@ -31,7 +31,7 @@ impl AllEdgesWithSurface for Face { impl AllEdgesWithSurface for Shell { fn all_edges_with_surface( &self, - result: &mut Vec<(Handle, Handle)>, + result: &mut Vec<(Handle, Handle)>, ) { for face in self.faces() { face.all_edges_with_surface(result); diff --git a/crates/fj-core/src/queries/bounding_vertices_of_edge.rs b/crates/fj-core/src/queries/bounding_vertices_of_edge.rs index 4c1be23eb..569c0a614 100644 --- a/crates/fj-core/src/queries/bounding_vertices_of_edge.rs +++ b/crates/fj-core/src/queries/bounding_vertices_of_edge.rs @@ -1,6 +1,6 @@ use crate::{ geometry::CurveBoundary, - objects::{Cycle, Face, HalfEdge, Region, Shell, Vertex}, + objects::{Cycle, Edge, Face, Region, Shell, Vertex}, storage::Handle, }; @@ -12,14 +12,14 @@ pub trait BoundingVerticesOfEdge { /// method is called on. fn bounding_vertices_of_edge( &self, - edge: &Handle, + edge: &Handle, ) -> Option>; } impl BoundingVerticesOfEdge for Cycle { fn bounding_vertices_of_edge( &self, - edge: &Handle, + edge: &Handle, ) -> Option> { let start = edge.start_vertex().clone(); let end = self.half_edge_after(edge)?.start_vertex().clone(); @@ -31,7 +31,7 @@ impl BoundingVerticesOfEdge for Cycle { impl BoundingVerticesOfEdge for Region { fn bounding_vertices_of_edge( &self, - edge: &Handle, + edge: &Handle, ) -> Option> { for cycle in self.all_cycles() { if let Some(vertices) = cycle.bounding_vertices_of_edge(edge) { @@ -46,7 +46,7 @@ impl BoundingVerticesOfEdge for Region { impl BoundingVerticesOfEdge for Face { fn bounding_vertices_of_edge( &self, - edge: &Handle, + edge: &Handle, ) -> Option> { self.region().bounding_vertices_of_edge(edge) } @@ -55,7 +55,7 @@ impl BoundingVerticesOfEdge for Face { impl BoundingVerticesOfEdge for Shell { fn bounding_vertices_of_edge( &self, - edge: &Handle, + edge: &Handle, ) -> Option> { for face in self.faces() { if let Some(vertices) = face.bounding_vertices_of_edge(edge) { diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index a837c8843..2d1c2d369 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -1,6 +1,6 @@ use fj_math::{Point, Scalar}; -use crate::objects::{Cycle, HalfEdge}; +use crate::objects::{Cycle, Edge}; use super::{Validate, ValidationConfig, ValidationError}; @@ -28,17 +28,17 @@ pub enum CycleValidationError { - `HalfEdge`s: {half_edges:#?}" )] HalfEdgesDisconnected { - /// The end position of the first [`HalfEdge`] + /// The end position of the first [`Edge`] end_of_first: Point<2>, - /// The start position of the second [`HalfEdge`] + /// The start position of the second [`Edge`] start_of_second: Point<2>, /// The distance between the two vertices distance: Scalar, /// The half-edge - half_edges: Box<(HalfEdge, HalfEdge)>, + half_edges: Box<(Edge, Edge)>, }, /// [`Cycle`]'s should have at least one `HalfEdge` @@ -95,7 +95,7 @@ mod tests { use crate::{ assert_contains_err, - objects::{Cycle, HalfEdge}, + objects::{Cycle, Edge}, operations::{BuildCycle, BuildHalfEdge, Insert, UpdateCycle}, services::Services, validate::{cycle::CycleValidationError, Validate, ValidationError}, @@ -112,16 +112,8 @@ mod tests { let disconnected = { let half_edges = [ - HalfEdge::line_segment( - [[0., 0.], [1., 0.]], - None, - &mut services, - ), - HalfEdge::line_segment( - [[0., 0.], [1., 0.]], - None, - &mut services, - ), + Edge::line_segment([[0., 0.], [1., 0.]], None, &mut services), + Edge::line_segment([[0., 0.], [1., 0.]], None, &mut services), ]; let half_edges = half_edges.map(|half_edge| half_edge.insert(&mut services)); diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index 9ec705368..f6eba0c15 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -1,10 +1,10 @@ use fj_math::{Point, Scalar}; -use crate::objects::HalfEdge; +use crate::objects::Edge; use super::{Validate, ValidationConfig, ValidationError}; -impl Validate for HalfEdge { +impl Validate for Edge { fn validate_with_config( &self, config: &ValidationConfig, @@ -14,10 +14,10 @@ impl Validate for HalfEdge { } } -/// [`HalfEdge`] validation failed +/// [`Edge`] validation failed #[derive(Clone, Debug, thiserror::Error)] pub enum HalfEdgeValidationError { - /// [`HalfEdge`]'s vertices are coincident + /// [`Edge`]'s vertices are coincident #[error( "Vertices of `HalfEdge` on curve are coincident\n\ - Position of back vertex: {back_position:?}\n\ @@ -35,13 +35,13 @@ pub enum HalfEdgeValidationError { distance: Scalar, /// The half-edge - half_edge: HalfEdge, + half_edge: Edge, }, } impl HalfEdgeValidationError { fn check_vertex_coincidence( - half_edge: &HalfEdge, + half_edge: &Edge, config: &ValidationConfig, errors: &mut Vec, ) { @@ -68,7 +68,7 @@ mod tests { use crate::{ assert_contains_err, - objects::HalfEdge, + objects::Edge, operations::BuildHalfEdge, services::Services, validate::{HalfEdgeValidationError, Validate, ValidationError}, @@ -79,11 +79,11 @@ mod tests { let mut services = Services::new(); let valid = - HalfEdge::line_segment([[0., 0.], [1., 0.]], None, &mut services); + Edge::line_segment([[0., 0.], [1., 0.]], None, &mut services); let invalid = { let boundary = [Point::from([0.]); 2]; - HalfEdge::new( + Edge::new( valid.path(), boundary, valid.curve().clone(), diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index e9635e45e..b2603ee46 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -4,7 +4,7 @@ use fj_math::{Point, Scalar}; use crate::{ geometry::SurfaceGeometry, - objects::{HalfEdge, Shell, Surface}, + objects::{Edge, Shell, Surface}, queries::{AllEdgesWithSurface, BoundingVerticesOfEdge}, storage::{Handle, HandleWrapper}, }; @@ -47,7 +47,7 @@ pub enum ShellValidationError { Edge 1: {0:#?}\n\ Edge 2: {1:#?}" )] - CoincidentEdgesNotIdentical(Handle, Handle), + CoincidentEdgesNotIdentical(Handle, Handle), /// [`Shell`] contains half-edges that are identical, but do not coincide #[error( @@ -59,13 +59,13 @@ pub enum ShellValidationError { )] IdenticalEdgesNotCoincident { /// The first edge - edge_a: Handle, + edge_a: Handle, /// The surface that the first edge is on surface_a: Handle, /// The second edge - edge_b: Handle, + edge_b: Handle, /// The surface that the second edge is on surface_b: Handle, @@ -80,14 +80,14 @@ pub enum ShellValidationError { /// /// Returns an [`Iterator`] of the distance at each sample. fn distances( - edge_a: Handle, + edge_a: Handle, surface_a: Handle, - edge_b: Handle, + edge_b: Handle, surface_b: Handle, ) -> impl Iterator { fn sample( percent: f64, - (edge, surface): (&Handle, SurfaceGeometry), + (edge, surface): (&Handle, SurfaceGeometry), ) -> Point<3> { let [start, end] = edge.boundary().inner; let path_coords = start + (end - start) * percent; @@ -133,9 +133,9 @@ impl ShellValidationError { } fn compare_curve_coords( - edge_a: &Handle, + edge_a: &Handle, surface_a: &Handle, - edge_b: &Handle, + edge_b: &Handle, surface_b: &Handle, config: &ValidationConfig, mismatches: &mut Vec, @@ -365,8 +365,8 @@ impl ShellValidationError { #[derive(Clone, Debug)] pub struct CurveCoordinateSystemMismatch { - pub edge_a: Handle, - pub edge_b: Handle, + pub edge_a: Handle, + pub edge_b: Handle, pub point_curve: Point<1>, pub point_a: Point<3>, pub point_b: Point<3>, From 79bb93e4a7b664ca201461200fafd664ce3ca8d4 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:18:03 +0200 Subject: [PATCH 02/97] Update comment --- crates/fj-core/src/algorithms/approx/edge.rs | 31 ++++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index 9065a7a2e..424729721 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -43,33 +43,32 @@ impl Approx for (&Edge, &Surface) { let first = ApproxPoint::new(position_surface, position_global); let points = { - // We cache approximated `HalfEdge`s using the `Curve`s they - // reference and their boundary on that curve as the key. That bakes - // in the undesirable assumption that all coincident `HalfEdge`s are - // also congruent. Let me explain. + // We cache approximated `Edge`s using the `Curve`s they reference + // and their boundary on that curve as the key. That bakes in the + // undesirable assumption that all coincident `Edge`s are also + // congruent. Let me explain. // - // When two `HalfEdge`s are coincident, we need to make sure their + // When two `Edge`s are coincident, we need to make sure their // approximations are identical where they overlap. Otherwise, we'll // get an invalid triangle mesh in the end. Hence, we cache // approximations. // // Caching works like this: We check whether there already is a // cache entry for the curve/boundary. If there isn't, we create the - // 3D approximation from the 2D `HalfEdge`. Next time we check for a - // coincident `HalfEdge`, we'll find the cache and use that, getting + // 3D approximation from the 2D `Edge`. Next time we check for a + // coincident `Edge`, we'll find the cache and use that, getting // the exact same 3D approximation, instead of generating a slightly - // different one from the different 2D `HalfEdge`. + // different one from the different 2D `Edge`. // - // So what if we had two coincident `HalfEdge`s that aren't - // congruent? Meaning, they overlap partially, but not fully. Then - // obviously, they wouldn't refer to the same combination of curve - // and boundary. And since those are the key in our cache, those - // `HalfEdge`s would not share an approximation where they overlap, - // leading to exactly the problems that the cache is supposed to - // prevent. + // So what if we had two coincident `fEdge`s that aren't congruent? + // Meaning, they overlap partially, but not fully. Then obviously, + // they wouldn't refer to the same combination of curve and + // boundary. And since those are the key in our cache, those `Edge`s + // would not share an approximation where they overlap, leading to + // exactly the problems that the cache is supposed to prevent. // // As of this writing, it is a documented (but not validated) - // limitation, that coincident `HalfEdge`s must always be congruent. + // limitation, that coincident `Edge`s must always be congruent. // However, we're going to need to lift this limitation going // forward, as it is, well, too limiting. This means things here // will need to change. From f70a2b027afde08c928bcc859cd9a16478e23ed6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:19:34 +0200 Subject: [PATCH 03/97] Rename `HalfEdgeApprox` to `EdgeApprox` --- crates/fj-core/src/algorithms/approx/cycle.rs | 4 ++-- crates/fj-core/src/algorithms/approx/edge.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/cycle.rs b/crates/fj-core/src/algorithms/approx/cycle.rs index 5297f0225..03b3b3659 100644 --- a/crates/fj-core/src/algorithms/approx/cycle.rs +++ b/crates/fj-core/src/algorithms/approx/cycle.rs @@ -9,7 +9,7 @@ use fj_math::Segment; use crate::objects::{Cycle, Surface}; use super::{ - edge::{EdgeCache, HalfEdgeApprox}, + edge::{EdgeApprox, EdgeCache}, Approx, ApproxPoint, Tolerance, }; @@ -40,7 +40,7 @@ impl Approx for (&Cycle, &Surface) { #[derive(Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct CycleApprox { /// The approximated edges that make up the approximated cycle - pub half_edges: Vec, + pub half_edges: Vec, } impl CycleApprox { diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index 424729721..a63164a31 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -18,7 +18,7 @@ use crate::{ use super::{curve::CurveApproxSegment, Approx, ApproxPoint, Tolerance}; impl Approx for (&Edge, &Surface) { - type Approximation = HalfEdgeApprox; + type Approximation = EdgeApprox; type Cache = EdgeCache; fn approx_with_cache( @@ -110,13 +110,13 @@ impl Approx for (&Edge, &Surface) { .collect() }; - HalfEdgeApprox { first, points } + EdgeApprox { first, points } } } /// An approximation of an [`Edge`] #[derive(Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] -pub struct HalfEdgeApprox { +pub struct EdgeApprox { /// The point that approximates the first vertex of the edge pub first: ApproxPoint<2>, @@ -124,7 +124,7 @@ pub struct HalfEdgeApprox { pub points: Vec>, } -impl HalfEdgeApprox { +impl EdgeApprox { /// Compute the points that approximate the edge pub fn points(&self) -> Vec> { let mut points = Vec::new(); From 5251f2026dc9c608ef6d274b4b27e35590f0163d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:20:33 +0200 Subject: [PATCH 04/97] Update panic message --- crates/fj-core/src/algorithms/bounding_volume/cycle.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/algorithms/bounding_volume/cycle.rs b/crates/fj-core/src/algorithms/bounding_volume/cycle.rs index c598668f8..385fbd9bf 100644 --- a/crates/fj-core/src/algorithms/bounding_volume/cycle.rs +++ b/crates/fj-core/src/algorithms/bounding_volume/cycle.rs @@ -7,9 +7,8 @@ impl super::BoundingVolume<2> for Cycle { let mut aabb: Option> = None; for half_edge in self.half_edges() { - let new_aabb = half_edge - .aabb() - .expect("`HalfEdge` can always compute AABB"); + let new_aabb = + half_edge.aabb().expect("`Edge` can always compute AABB"); aabb = Some(aabb.map_or(new_aabb, |aabb| aabb.merged(&new_aabb))); } From 70598b14bea988884f7cd6ced89a238a2b0dd3c2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:21:22 +0200 Subject: [PATCH 05/97] Update doc comment --- crates/fj-core/src/objects/kinds/cycle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 3e85902c9..e7e26aa67 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -37,7 +37,7 @@ impl Cycle { /// Access the half-edge after the provided one /// - /// Returns `None`, if the provided `HalfEdge` is not part of the cycle. + /// Returns `None`, if the provided [`Edge`] is not part of the cycle. pub fn half_edge_after( &self, half_edge: &Handle, From 748233bdd94d82e00fedbad44738acd322115a0f Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:24:17 +0200 Subject: [PATCH 06/97] Refactor to not rely on iterator being cloneable --- crates/fj-core/src/operations/build/face.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index c298e1992..fd8aeea6c 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -33,12 +33,16 @@ pub trait BuildFace { let edges = { let mut half_edges = face.region().exterior().half_edges().cloned(); - assert_eq!(half_edges.clone().count(), 3); - array::from_fn(|_| half_edges.next()).map(|half_edge| { - half_edge - .expect("Just asserted that there are three half-edges") - }) + let array = + array::from_fn(|_| half_edges.next()).map(|half_edge| { + half_edge + .expect("Just asserted that there are three half-edges") + }); + + assert!(half_edges.next().is_none()); + + array }; let vertices = edges .each_ref_ext() From 79e6f99c689ef9e06683f5a29acd188016914fb3 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:25:41 +0200 Subject: [PATCH 07/97] Remove `HalfEdgesOfCycle` --- crates/fj-core/src/objects/kinds/cycle.rs | 9 +-------- crates/fj-core/src/objects/mod.rs | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index e7e26aa67..1689ff47c 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -1,5 +1,3 @@ -use std::slice; - use fj_math::{Scalar, Winding}; use itertools::Itertools; @@ -19,7 +17,7 @@ impl Cycle { } /// Access the half-edges that make up the cycle - pub fn half_edges(&self) -> HalfEdgesOfCycle { + pub fn half_edges(&self) -> impl Iterator> { self.half_edges.iter() } @@ -120,8 +118,3 @@ impl Cycle { unreachable!("Encountered invalid cycle: {self:#?}"); } } - -/// An iterator over the half-edges of a [`Cycle`] -/// -/// Returned by [`Cycle::half_edges`]. -pub type HalfEdgesOfCycle<'a> = slice::Iter<'a, Handle>; diff --git a/crates/fj-core/src/objects/mod.rs b/crates/fj-core/src/objects/mod.rs index 774565815..8beedc65b 100644 --- a/crates/fj-core/src/objects/mod.rs +++ b/crates/fj-core/src/objects/mod.rs @@ -47,7 +47,7 @@ mod stores; pub use self::{ kinds::{ curve::Curve, - cycle::{Cycle, HalfEdgesOfCycle}, + cycle::Cycle, edge::Edge, face::{Face, FaceSet, Handedness}, region::Region, From b5eac358a642b47b0d96e62be6d7e748df7352c5 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:27:40 +0200 Subject: [PATCH 08/97] Update documentation of `Edge` --- crates/fj-core/src/objects/kinds/edge.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/edge.rs b/crates/fj-core/src/objects/kinds/edge.rs index 5a2637f38..d565b09bf 100644 --- a/crates/fj-core/src/objects/kinds/edge.rs +++ b/crates/fj-core/src/objects/kinds/edge.rs @@ -9,24 +9,24 @@ use crate::{ /// A directed edge, defined in a surface's 2D space /// /// When multiple faces, which are bound by edges, are combined to form a solid, -/// the `HalfEdge`s that bound the face on the surface are then coincident with -/// the `HalfEdge`s of other faces, where those faces touch. Those coincident -/// `HalfEdge`s are different representations of the same edge, and this fact -/// must be represented in the following way: +/// the `Edge`s that bound the face on the surface are then coincident with the +/// `Edge`s of other faces, where those faces touch. Those coincident `Edge`s +/// are different representations of the same edge, and this fact must be +/// represented in the following way: /// -/// - The coincident `HalfEdge`s must refer to the same `Curve`. -/// - The coincident `HalfEdge`s must have the same boundary. +/// - The coincident `Edge`s must refer to the same `Curve`. +/// - The coincident `Edge`s must have the same boundary. /// /// There is another, implicit requirement hidden here: /// -/// `HalfEdge`s that are coincident, i.e. located in the same space, must always -/// be congruent. This means they must coincide *exactly*. The overlap must be -/// complete. None of the coincident `HalfEdge`s must overlap with just a -/// section of another. +/// `Edge`s that are coincident, i.e. located in the same space, must always be +/// congruent. This means they must coincide *exactly*. The overlap must be +/// complete. None of the coincident `Edge`s must overlap with just a section of +/// another. /// /// # Implementation Note /// -/// The limitation that coincident `HalfEdge`s must be congruent is currently +/// The limitation that coincident `Edge`s must be congruent is currently /// being lifted: /// #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] @@ -38,7 +38,7 @@ pub struct Edge { } impl Edge { - /// Create an instance of `HalfEdge` + /// Create an instance of `Edge` pub fn new( path: SurfacePath, boundary: impl Into>>, From dbf7f994278d2e2db93f3e2424b82f19c0c12885 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:28:01 +0200 Subject: [PATCH 09/97] Update comment --- crates/fj-core/src/objects/kinds/edge.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/objects/kinds/edge.rs b/crates/fj-core/src/objects/kinds/edge.rs index d565b09bf..1dc01d19e 100644 --- a/crates/fj-core/src/objects/kinds/edge.rs +++ b/crates/fj-core/src/objects/kinds/edge.rs @@ -66,7 +66,7 @@ impl Edge { /// Compute the surface position where the half-edge starts pub fn start_position(&self) -> Point<2> { // Computing the surface position from the curve position is fine. - // `HalfEdge` "owns" its start position. There is no competing code that + // `Edge` "owns" its start position. There is no competing code that // could compute the surface position from slightly different data. let [start, _] = self.boundary.inner; From c47ee5dcc31141cc00a387e48c8d2a8d2aa99ca9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:29:36 +0200 Subject: [PATCH 10/97] Update struct field name --- crates/fj-core/src/objects/object.rs | 2 +- crates/fj-core/src/objects/stores.rs | 2 +- crates/fj-core/src/operations/insert/insert_trait.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/objects/object.rs b/crates/fj-core/src/objects/object.rs index 49702886b..be9e86553 100644 --- a/crates/fj-core/src/objects/object.rs +++ b/crates/fj-core/src/objects/object.rs @@ -94,7 +94,7 @@ object!( Curve, "curve", curves; Cycle, "cycle", cycles; Face, "face", faces; - Edge, "half-edge", half_edges; + Edge, "half-edge", edges; Region, "region", regions; Shell, "shell", shells; Sketch, "sketch", sketches; diff --git a/crates/fj-core/src/objects/stores.rs b/crates/fj-core/src/objects/stores.rs index 51f4df0c2..850f1e0dd 100644 --- a/crates/fj-core/src/objects/stores.rs +++ b/crates/fj-core/src/objects/stores.rs @@ -22,7 +22,7 @@ pub struct Objects { pub faces: Store, /// Store for [`Edge`]s - pub half_edges: Store, + pub edges: Store, /// Store for [`Region`]s pub regions: Store, diff --git a/crates/fj-core/src/operations/insert/insert_trait.rs b/crates/fj-core/src/operations/insert/insert_trait.rs index dc83965b8..bf1d0a40a 100644 --- a/crates/fj-core/src/operations/insert/insert_trait.rs +++ b/crates/fj-core/src/operations/insert/insert_trait.rs @@ -46,7 +46,7 @@ impl_insert!( Curve, curves; Cycle, cycles; Face, faces; - Edge, half_edges; + Edge, edges; Region, regions; Shell, shells; Sketch, sketches; From ccf92a920542db9da862f184ef9a4a6d4ae14c7c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:30:01 +0200 Subject: [PATCH 11/97] Refactor to restore alphabetical ordering --- crates/fj-core/src/objects/stores.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/objects/stores.rs b/crates/fj-core/src/objects/stores.rs index 850f1e0dd..00796bb72 100644 --- a/crates/fj-core/src/objects/stores.rs +++ b/crates/fj-core/src/objects/stores.rs @@ -18,12 +18,12 @@ pub struct Objects { /// Store for [`Cycle`]s pub cycles: Store, - /// Store for [`Face`]s - pub faces: Store, - /// Store for [`Edge`]s pub edges: Store, + /// Store for [`Face`]s + pub faces: Store, + /// Store for [`Region`]s pub regions: Store, From 179a8a88d76eda842df4d2024a3769df06104481 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:31:35 +0200 Subject: [PATCH 12/97] Rename `BuildHalfEdge` to `BuildEdge` --- crates/fj-core/src/algorithms/approx/edge.rs | 2 +- crates/fj-core/src/algorithms/intersect/curve_edge.rs | 2 +- crates/fj-core/src/algorithms/sweep/edge.rs | 2 +- crates/fj-core/src/operations/build/cycle.rs | 2 +- crates/fj-core/src/operations/build/edge.rs | 4 ++-- crates/fj-core/src/operations/join/cycle.rs | 2 +- crates/fj-core/src/operations/mod.rs | 2 +- crates/fj-core/src/validate/cycle.rs | 2 +- crates/fj-core/src/validate/edge.rs | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index a63164a31..df43c43fc 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -287,7 +287,7 @@ mod tests { algorithms::approx::{Approx, ApproxPoint}, geometry::{CurveBoundary, GlobalPath, SurfaceGeometry}, objects::{Edge, Surface}, - operations::BuildHalfEdge, + operations::BuildEdge, services::Services, }; diff --git a/crates/fj-core/src/algorithms/intersect/curve_edge.rs b/crates/fj-core/src/algorithms/intersect/curve_edge.rs index 9ea11b417..86cac2425 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_edge.rs @@ -72,7 +72,7 @@ mod tests { use fj_math::Point; use crate::{ - geometry::SurfacePath, objects::Edge, operations::BuildHalfEdge, + geometry::SurfacePath, objects::Edge, operations::BuildEdge, services::Services, }; diff --git a/crates/fj-core/src/algorithms/sweep/edge.rs b/crates/fj-core/src/algorithms/sweep/edge.rs index c5d6a2ad3..ff2bc893a 100644 --- a/crates/fj-core/src/algorithms/sweep/edge.rs +++ b/crates/fj-core/src/algorithms/sweep/edge.rs @@ -3,7 +3,7 @@ use fj_math::{Point, Scalar, Vector}; use crate::{ objects::{Cycle, Edge, Face, Region, Surface, Vertex}, - operations::{BuildHalfEdge, Insert, UpdateCycle, UpdateHalfEdge}, + operations::{BuildEdge, Insert, UpdateCycle, UpdateHalfEdge}, services::Services, storage::Handle, }; diff --git a/crates/fj-core/src/operations/build/cycle.rs b/crates/fj-core/src/operations/build/cycle.rs index 601175d82..bcf3742de 100644 --- a/crates/fj-core/src/operations/build/cycle.rs +++ b/crates/fj-core/src/operations/build/cycle.rs @@ -3,7 +3,7 @@ use itertools::Itertools; use crate::{ objects::{Cycle, Edge}, - operations::{BuildHalfEdge, Insert, UpdateCycle}, + operations::{BuildEdge, Insert, UpdateCycle}, services::Services, }; diff --git a/crates/fj-core/src/operations/build/edge.rs b/crates/fj-core/src/operations/build/edge.rs index 9bdf9ab83..82b6e12d1 100644 --- a/crates/fj-core/src/operations/build/edge.rs +++ b/crates/fj-core/src/operations/build/edge.rs @@ -9,7 +9,7 @@ use crate::{ }; /// Build an [`Edge`] -pub trait BuildHalfEdge { +pub trait BuildEdge { /// Create a half-edge that is not joined to another fn unjoined( path: SurfacePath, @@ -77,4 +77,4 @@ pub trait BuildHalfEdge { } } -impl BuildHalfEdge for Edge {} +impl BuildEdge for Edge {} diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 88043b611..87d25e1ad 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -6,7 +6,7 @@ use itertools::Itertools; use crate::{ geometry::{CurveBoundary, SurfacePath}, objects::{Cycle, Edge}, - operations::{BuildHalfEdge, Insert, UpdateCycle, UpdateHalfEdge}, + operations::{BuildEdge, Insert, UpdateCycle, UpdateHalfEdge}, services::Services, storage::Handle, }; diff --git a/crates/fj-core/src/operations/mod.rs b/crates/fj-core/src/operations/mod.rs index 3cd87865a..29ca1ae74 100644 --- a/crates/fj-core/src/operations/mod.rs +++ b/crates/fj-core/src/operations/mod.rs @@ -10,7 +10,7 @@ mod update; pub use self::{ build::{ cycle::BuildCycle, - edge::BuildHalfEdge, + edge::BuildEdge, face::{BuildFace, Polygon}, region::BuildRegion, shell::{BuildShell, TetrahedronShell}, diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 2d1c2d369..ac8a00d13 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -96,7 +96,7 @@ mod tests { use crate::{ assert_contains_err, objects::{Cycle, Edge}, - operations::{BuildCycle, BuildHalfEdge, Insert, UpdateCycle}, + operations::{BuildCycle, BuildEdge, Insert, UpdateCycle}, services::Services, validate::{cycle::CycleValidationError, Validate, ValidationError}, }; diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index f6eba0c15..16e306dd1 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -69,7 +69,7 @@ mod tests { use crate::{ assert_contains_err, objects::Edge, - operations::BuildHalfEdge, + operations::BuildEdge, services::Services, validate::{HalfEdgeValidationError, Validate, ValidationError}, }; From 03cfc0ad9046867ab9e6f1af3148b2b748a2ad7a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:32:47 +0200 Subject: [PATCH 13/97] Rename `UpdateHalfEdge` to `UpdateEdge` --- crates/fj-core/src/algorithms/sweep/edge.rs | 2 +- crates/fj-core/src/operations/join/cycle.rs | 2 +- crates/fj-core/src/operations/mod.rs | 2 +- crates/fj-core/src/operations/update/edge.rs | 4 ++-- crates/fj-core/src/validate/shell.rs | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/fj-core/src/algorithms/sweep/edge.rs b/crates/fj-core/src/algorithms/sweep/edge.rs index ff2bc893a..2f9537f1f 100644 --- a/crates/fj-core/src/algorithms/sweep/edge.rs +++ b/crates/fj-core/src/algorithms/sweep/edge.rs @@ -3,7 +3,7 @@ use fj_math::{Point, Scalar, Vector}; use crate::{ objects::{Cycle, Edge, Face, Region, Surface, Vertex}, - operations::{BuildEdge, Insert, UpdateCycle, UpdateHalfEdge}, + operations::{BuildEdge, Insert, UpdateCycle, UpdateEdge}, services::Services, storage::Handle, }; diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 87d25e1ad..7df8e03c7 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -6,7 +6,7 @@ use itertools::Itertools; use crate::{ geometry::{CurveBoundary, SurfacePath}, objects::{Cycle, Edge}, - operations::{BuildEdge, Insert, UpdateCycle, UpdateHalfEdge}, + operations::{BuildEdge, Insert, UpdateCycle, UpdateEdge}, services::Services, storage::Handle, }; diff --git a/crates/fj-core/src/operations/mod.rs b/crates/fj-core/src/operations/mod.rs index 29ca1ae74..c9b7b1bd5 100644 --- a/crates/fj-core/src/operations/mod.rs +++ b/crates/fj-core/src/operations/mod.rs @@ -23,7 +23,7 @@ pub use self::{ merge::Merge, reverse::Reverse, update::{ - cycle::UpdateCycle, edge::UpdateHalfEdge, face::UpdateFace, + cycle::UpdateCycle, edge::UpdateEdge, face::UpdateFace, region::UpdateRegion, shell::UpdateShell, sketch::UpdateSketch, solid::UpdateSolid, }, diff --git a/crates/fj-core/src/operations/update/edge.rs b/crates/fj-core/src/operations/update/edge.rs index 41ad4252e..42ac10a32 100644 --- a/crates/fj-core/src/operations/update/edge.rs +++ b/crates/fj-core/src/operations/update/edge.rs @@ -7,7 +7,7 @@ use crate::{ }; /// Update a [`Edge`] -pub trait UpdateHalfEdge { +pub trait UpdateEdge { /// Replace the path of the half-edge #[must_use] fn replace_path(&self, path: SurfacePath) -> Self; @@ -25,7 +25,7 @@ pub trait UpdateHalfEdge { fn replace_start_vertex(&self, start_vertex: Handle) -> Self; } -impl UpdateHalfEdge for Edge { +impl UpdateEdge for Edge { fn replace_path(&self, path: SurfacePath) -> Self { Edge::new( path, diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index b2603ee46..165abb69b 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -379,8 +379,8 @@ mod tests { assert_contains_err, objects::{Curve, Shell}, operations::{ - BuildShell, Insert, Reverse, UpdateCycle, UpdateFace, - UpdateHalfEdge, UpdateRegion, UpdateShell, + BuildShell, Insert, Reverse, UpdateCycle, UpdateEdge, UpdateFace, + UpdateRegion, UpdateShell, }, services::Services, validate::{shell::ShellValidationError, Validate, ValidationError}, From a8f44ec07fc7a52138dfe19a120592546a532e1e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:33:24 +0200 Subject: [PATCH 14/97] Update doc comment --- crates/fj-core/src/queries/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/queries/mod.rs b/crates/fj-core/src/queries/mod.rs index b8ffcc6cb..06f064a3f 100644 --- a/crates/fj-core/src/queries/mod.rs +++ b/crates/fj-core/src/queries/mod.rs @@ -3,8 +3,8 @@ //! Objects have methods that provide access to anything that the object itself //! has direct access to. However, not all potentially interesting information //! can be accessed that way. An example are the bounding vertices of an edge: -//! `HalfEdge` only stores its starting vertex, so you need a `Cycle` to get -//! both vertices. +//! `Edge` only stores its starting vertex, so you need a `Cycle` to get both +//! vertices. //! //! This module provides traits express such non-trivial queries, and implements //! them for various objects that have the information to answer the query. From 288674bd4128947dd047a6f2a376c3e1cfcf182b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:34:03 +0200 Subject: [PATCH 15/97] Update error messages --- crates/fj-core/src/validate/cycle.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index ac8a00d13..179ab4819 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -22,10 +22,10 @@ impl Validate for Cycle { pub enum CycleValidationError { /// [`Cycle`]'s half-edges are not connected #[error( - "Adjacent `HalfEdge`s are distinct\n\ - - End position of first `HalfEdge`: {end_of_first:?}\n\ - - Start position of second `HalfEdge`: {start_of_second:?}\n\ - - `HalfEdge`s: {half_edges:#?}" + "Adjacent `Edge`s are distinct\n\ + - End position of first `Edge`: {end_of_first:?}\n\ + - Start position of second `Edge`: {start_of_second:?}\n\ + - `Edge`s: {half_edges:#?}" )] HalfEdgesDisconnected { /// The end position of the first [`Edge`] @@ -42,7 +42,7 @@ pub enum CycleValidationError { }, /// [`Cycle`]'s should have at least one `HalfEdge` - #[error("Expected at least one `HalfEdge`\n")] + #[error("Expected at least one `Edge`\n")] NotEnoughHalfEdges, } From 85dcc9817cad8bc6a3f7bd0305310afe27c9a346 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:35:06 +0200 Subject: [PATCH 16/97] Update validation error name --- crates/fj-core/src/validate/cycle.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 179ab4819..5c2e5b064 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -27,7 +27,7 @@ pub enum CycleValidationError { - Start position of second `Edge`: {start_of_second:?}\n\ - `Edge`s: {half_edges:#?}" )] - HalfEdgesDisconnected { + EdgesDisconnected { /// The end position of the first [`Edge`] end_of_first: Point<2>, @@ -74,7 +74,7 @@ impl CycleValidationError { if distance > config.identical_max_distance { errors.push( - Self::HalfEdgesDisconnected { + Self::EdgesDisconnected { end_of_first, start_of_second, distance, @@ -124,7 +124,7 @@ mod tests { assert_contains_err!( disconnected, ValidationError::Cycle( - CycleValidationError::HalfEdgesDisconnected { .. } + CycleValidationError::EdgesDisconnected { .. } ) ); From b83eeb7680ff0ce13459c3dee6c8a4b5c0bb880b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:35:38 +0200 Subject: [PATCH 17/97] Update doc comment --- crates/fj-core/src/validate/cycle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 5c2e5b064..e28efa1e5 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -41,7 +41,7 @@ pub enum CycleValidationError { half_edges: Box<(Edge, Edge)>, }, - /// [`Cycle`]'s should have at least one `HalfEdge` + /// [`Cycle`]'s should have at least one [`Edge`] #[error("Expected at least one `Edge`\n")] NotEnoughHalfEdges, } From fcbbac78ea9cb9b95e137723b5db77bc5ec97572 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:35:57 +0200 Subject: [PATCH 18/97] Update validation error name --- crates/fj-core/src/validate/cycle.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index e28efa1e5..97bdc2cd7 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -43,7 +43,7 @@ pub enum CycleValidationError { /// [`Cycle`]'s should have at least one [`Edge`] #[error("Expected at least one `Edge`\n")] - NotEnoughHalfEdges, + NotEnoughEdges, } impl CycleValidationError { @@ -54,7 +54,7 @@ impl CycleValidationError { ) { // If there are no half edges if cycle.half_edges().next().is_none() { - errors.push(Self::NotEnoughHalfEdges.into()); + errors.push(Self::NotEnoughEdges.into()); } } @@ -131,7 +131,7 @@ mod tests { let empty = Cycle::new([]); assert_contains_err!( empty, - ValidationError::Cycle(CycleValidationError::NotEnoughHalfEdges) + ValidationError::Cycle(CycleValidationError::NotEnoughEdges) ); Ok(()) } From 3d57918be4a478530951b10d3ee0f4f024950dbd Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:36:55 +0200 Subject: [PATCH 19/97] Rename `HalfEdgeValidationError` --- crates/fj-core/src/validate/edge.rs | 10 +++++----- crates/fj-core/src/validate/mod.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index 16e306dd1..7b759543e 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -10,13 +10,13 @@ impl Validate for Edge { config: &ValidationConfig, errors: &mut Vec, ) { - HalfEdgeValidationError::check_vertex_coincidence(self, config, errors); + EdgeValidationError::check_vertex_coincidence(self, config, errors); } } /// [`Edge`] validation failed #[derive(Clone, Debug, thiserror::Error)] -pub enum HalfEdgeValidationError { +pub enum EdgeValidationError { /// [`Edge`]'s vertices are coincident #[error( "Vertices of `HalfEdge` on curve are coincident\n\ @@ -39,7 +39,7 @@ pub enum HalfEdgeValidationError { }, } -impl HalfEdgeValidationError { +impl EdgeValidationError { fn check_vertex_coincidence( half_edge: &Edge, config: &ValidationConfig, @@ -71,7 +71,7 @@ mod tests { objects::Edge, operations::BuildEdge, services::Services, - validate::{HalfEdgeValidationError, Validate, ValidationError}, + validate::{EdgeValidationError, Validate, ValidationError}, }; #[test] @@ -95,7 +95,7 @@ mod tests { assert_contains_err!( invalid, ValidationError::HalfEdge( - HalfEdgeValidationError::VerticesAreCoincident { .. } + EdgeValidationError::VerticesAreCoincident { .. } ) ); diff --git a/crates/fj-core/src/validate/mod.rs b/crates/fj-core/src/validate/mod.rs index 0f82eb535..29b221107 100644 --- a/crates/fj-core/src/validate/mod.rs +++ b/crates/fj-core/src/validate/mod.rs @@ -12,7 +12,7 @@ mod surface; mod vertex; pub use self::{ - cycle::CycleValidationError, edge::HalfEdgeValidationError, + cycle::CycleValidationError, edge::EdgeValidationError, face::FaceValidationError, shell::ShellValidationError, solid::SolidValidationError, }; @@ -109,7 +109,7 @@ pub enum ValidationError { /// `HalfEdge` validation error #[error("`HalfEdge` validation error")] - HalfEdge(#[from] HalfEdgeValidationError), + HalfEdge(#[from] EdgeValidationError), /// `Shell` validation error #[error("`Shell` validation error")] From baa9e0738c23402fe0f06ec4d707f343c39e2ea1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:37:28 +0200 Subject: [PATCH 20/97] Update error message --- crates/fj-core/src/validate/edge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index 7b759543e..202a61cfa 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -19,10 +19,10 @@ impl Validate for Edge { pub enum EdgeValidationError { /// [`Edge`]'s vertices are coincident #[error( - "Vertices of `HalfEdge` on curve are coincident\n\ + "Vertices of `Edge` on curve are coincident\n\ - Position of back vertex: {back_position:?}\n\ - Position of front vertex: {front_position:?}\n\ - - `HalfEdge`: {half_edge:#?}" + - `Edge`: {half_edge:#?}" )] VerticesAreCoincident { /// The position of the back vertex From bd184c3e8d03bcfd5524bb04889f59de51ffa710 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:38:06 +0200 Subject: [PATCH 21/97] Update doc comment --- crates/fj-core/src/validate/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/validate/mod.rs b/crates/fj-core/src/validate/mod.rs index 29b221107..380fc8cea 100644 --- a/crates/fj-core/src/validate/mod.rs +++ b/crates/fj-core/src/validate/mod.rs @@ -107,7 +107,7 @@ pub enum ValidationError { #[error("`Face` validation error")] Face(#[from] FaceValidationError), - /// `HalfEdge` validation error + /// `Edge` validation error #[error("`HalfEdge` validation error")] HalfEdge(#[from] EdgeValidationError), From f6c1c0ab665c8a8fe2f7186ef1f1365f2c0a74c1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:38:26 +0200 Subject: [PATCH 22/97] Update error message --- crates/fj-core/src/validate/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/validate/mod.rs b/crates/fj-core/src/validate/mod.rs index 380fc8cea..188c24317 100644 --- a/crates/fj-core/src/validate/mod.rs +++ b/crates/fj-core/src/validate/mod.rs @@ -108,7 +108,7 @@ pub enum ValidationError { Face(#[from] FaceValidationError), /// `Edge` validation error - #[error("`HalfEdge` validation error")] + #[error("`Edge` validation error")] HalfEdge(#[from] EdgeValidationError), /// `Shell` validation error From 36882912045928074b5b3855d31aa53c5b90e738 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:38:48 +0200 Subject: [PATCH 23/97] Rename `ValidationError::HalfEdge` to `Edge` --- crates/fj-core/src/validate/edge.rs | 2 +- crates/fj-core/src/validate/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index 202a61cfa..55ee7edc2 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -94,7 +94,7 @@ mod tests { valid.validate_and_return_first_error()?; assert_contains_err!( invalid, - ValidationError::HalfEdge( + ValidationError::Edge( EdgeValidationError::VerticesAreCoincident { .. } ) ); diff --git a/crates/fj-core/src/validate/mod.rs b/crates/fj-core/src/validate/mod.rs index 188c24317..12fb90929 100644 --- a/crates/fj-core/src/validate/mod.rs +++ b/crates/fj-core/src/validate/mod.rs @@ -109,7 +109,7 @@ pub enum ValidationError { /// `Edge` validation error #[error("`Edge` validation error")] - HalfEdge(#[from] EdgeValidationError), + Edge(#[from] EdgeValidationError), /// `Shell` validation error #[error("`Shell` validation error")] From e2fe4a2d6867a05be322467ad1079e3f98b43c78 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:39:15 +0200 Subject: [PATCH 24/97] Refactor to restore alphabetic ordering --- crates/fj-core/src/validate/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/validate/mod.rs b/crates/fj-core/src/validate/mod.rs index 12fb90929..2cd8a9c77 100644 --- a/crates/fj-core/src/validate/mod.rs +++ b/crates/fj-core/src/validate/mod.rs @@ -103,14 +103,14 @@ pub enum ValidationError { #[error("`Cycle` validation error")] Cycle(#[from] CycleValidationError), - /// `Face` validation error - #[error("`Face` validation error")] - Face(#[from] FaceValidationError), - /// `Edge` validation error #[error("`Edge` validation error")] Edge(#[from] EdgeValidationError), + /// `Face` validation error + #[error("`Face` validation error")] + Face(#[from] FaceValidationError), + /// `Shell` validation error #[error("`Shell` validation error")] Shell(#[from] ShellValidationError), From d7e4ef5caaa882a70da179c65457888d1c29ef1d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:40:13 +0200 Subject: [PATCH 25/97] Update error messages --- crates/fj-core/src/validate/shell.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 165abb69b..c081a04b1 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -42,8 +42,8 @@ pub enum ShellValidationError { /// [`Shell`] contains half-edges that are coincident, but refer to /// different global_edges #[error( - "`Shell` contains `HalfEdge`s that are coincident but refer to \ - different `GlobalEdge`s\n\ + "`Shell` contains `Edge`s that are coincident but refer to different \ + `Curve`s\n\ Edge 1: {0:#?}\n\ Edge 2: {1:#?}" )] @@ -51,7 +51,7 @@ pub enum ShellValidationError { /// [`Shell`] contains half-edges that are identical, but do not coincide #[error( - "Shell contains HalfEdges that are identical but do not coincide\n\ + "Shell contains `Edge`s that are identical but do not coincide\n\ Edge 1: {edge_a:#?}\n\ Surface for edge 1: {surface_a:#?}\n\ Edge 2: {edge_b:#?}\n\ From 6126ae20a3566ac690148f2a77b7fca1cb88d612 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:41:54 +0200 Subject: [PATCH 26/97] Update struct field name --- crates/fj-core/src/objects/kinds/cycle.rs | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 1689ff47c..ee0e126aa 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -6,31 +6,31 @@ use crate::{geometry::SurfacePath, objects::Edge, storage::Handle}; /// A cycle of connected half-edges #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Cycle { - half_edges: Vec>, + edges: Vec>, } impl Cycle { /// Create an instance of `Cycle` pub fn new(half_edges: impl IntoIterator>) -> Self { - let half_edges = half_edges.into_iter().collect::>(); - Self { half_edges } + let edges = half_edges.into_iter().collect::>(); + Self { edges } } /// Access the half-edges that make up the cycle pub fn half_edges(&self) -> impl Iterator> { - self.half_edges.iter() + self.edges.iter() } /// Access the half-edges in pairs pub fn half_edge_pairs( &self, ) -> impl Iterator, &Handle)> { - self.half_edges.iter().circular_tuple_windows() + self.edges.iter().circular_tuple_windows() } /// Access the half-edge with the provided index pub fn nth_half_edge(&self, index: usize) -> Option<&Handle> { - self.half_edges.get(index) + self.edges.get(index) } /// Access the half-edge after the provided one @@ -41,26 +41,26 @@ impl Cycle { half_edge: &Handle, ) -> Option<&Handle> { self.index_of(half_edge).map(|index| { - let next_index = (index + 1) % self.half_edges.len(); - &self.half_edges[next_index] + let next_index = (index + 1) % self.edges.len(); + &self.edges[next_index] }) } /// Return the index of the provided half-edge, if it is in this cycle pub fn index_of(&self, half_edge: &Handle) -> Option { - self.half_edges + self.edges .iter() .position(|edge| edge.id() == half_edge.id()) } /// Return the number of half-edges in the cycle pub fn len(&self) -> usize { - self.half_edges.len() + self.edges.len() } /// Indicate whether the cycle is empty pub fn is_empty(&self) -> bool { - self.half_edges.is_empty() + self.edges.is_empty() } /// Indicate the cycle's winding, assuming a right-handed coordinate system @@ -72,7 +72,7 @@ impl Cycle { // The cycle could be made up of one or two circles. If that is the // case, the winding of the cycle is determined by the winding of the // first circle. - if self.half_edges.len() < 3 { + if self.edges.len() < 3 { let first = self .half_edges() .next() From cb173fb37e550d7270efba81d15e5b618381320a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:42:10 +0200 Subject: [PATCH 27/97] Update argument name --- crates/fj-core/src/objects/kinds/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index ee0e126aa..073d5f30b 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -11,8 +11,8 @@ pub struct Cycle { impl Cycle { /// Create an instance of `Cycle` - pub fn new(half_edges: impl IntoIterator>) -> Self { - let edges = half_edges.into_iter().collect::>(); + pub fn new(edges: impl IntoIterator>) -> Self { + let edges = edges.into_iter().collect::>(); Self { edges } } From 4fd9a42c717171cc4d17e45b2811731746f171cc Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:42:42 +0200 Subject: [PATCH 28/97] Update method name --- crates/fj-core/src/algorithms/approx/cycle.rs | 2 +- crates/fj-core/src/algorithms/bounding_volume/cycle.rs | 2 +- crates/fj-core/src/algorithms/intersect/curve_face.rs | 6 ++---- crates/fj-core/src/algorithms/intersect/face_point.rs | 6 +++--- crates/fj-core/src/algorithms/intersect/ray_face.rs | 4 ++-- crates/fj-core/src/algorithms/transform/cycle.rs | 2 +- crates/fj-core/src/objects/kinds/cycle.rs | 4 ++-- crates/fj-core/src/objects/set.rs | 2 +- crates/fj-core/src/operations/build/face.rs | 2 +- crates/fj-core/src/operations/reverse/cycle.rs | 2 +- crates/fj-core/src/operations/update/cycle.rs | 6 +++--- crates/fj-core/src/queries/all_edges_with_surface.rs | 2 +- crates/fj-core/src/validate/cycle.rs | 2 +- crates/fj-core/src/validate/face.rs | 4 ++-- crates/fj-core/src/validate/shell.rs | 4 ++-- crates/fj-core/src/validate/solid.rs | 2 +- 16 files changed, 25 insertions(+), 27 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/cycle.rs b/crates/fj-core/src/algorithms/approx/cycle.rs index 03b3b3659..c4641252b 100644 --- a/crates/fj-core/src/algorithms/approx/cycle.rs +++ b/crates/fj-core/src/algorithms/approx/cycle.rs @@ -26,7 +26,7 @@ impl Approx for (&Cycle, &Surface) { let tolerance = tolerance.into(); let half_edges = cycle - .half_edges() + .edges() .map(|half_edge| { (half_edge.deref(), surface).approx_with_cache(tolerance, cache) }) diff --git a/crates/fj-core/src/algorithms/bounding_volume/cycle.rs b/crates/fj-core/src/algorithms/bounding_volume/cycle.rs index 385fbd9bf..48eccb314 100644 --- a/crates/fj-core/src/algorithms/bounding_volume/cycle.rs +++ b/crates/fj-core/src/algorithms/bounding_volume/cycle.rs @@ -6,7 +6,7 @@ impl super::BoundingVolume<2> for Cycle { fn aabb(&self) -> Option> { let mut aabb: Option> = None; - for half_edge in self.half_edges() { + for half_edge in self.edges() { let new_aabb = half_edge.aabb().expect("`Edge` can always compute AABB"); aabb = Some(aabb.map_or(new_aabb, |aabb| aabb.merged(&new_aabb))); diff --git a/crates/fj-core/src/algorithms/intersect/curve_face.rs b/crates/fj-core/src/algorithms/intersect/curve_face.rs index 78449faa9..095d3ab81 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_face.rs @@ -29,10 +29,8 @@ impl CurveFaceIntersection { /// Compute the intersection pub fn compute(path: &SurfacePath, face: &Face) -> Self { - let half_edges = face - .region() - .all_cycles() - .flat_map(|cycle| cycle.half_edges()); + let half_edges = + face.region().all_cycles().flat_map(|cycle| cycle.edges()); let mut intersections = Vec::new(); diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index 5c9ed4080..482603733 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -28,7 +28,7 @@ impl Intersect for (&Face, &Point<2>) { // as long as we initialize the `previous_hit` variable with the // result of the last segment. let mut previous_hit = cycle - .half_edges() + .edges() .last() .cloned() .and_then(|edge| (&ray, &edge).intersect()); @@ -335,7 +335,7 @@ mod tests { let edge = face .region() .exterior() - .half_edges() + .edges() .find(|edge| edge.start_position() == Point::from([0., 0.])) .unwrap(); assert_eq!( @@ -370,7 +370,7 @@ mod tests { let vertex = face .region() .exterior() - .half_edges() + .edges() .find(|half_edge| { half_edge.start_position() == Point::from([1., 0.]) }) diff --git a/crates/fj-core/src/algorithms/intersect/ray_face.rs b/crates/fj-core/src/algorithms/intersect/ray_face.rs index d984cbfcd..b112705fa 100644 --- a/crates/fj-core/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-core/src/algorithms/intersect/ray_face.rs @@ -262,7 +262,7 @@ mod tests { let edge = face .region() .exterior() - .half_edges() + .edges() .find(|edge| edge.start_position() == Point::from([-1., 1.])) .unwrap(); assert_eq!( @@ -297,7 +297,7 @@ mod tests { let vertex = face .region() .exterior() - .half_edges() + .edges() .find(|half_edge| { half_edge.start_position() == Point::from([-1., -1.]) }) diff --git a/crates/fj-core/src/algorithms/transform/cycle.rs b/crates/fj-core/src/algorithms/transform/cycle.rs index 67e88fa64..6fb1b1195 100644 --- a/crates/fj-core/src/algorithms/transform/cycle.rs +++ b/crates/fj-core/src/algorithms/transform/cycle.rs @@ -11,7 +11,7 @@ impl TransformObject for Cycle { services: &mut Services, cache: &mut TransformCache, ) -> Self { - let half_edges = self.half_edges().map(|half_edge| { + let half_edges = self.edges().map(|half_edge| { half_edge .clone() .transform_with_cache(transform, services, cache) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 073d5f30b..73eae4890 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -17,7 +17,7 @@ impl Cycle { } /// Access the half-edges that make up the cycle - pub fn half_edges(&self) -> impl Iterator> { + pub fn edges(&self) -> impl Iterator> { self.edges.iter() } @@ -74,7 +74,7 @@ impl Cycle { // first circle. if self.edges.len() < 3 { let first = self - .half_edges() + .edges() .next() .expect("Invalid cycle: expected at least one half-edge"); diff --git a/crates/fj-core/src/objects/set.rs b/crates/fj-core/src/objects/set.rs index 98ecafc5f..3c423f859 100644 --- a/crates/fj-core/src/objects/set.rs +++ b/crates/fj-core/src/objects/set.rs @@ -61,7 +61,7 @@ impl InsertIntoSet for Curve { impl InsertIntoSet for Cycle { fn insert_into_set(&self, objects: &mut ObjectSet) { - for half_edge in self.half_edges() { + for half_edge in self.edges() { objects.inner.insert(half_edge.clone().into()); half_edge.insert_into_set(objects); } diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index fd8aeea6c..d8fcaa4f0 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -32,7 +32,7 @@ pub trait BuildFace { let face = Face::polygon(surface, points_surface, services); let edges = { - let mut half_edges = face.region().exterior().half_edges().cloned(); + let mut half_edges = face.region().exterior().edges().cloned(); let array = array::from_fn(|_| half_edges.next()).map(|half_edge| { diff --git a/crates/fj-core/src/operations/reverse/cycle.rs b/crates/fj-core/src/operations/reverse/cycle.rs index 5d4920c95..2a6f673be 100644 --- a/crates/fj-core/src/operations/reverse/cycle.rs +++ b/crates/fj-core/src/operations/reverse/cycle.rs @@ -32,7 +32,7 @@ impl ReverseCurveCoordinateSystems for Cycle { &self, services: &mut Services, ) -> Self { - let edges = self.half_edges().map(|edge| { + let edges = self.edges().map(|edge| { edge.reverse_curve_coordinate_systems(services) .insert(services) }); diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index b46012147..4a2ed2657 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -42,7 +42,7 @@ impl UpdateCycle for Cycle { &self, half_edges: impl IntoIterator>, ) -> Self { - let half_edges = self.half_edges().cloned().chain(half_edges); + let half_edges = self.edges().cloned().chain(half_edges); Cycle::new(half_edges) } @@ -53,7 +53,7 @@ impl UpdateCycle for Cycle { ) -> Self { let mut num_replacements = 0; - let half_edges = self.half_edges().map(|half_edge| { + let half_edges = self.edges().map(|half_edge| { if half_edge.id() == original.id() { num_replacements += 1; replacement.clone() @@ -79,7 +79,7 @@ impl UpdateCycle for Cycle { ) -> Self { let mut num_replacements = 0; - let half_edges = self.half_edges().enumerate().map(|(i, half_edge)| { + let half_edges = self.edges().enumerate().map(|(i, half_edge)| { if i == index { num_replacements += 1; f(half_edge) diff --git a/crates/fj-core/src/queries/all_edges_with_surface.rs b/crates/fj-core/src/queries/all_edges_with_surface.rs index b1aeaa07e..44a3b4574 100644 --- a/crates/fj-core/src/queries/all_edges_with_surface.rs +++ b/crates/fj-core/src/queries/all_edges_with_surface.rs @@ -20,7 +20,7 @@ impl AllEdgesWithSurface for Face { for cycle in self.region().all_cycles() { result.extend( cycle - .half_edges() + .edges() .cloned() .map(|half_edge| (half_edge, self.surface().clone())), ); diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 97bdc2cd7..960dd72d1 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -53,7 +53,7 @@ impl CycleValidationError { errors: &mut Vec, ) { // If there are no half edges - if cycle.half_edges().next().is_none() { + if cycle.edges().next().is_none() { errors.push(Self::NotEnoughEdges.into()); } } diff --git a/crates/fj-core/src/validate/face.rs b/crates/fj-core/src/validate/face.rs index ba059e9c9..3eb995780 100644 --- a/crates/fj-core/src/validate/face.rs +++ b/crates/fj-core/src/validate/face.rs @@ -38,7 +38,7 @@ pub enum FaceValidationError { impl FaceValidationError { fn check_interior_winding(face: &Face, errors: &mut Vec) { - if face.region().exterior().half_edges().count() == 0 { + if face.region().exterior().edges().count() == 0 { // Can't determine winding, if the cycle has no half-edges. Sounds // like a job for a different validation check. return; @@ -47,7 +47,7 @@ impl FaceValidationError { let exterior_winding = face.region().exterior().winding(); for interior in face.region().interiors() { - if interior.half_edges().count() == 0 { + if interior.edges().count() == 0 { // Can't determine winding, if the cycle has no half-edges. // Sounds like a job for a different validation check. continue; diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index c081a04b1..dfd1f875a 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -299,7 +299,7 @@ impl ShellValidationError { for face in shell.faces() { for cycle in face.region().all_cycles() { - for half_edge in cycle.half_edges() { + for half_edge in cycle.edges() { let curve = HandleWrapper::from(half_edge.curve().clone()); let bounding_vertices = cycle .bounding_vertices_of_edge(half_edge) @@ -330,7 +330,7 @@ impl ShellValidationError { for face in shell.faces() { for cycle in face.region().all_cycles() { - for edge in cycle.half_edges() { + for edge in cycle.edges() { let curve = HandleWrapper::from(edge.curve().clone()); let boundary = cycle .bounding_vertices_of_edge(edge) diff --git a/crates/fj-core/src/validate/solid.rs b/crates/fj-core/src/validate/solid.rs index 5c0cdbfe6..550dce114 100644 --- a/crates/fj-core/src/validate/solid.rs +++ b/crates/fj-core/src/validate/solid.rs @@ -74,7 +74,7 @@ impl SolidValidationError { .flat_map(|face| { face.region() .all_cycles() - .flat_map(|cycle| cycle.half_edges().cloned()) + .flat_map(|cycle| cycle.edges().cloned()) .zip(repeat(face.surface().geometry())) }) .map(|(h, s)| { From ad1d4da48041aa71427ece655f698a28e00b7a20 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:43:00 +0200 Subject: [PATCH 29/97] Update method name --- crates/fj-core/src/algorithms/intersect/face_point.rs | 2 +- crates/fj-core/src/algorithms/sweep/face.rs | 2 +- crates/fj-core/src/objects/kinds/cycle.rs | 4 ++-- crates/fj-core/src/operations/reverse/cycle.rs | 2 +- crates/fj-core/src/validate/cycle.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index 482603733..d30814801 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -33,7 +33,7 @@ impl Intersect for (&Face, &Point<2>) { .cloned() .and_then(|edge| (&ray, &edge).intersect()); - for (half_edge, next_half_edge) in cycle.half_edge_pairs() { + for (half_edge, next_half_edge) in cycle.edge_pairs() { let hit = (&ray, half_edge).intersect(); let count_hit = match (hit, previous_hit) { diff --git a/crates/fj-core/src/algorithms/sweep/face.rs b/crates/fj-core/src/algorithms/sweep/face.rs index 4eb6c2ad3..b98bfd177 100644 --- a/crates/fj-core/src/algorithms/sweep/face.rs +++ b/crates/fj-core/src/algorithms/sweep/face.rs @@ -61,7 +61,7 @@ impl Sweep for Handle { let cycle = cycle.reverse(services); let mut top_edges = Vec::new(); - for (half_edge, next) in cycle.half_edge_pairs() { + for (half_edge, next) in cycle.edge_pairs() { let (face, top_edge) = ( half_edge.deref(), next.start_vertex(), diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 73eae4890..8be340292 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -22,7 +22,7 @@ impl Cycle { } /// Access the half-edges in pairs - pub fn half_edge_pairs( + pub fn edge_pairs( &self, ) -> impl Iterator, &Handle)> { self.edges.iter().circular_tuple_windows() @@ -102,7 +102,7 @@ impl Cycle { let mut sum = Scalar::ZERO; - for (a, b) in self.half_edge_pairs() { + for (a, b) in self.edge_pairs() { let [a, b] = [a, b].map(|half_edge| half_edge.start_position()); sum += (b.u - a.u) * (b.v + a.v); diff --git a/crates/fj-core/src/operations/reverse/cycle.rs b/crates/fj-core/src/operations/reverse/cycle.rs index 2a6f673be..aa9631a03 100644 --- a/crates/fj-core/src/operations/reverse/cycle.rs +++ b/crates/fj-core/src/operations/reverse/cycle.rs @@ -9,7 +9,7 @@ use super::{Reverse, ReverseCurveCoordinateSystems}; impl Reverse for Cycle { fn reverse(&self, services: &mut Services) -> Self { let mut edges = self - .half_edge_pairs() + .edge_pairs() .map(|(current, next)| { Edge::new( current.path(), diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 960dd72d1..8daea6634 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -63,7 +63,7 @@ impl CycleValidationError { config: &ValidationConfig, errors: &mut Vec, ) { - for (first, second) in cycle.half_edge_pairs() { + for (first, second) in cycle.edge_pairs() { let end_of_first = { let [_, end] = first.boundary().inner; first.path().point_from_path_coords(end) From 432377a3501b3bc4a4943e4b1cb7612f49079a9a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:44:06 +0200 Subject: [PATCH 30/97] Update method name --- crates/fj-core/src/objects/kinds/cycle.rs | 2 +- crates/fj-core/src/operations/build/face.rs | 4 ++-- crates/fj-core/src/operations/join/cycle.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 8be340292..f4d64bb96 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -29,7 +29,7 @@ impl Cycle { } /// Access the half-edge with the provided index - pub fn nth_half_edge(&self, index: usize) -> Option<&Handle> { + pub fn nth_edge(&self, index: usize) -> Option<&Handle> { self.edges.get(index) } diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index d8fcaa4f0..d95247bf5 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -101,7 +101,7 @@ impl Polygon { face.borrow() .region() .exterior() - .nth_half_edge(i) + .nth_edge(i) .expect("Operation should not have changed length of cycle") .clone() }); @@ -112,7 +112,7 @@ impl Polygon { face.borrow() .region() .exterior() - .nth_half_edge(i) + .nth_edge(i) .expect("Operation should not have changed length of cycle") .start_vertex() .clone() diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 7df8e03c7..c0ad867b2 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -111,10 +111,10 @@ impl JoinCycle for Cycle { let index_other = index_other % self.len(); let half_edge = self - .nth_half_edge(index) + .nth_edge(index) .expect("Index must be valid, due to use of `%` above"); let half_edge_other = other - .nth_half_edge(index_other) + .nth_edge(index_other) .expect("Index must be valid, due to use of `%` above"); let vertex_a = other From 8854dde6c3146d002b34528b1af9550d52e21794 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:44:33 +0200 Subject: [PATCH 31/97] Update method name --- crates/fj-core/src/objects/kinds/cycle.rs | 2 +- crates/fj-core/src/operations/join/cycle.rs | 4 ++-- crates/fj-core/src/queries/bounding_vertices_of_edge.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index f4d64bb96..ef47d89cd 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -36,7 +36,7 @@ impl Cycle { /// Access the half-edge after the provided one /// /// Returns `None`, if the provided [`Edge`] is not part of the cycle. - pub fn half_edge_after( + pub fn edge_after( &self, half_edge: &Handle, ) -> Option<&Handle> { diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index c0ad867b2..11538f1ab 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -118,14 +118,14 @@ impl JoinCycle for Cycle { .expect("Index must be valid, due to use of `%` above"); let vertex_a = other - .half_edge_after(half_edge_other) + .edge_after(half_edge_other) .expect("Cycle must contain edge; just obtained edge from it") .start_vertex() .clone(); let vertex_b = half_edge_other.start_vertex().clone(); let next_edge = cycle - .half_edge_after(half_edge) + .edge_after(half_edge) .expect("Cycle must contain edge; just obtained edge from it"); let this_joined = half_edge diff --git a/crates/fj-core/src/queries/bounding_vertices_of_edge.rs b/crates/fj-core/src/queries/bounding_vertices_of_edge.rs index 569c0a614..4d30ada08 100644 --- a/crates/fj-core/src/queries/bounding_vertices_of_edge.rs +++ b/crates/fj-core/src/queries/bounding_vertices_of_edge.rs @@ -22,7 +22,7 @@ impl BoundingVerticesOfEdge for Cycle { edge: &Handle, ) -> Option> { let start = edge.start_vertex().clone(); - let end = self.half_edge_after(edge)?.start_vertex().clone(); + let end = self.edge_after(edge)?.start_vertex().clone(); Some(CurveBoundary::from([start, end])) } From 230f35ca122947175be2b20221302508e4dbeda0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:44:45 +0200 Subject: [PATCH 32/97] Update argument name --- crates/fj-core/src/objects/kinds/cycle.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index ef47d89cd..635e658d9 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -36,11 +36,8 @@ impl Cycle { /// Access the half-edge after the provided one /// /// Returns `None`, if the provided [`Edge`] is not part of the cycle. - pub fn edge_after( - &self, - half_edge: &Handle, - ) -> Option<&Handle> { - self.index_of(half_edge).map(|index| { + pub fn edge_after(&self, edge: &Handle) -> Option<&Handle> { + self.index_of(edge).map(|index| { let next_index = (index + 1) % self.edges.len(); &self.edges[next_index] }) From befa025534c6d6f5e5d6efe7152a864dd0fc8ffc Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:45:33 +0200 Subject: [PATCH 33/97] Rename argument to prepare for follow-on change --- crates/fj-core/src/objects/kinds/cycle.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 635e658d9..12f7430dd 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -45,9 +45,7 @@ impl Cycle { /// Return the index of the provided half-edge, if it is in this cycle pub fn index_of(&self, half_edge: &Handle) -> Option { - self.edges - .iter() - .position(|edge| edge.id() == half_edge.id()) + self.edges.iter().position(|e| e.id() == half_edge.id()) } /// Return the number of half-edges in the cycle From d949190eafab389c8d5abf90bd38512f891009ee Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:45:47 +0200 Subject: [PATCH 34/97] Update argument name --- crates/fj-core/src/objects/kinds/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 12f7430dd..13e300a10 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -44,8 +44,8 @@ impl Cycle { } /// Return the index of the provided half-edge, if it is in this cycle - pub fn index_of(&self, half_edge: &Handle) -> Option { - self.edges.iter().position(|e| e.id() == half_edge.id()) + pub fn index_of(&self, edge: &Handle) -> Option { + self.edges.iter().position(|e| e.id() == edge.id()) } /// Return the number of half-edges in the cycle From a4b4a9c2735873d060b4c89b44c6b0a989efcd2b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:46:02 +0200 Subject: [PATCH 35/97] Update argument name --- crates/fj-core/src/objects/kinds/cycle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 13e300a10..84349b51c 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -98,7 +98,7 @@ impl Cycle { let mut sum = Scalar::ZERO; for (a, b) in self.edge_pairs() { - let [a, b] = [a, b].map(|half_edge| half_edge.start_position()); + let [a, b] = [a, b].map(|edge| edge.start_position()); sum += (b.u - a.u) * (b.v + a.v); } From 12e1874635f8e43c1d2dda91fb9c5dff8fb037a4 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:46:38 +0200 Subject: [PATCH 36/97] Update struct field name --- crates/fj-core/src/algorithms/approx/cycle.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/cycle.rs b/crates/fj-core/src/algorithms/approx/cycle.rs index c4641252b..d2930c5c7 100644 --- a/crates/fj-core/src/algorithms/approx/cycle.rs +++ b/crates/fj-core/src/algorithms/approx/cycle.rs @@ -25,14 +25,14 @@ impl Approx for (&Cycle, &Surface) { let (cycle, surface) = self; let tolerance = tolerance.into(); - let half_edges = cycle + let edges = cycle .edges() .map(|half_edge| { (half_edge.deref(), surface).approx_with_cache(tolerance, cache) }) .collect(); - CycleApprox { half_edges } + CycleApprox { edges } } } @@ -40,7 +40,7 @@ impl Approx for (&Cycle, &Surface) { #[derive(Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct CycleApprox { /// The approximated edges that make up the approximated cycle - pub half_edges: Vec, + pub edges: Vec, } impl CycleApprox { @@ -48,7 +48,7 @@ impl CycleApprox { pub fn points(&self) -> Vec> { let mut points = Vec::new(); - for approx in &self.half_edges { + for approx in &self.edges { points.extend(approx.points()); } From 0bb4e26f3b195c72f7bb7ac9d590e36ca989e3ab Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:46:50 +0200 Subject: [PATCH 37/97] Update argument name --- crates/fj-core/src/algorithms/approx/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/cycle.rs b/crates/fj-core/src/algorithms/approx/cycle.rs index d2930c5c7..04c3eadad 100644 --- a/crates/fj-core/src/algorithms/approx/cycle.rs +++ b/crates/fj-core/src/algorithms/approx/cycle.rs @@ -27,8 +27,8 @@ impl Approx for (&Cycle, &Surface) { let edges = cycle .edges() - .map(|half_edge| { - (half_edge.deref(), surface).approx_with_cache(tolerance, cache) + .map(|edge| { + (edge.deref(), surface).approx_with_cache(tolerance, cache) }) .collect(); From 334cb341bfc618a47df1f0bca871f241aef98630 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:47:13 +0200 Subject: [PATCH 38/97] Update variable name --- crates/fj-core/src/algorithms/approx/edge.rs | 24 +++++++++----------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index df43c43fc..f8fbf4928 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -26,17 +26,16 @@ impl Approx for (&Edge, &Surface) { tolerance: impl Into, cache: &mut Self::Cache, ) -> Self::Approximation { - let (half_edge, surface) = self; + let (edge, surface) = self; - let position_surface = half_edge.start_position(); - let position_global = match cache.get_position(half_edge.start_vertex()) - { + let position_surface = edge.start_position(); + let position_global = match cache.get_position(edge.start_vertex()) { Some(position) => position, None => { let position_global = surface .geometry() .point_from_surface_coords(position_surface); - cache.insert_position(half_edge.start_vertex(), position_global) + cache.insert_position(edge.start_vertex(), position_global) } }; @@ -79,19 +78,19 @@ impl Approx for (&Edge, &Surface) { // able to deliver partial results for a given boundary, then // generating (and caching) the rest of it on the fly. let cached_approx = - cache.get_edge(half_edge.curve().clone(), half_edge.boundary()); + cache.get_edge(edge.curve().clone(), edge.boundary()); let approx = match cached_approx { Some(approx) => approx, None => { let approx = approx_edge( - &half_edge.path(), + &edge.path(), surface, - half_edge.boundary(), + edge.boundary(), tolerance, ); cache.insert_edge( - half_edge.curve().clone(), - half_edge.boundary(), + edge.curve().clone(), + edge.boundary(), approx, ) } @@ -101,9 +100,8 @@ impl Approx for (&Edge, &Surface) { .points .into_iter() .map(|point| { - let point_surface = half_edge - .path() - .point_from_path_coords(point.local_form); + let point_surface = + edge.path().point_from_path_coords(point.local_form); ApproxPoint::new(point_surface, point.global_form) }) From 423efa51b82d02a6df15d3020a29a1b702ae0376 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:47:44 +0200 Subject: [PATCH 39/97] Update variable names --- crates/fj-core/src/algorithms/approx/edge.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/edge.rs b/crates/fj-core/src/algorithms/approx/edge.rs index f8fbf4928..d3df2f9a2 100644 --- a/crates/fj-core/src/algorithms/approx/edge.rs +++ b/crates/fj-core/src/algorithms/approx/edge.rs @@ -294,11 +294,11 @@ mod tests { let mut services = Services::new(); let surface = services.objects.surfaces.xz_plane(); - let half_edge = + let edge = Edge::line_segment([[1., 1.], [2., 1.]], None, &mut services); let tolerance = 1.; - let approx = (&half_edge, surface.deref()).approx(tolerance); + let approx = (&edge, surface.deref()).approx(tolerance); assert_eq!(approx.points, Vec::new()); } @@ -311,11 +311,11 @@ mod tests { u: GlobalPath::circle_from_radius(1.), v: [0., 0., 1.].into(), }); - let half_edge = + let edge = Edge::line_segment([[1., 1.], [2., 1.]], None, &mut services); let tolerance = 1.; - let approx = (&half_edge, &surface).approx(tolerance); + let approx = (&edge, &surface).approx(tolerance); assert_eq!(approx.points, Vec::new()); } @@ -331,21 +331,21 @@ mod tests { u: path, v: [0., 0., 1.].into(), }); - let half_edge = Edge::line_segment( + let edge = Edge::line_segment( [[0., 1.], [TAU, 1.]], Some(boundary.inner), &mut services, ); let tolerance = 1.; - let approx = (&half_edge, &surface).approx(tolerance); + let approx = (&edge, &surface).approx(tolerance); let expected_approx = (path, boundary) .approx(tolerance) .into_iter() .map(|(point_local, _)| { let point_surface = - half_edge.path().point_from_path_coords(point_local); + edge.path().point_from_path_coords(point_local); let point_global = surface.geometry().point_from_surface_coords(point_surface); ApproxPoint::new(point_surface, point_global) @@ -359,13 +359,13 @@ mod tests { let mut services = Services::new(); let surface = services.objects.surfaces.xz_plane(); - let half_edge = Edge::circle([0., 0.], 1., &mut services); + let edge = Edge::circle([0., 0.], 1., &mut services); let tolerance = 1.; - let approx = (&half_edge, surface.deref()).approx(tolerance); + let approx = (&edge, surface.deref()).approx(tolerance); let expected_approx = - (&half_edge.path(), CurveBoundary::from([[0.], [TAU]])) + (&edge.path(), CurveBoundary::from([[0.], [TAU]])) .approx(tolerance) .into_iter() .map(|(_, point_surface)| { From 69ae5bde3cf176ecb60860a68319b62dc463c0ba Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:48:02 +0200 Subject: [PATCH 40/97] Update variable name --- crates/fj-core/src/algorithms/bounding_volume/cycle.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/algorithms/bounding_volume/cycle.rs b/crates/fj-core/src/algorithms/bounding_volume/cycle.rs index 48eccb314..84431f075 100644 --- a/crates/fj-core/src/algorithms/bounding_volume/cycle.rs +++ b/crates/fj-core/src/algorithms/bounding_volume/cycle.rs @@ -6,9 +6,8 @@ impl super::BoundingVolume<2> for Cycle { fn aabb(&self) -> Option> { let mut aabb: Option> = None; - for half_edge in self.edges() { - let new_aabb = - half_edge.aabb().expect("`Edge` can always compute AABB"); + for edge in self.edges() { + let new_aabb = edge.aabb().expect("`Edge` can always compute AABB"); aabb = Some(aabb.map_or(new_aabb, |aabb| aabb.merged(&new_aabb))); } From a564daff1ed3b664a595e111feee9e75379546da Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:48:22 +0200 Subject: [PATCH 41/97] Update argument name --- crates/fj-core/src/algorithms/intersect/curve_edge.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/curve_edge.rs b/crates/fj-core/src/algorithms/intersect/curve_edge.rs index 86cac2425..85c7ea395 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_edge.rs @@ -27,21 +27,21 @@ impl CurveEdgeIntersection { /// /// Currently, only intersections between lines and line segments can be /// computed. Panics, if a different type of curve or [`Edge`] is passed. - pub fn compute(path: &SurfacePath, half_edge: &Edge) -> Option { + pub fn compute(path: &SurfacePath, edge: &Edge) -> Option { let path_as_line = match path { SurfacePath::Line(line) => line, _ => todo!("Curve-edge intersection only supports lines"), }; let edge_as_segment = { - let edge_path_as_line = match half_edge.path() { + let edge_path_as_line = match edge.path() { SurfacePath::Line(line) => line, _ => { todo!("Curve-edge intersection only supports line segments") } }; - let edge_vertices = half_edge + let edge_vertices = edge .boundary() .inner .map(|point| edge_path_as_line.point_from_line_coords(point)); From 5ce49c674a80227c23aabe2bab7118c507b8be05 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:48:51 +0200 Subject: [PATCH 42/97] Update variable names --- .../src/algorithms/intersect/curve_edge.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/curve_edge.rs b/crates/fj-core/src/algorithms/intersect/curve_edge.rs index 85c7ea395..230a646ca 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_edge.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_edge.rs @@ -83,10 +83,10 @@ mod tests { let mut services = Services::new(); let path = SurfacePath::u_axis(); - let half_edge = + let edge = Edge::line_segment([[1., -1.], [1., 1.]], None, &mut services); - let intersection = CurveEdgeIntersection::compute(&path, &half_edge); + let intersection = CurveEdgeIntersection::compute(&path, &edge); assert_eq!( intersection, @@ -101,10 +101,10 @@ mod tests { let mut services = Services::new(); let path = SurfacePath::u_axis(); - let half_edge = + let edge = Edge::line_segment([[-1., -1.], [-1., 1.]], None, &mut services); - let intersection = CurveEdgeIntersection::compute(&path, &half_edge); + let intersection = CurveEdgeIntersection::compute(&path, &edge); assert_eq!( intersection, @@ -119,10 +119,10 @@ mod tests { let mut services = Services::new(); let path = SurfacePath::u_axis(); - let half_edge = + let edge = Edge::line_segment([[-1., -1.], [1., -1.]], None, &mut services); - let intersection = CurveEdgeIntersection::compute(&path, &half_edge); + let intersection = CurveEdgeIntersection::compute(&path, &edge); assert!(intersection.is_none()); } @@ -132,10 +132,10 @@ mod tests { let mut services = Services::new(); let path = SurfacePath::u_axis(); - let half_edge = + let edge = Edge::line_segment([[-1., 0.], [1., 0.]], None, &mut services); - let intersection = CurveEdgeIntersection::compute(&path, &half_edge); + let intersection = CurveEdgeIntersection::compute(&path, &edge); assert_eq!( intersection, From 6a585793c450c75c9913f094040e7c039afc56db Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:49:08 +0200 Subject: [PATCH 43/97] Update variable name --- crates/fj-core/src/algorithms/intersect/curve_face.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/curve_face.rs b/crates/fj-core/src/algorithms/intersect/curve_face.rs index 095d3ab81..b8222afa6 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_face.rs @@ -29,12 +29,11 @@ impl CurveFaceIntersection { /// Compute the intersection pub fn compute(path: &SurfacePath, face: &Face) -> Self { - let half_edges = - face.region().all_cycles().flat_map(|cycle| cycle.edges()); + let edges = face.region().all_cycles().flat_map(|cycle| cycle.edges()); let mut intersections = Vec::new(); - for half_edge in half_edges { + for half_edge in edges { let intersection = CurveEdgeIntersection::compute(path, half_edge); if let Some(intersection) = intersection { From cc3325cf6ae8c92e0b770a3052d6ea10d12e6825 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:49:18 +0200 Subject: [PATCH 44/97] Update variable name --- crates/fj-core/src/algorithms/intersect/curve_face.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/curve_face.rs b/crates/fj-core/src/algorithms/intersect/curve_face.rs index b8222afa6..5d5a4e066 100644 --- a/crates/fj-core/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-core/src/algorithms/intersect/curve_face.rs @@ -33,8 +33,8 @@ impl CurveFaceIntersection { let mut intersections = Vec::new(); - for half_edge in edges { - let intersection = CurveEdgeIntersection::compute(path, half_edge); + for edge in edges { + let intersection = CurveEdgeIntersection::compute(path, edge); if let Some(intersection) = intersection { match intersection { From 7373225776527890977fa56b9d0210cc4957fdb6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:49:37 +0200 Subject: [PATCH 45/97] Update variable name --- crates/fj-core/src/algorithms/intersect/face_point.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index d30814801..32f17de03 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -33,8 +33,8 @@ impl Intersect for (&Face, &Point<2>) { .cloned() .and_then(|edge| (&ray, &edge).intersect()); - for (half_edge, next_half_edge) in cycle.edge_pairs() { - let hit = (&ray, half_edge).intersect(); + for (edge, next_half_edge) in cycle.edge_pairs() { + let hit = (&ray, edge).intersect(); let count_hit = match (hit, previous_hit) { ( @@ -44,11 +44,11 @@ impl Intersect for (&Face, &Point<2>) { // If the ray starts on the boundary of the face, // there's nothing to else check. return Some(FacePointIntersection::PointIsOnEdge( - half_edge.clone() + edge.clone() )); } (Some(RaySegmentIntersection::RayStartsOnOnFirstVertex), _) => { - let vertex = half_edge.start_position(); + let vertex = edge.start_position(); return Some( FacePointIntersection::PointIsOnVertex(vertex) ); From 9082041c9f5d861b427f4fe8b260c787287c7ef1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:49:50 +0200 Subject: [PATCH 46/97] Update variable name --- crates/fj-core/src/algorithms/intersect/face_point.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index 32f17de03..b57503ac1 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -33,7 +33,7 @@ impl Intersect for (&Face, &Point<2>) { .cloned() .and_then(|edge| (&ray, &edge).intersect()); - for (edge, next_half_edge) in cycle.edge_pairs() { + for (edge, next_edge) in cycle.edge_pairs() { let hit = (&ray, edge).intersect(); let count_hit = match (hit, previous_hit) { @@ -54,7 +54,7 @@ impl Intersect for (&Face, &Point<2>) { ); } (Some(RaySegmentIntersection::RayStartsOnSecondVertex), _) => { - let vertex = next_half_edge.start_position(); + let vertex = next_edge.start_position(); return Some( FacePointIntersection::PointIsOnVertex(vertex) ); From d8477a78b13481a1dd7dce950590d647eaac1ca6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:50:06 +0200 Subject: [PATCH 47/97] Update argument names --- crates/fj-core/src/algorithms/intersect/face_point.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/face_point.rs b/crates/fj-core/src/algorithms/intersect/face_point.rs index b57503ac1..d82dafa43 100644 --- a/crates/fj-core/src/algorithms/intersect/face_point.rs +++ b/crates/fj-core/src/algorithms/intersect/face_point.rs @@ -371,10 +371,8 @@ mod tests { .region() .exterior() .edges() - .find(|half_edge| { - half_edge.start_position() == Point::from([1., 0.]) - }) - .map(|half_edge| half_edge.start_position()) + .find(|edge| edge.start_position() == Point::from([1., 0.])) + .map(|edge| edge.start_position()) .unwrap(); assert_eq!( intersection, From c39026ed1ad38aca3d2a22e23b78cd2929bc133f Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:50:25 +0200 Subject: [PATCH 48/97] Update argument names --- crates/fj-core/src/algorithms/intersect/ray_face.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/algorithms/intersect/ray_face.rs b/crates/fj-core/src/algorithms/intersect/ray_face.rs index b112705fa..e5930eed2 100644 --- a/crates/fj-core/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-core/src/algorithms/intersect/ray_face.rs @@ -298,10 +298,8 @@ mod tests { .region() .exterior() .edges() - .find(|half_edge| { - half_edge.start_position() == Point::from([-1., -1.]) - }) - .map(|half_edge| half_edge.start_position()) + .find(|edge| edge.start_position() == Point::from([-1., -1.])) + .map(|edge| edge.start_position()) .unwrap(); assert_eq!( (&ray, &face).intersect(), From 70a6c32b9cfed14d942a9450d657bba83156b217 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:50:43 +0200 Subject: [PATCH 49/97] Update variable name --- crates/fj-core/src/algorithms/sweep/edge.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/fj-core/src/algorithms/sweep/edge.rs b/crates/fj-core/src/algorithms/sweep/edge.rs index 2f9537f1f..9aa4edd02 100644 --- a/crates/fj-core/src/algorithms/sweep/edge.rs +++ b/crates/fj-core/src/algorithms/sweep/edge.rs @@ -80,7 +80,7 @@ impl Sweep for (&Edge, &Handle, &Surface, Option) { .zip_ext(vertices) .zip_ext(curves) .map(|((((boundary, start), end), start_vertex), curve)| { - let half_edge = { + let edge = { let half_edge = Edge::line_segment( [start, end], Some(boundary), @@ -98,13 +98,10 @@ impl Sweep for (&Edge, &Handle, &Surface, Option) { }; exterior = Some( - exterior - .take() - .unwrap() - .add_half_edges([half_edge.clone()]), + exterior.take().unwrap().add_half_edges([edge.clone()]), ); - half_edge + edge }); let region = Region::new(exterior.unwrap().insert(services), [], color) From b39f457a3ecea4418f77a05db98eac651bb46dba Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:50:55 +0200 Subject: [PATCH 50/97] Update variable names --- crates/fj-core/src/algorithms/sweep/edge.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/algorithms/sweep/edge.rs b/crates/fj-core/src/algorithms/sweep/edge.rs index 9aa4edd02..45d449714 100644 --- a/crates/fj-core/src/algorithms/sweep/edge.rs +++ b/crates/fj-core/src/algorithms/sweep/edge.rs @@ -81,20 +81,20 @@ impl Sweep for (&Edge, &Handle, &Surface, Option) { .zip_ext(curves) .map(|((((boundary, start), end), start_vertex), curve)| { let edge = { - let half_edge = Edge::line_segment( + let edge = Edge::line_segment( [start, end], Some(boundary), services, ) .replace_start_vertex(start_vertex); - let half_edge = if let Some(curve) = curve { - half_edge.replace_curve(curve) + let edge = if let Some(curve) = curve { + edge.replace_curve(curve) } else { - half_edge + edge }; - half_edge.insert(services) + edge.insert(services) }; exterior = Some( From 4ad08a31d018b3ad7d338067128844068b0158a6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:51:31 +0200 Subject: [PATCH 51/97] Update trait method name --- crates/fj-core/src/algorithms/sweep/edge.rs | 5 ++--- crates/fj-core/src/operations/build/cycle.rs | 2 +- crates/fj-core/src/operations/join/cycle.rs | 2 +- crates/fj-core/src/operations/update/cycle.rs | 4 ++-- crates/fj-core/src/validate/cycle.rs | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/crates/fj-core/src/algorithms/sweep/edge.rs b/crates/fj-core/src/algorithms/sweep/edge.rs index 45d449714..0336d2c2d 100644 --- a/crates/fj-core/src/algorithms/sweep/edge.rs +++ b/crates/fj-core/src/algorithms/sweep/edge.rs @@ -97,9 +97,8 @@ impl Sweep for (&Edge, &Handle, &Surface, Option) { edge.insert(services) }; - exterior = Some( - exterior.take().unwrap().add_half_edges([edge.clone()]), - ); + exterior = + Some(exterior.take().unwrap().add_edges([edge.clone()])); edge }); diff --git a/crates/fj-core/src/operations/build/cycle.rs b/crates/fj-core/src/operations/build/cycle.rs index bcf3742de..6f9805a8e 100644 --- a/crates/fj-core/src/operations/build/cycle.rs +++ b/crates/fj-core/src/operations/build/cycle.rs @@ -21,7 +21,7 @@ pub trait BuildCycle { services: &mut Services, ) -> Cycle { let circle = Edge::circle(center, radius, services).insert(services); - Cycle::empty().add_half_edges([circle]) + Cycle::empty().add_edges([circle]) } /// Build a polygon diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 11538f1ab..0e4255f11 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -81,7 +81,7 @@ impl JoinCycle for Cycle { >, Es::IntoIter: Clone + ExactSizeIterator, { - self.add_half_edges(edges.into_iter().circular_tuple_windows().map( + self.add_edges(edges.into_iter().circular_tuple_windows().map( |((prev, _, _), (half_edge, curve, boundary))| { Edge::unjoined(curve, boundary, services) .replace_curve(half_edge.curve().clone()) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 4a2ed2657..f5c915deb 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -7,7 +7,7 @@ use crate::{ pub trait UpdateCycle { /// Add half-edges to the cycle #[must_use] - fn add_half_edges( + fn add_edges( &self, half_edges: impl IntoIterator>, ) -> Self; @@ -38,7 +38,7 @@ pub trait UpdateCycle { } impl UpdateCycle for Cycle { - fn add_half_edges( + fn add_edges( &self, half_edges: impl IntoIterator>, ) -> Self { diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 8daea6634..29e1219fb 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -118,7 +118,7 @@ mod tests { let half_edges = half_edges.map(|half_edge| half_edge.insert(&mut services)); - Cycle::empty().add_half_edges(half_edges) + Cycle::empty().add_edges(half_edges) }; assert_contains_err!( From e595b3bb345c4de29f18c47f560eabdcd99ef51b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:51:57 +0200 Subject: [PATCH 52/97] Update argument name --- crates/fj-core/src/operations/update/cycle.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index f5c915deb..08be52bd4 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -7,10 +7,7 @@ use crate::{ pub trait UpdateCycle { /// Add half-edges to the cycle #[must_use] - fn add_edges( - &self, - half_edges: impl IntoIterator>, - ) -> Self; + fn add_edges(&self, edges: impl IntoIterator>) -> Self; /// Replace the provided half-edge /// @@ -38,11 +35,8 @@ pub trait UpdateCycle { } impl UpdateCycle for Cycle { - fn add_edges( - &self, - half_edges: impl IntoIterator>, - ) -> Self { - let half_edges = self.edges().cloned().chain(half_edges); + fn add_edges(&self, edges: impl IntoIterator>) -> Self { + let half_edges = self.edges().cloned().chain(edges); Cycle::new(half_edges) } From ff0b0b7b4ea7d522701236255ee457bc7af750c5 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:52:11 +0200 Subject: [PATCH 53/97] Update trait method name --- crates/fj-core/src/operations/join/cycle.rs | 4 ++-- crates/fj-core/src/operations/update/cycle.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 0e4255f11..d61c75ff3 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -136,8 +136,8 @@ impl JoinCycle for Cycle { next_edge.replace_start_vertex(vertex_b).insert(services); cycle = cycle - .replace_half_edge(half_edge, this_joined) - .replace_half_edge(next_edge, next_joined) + .replace_edge(half_edge, this_joined) + .replace_edge(next_edge, next_joined) } cycle diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 08be52bd4..93fcbc8fa 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -15,7 +15,7 @@ pub trait UpdateCycle { /// /// Panics, unless this operation replaces exactly one half-edge. #[must_use] - fn replace_half_edge( + fn replace_edge( &self, original: &Handle, replacement: Handle, @@ -40,7 +40,7 @@ impl UpdateCycle for Cycle { Cycle::new(half_edges) } - fn replace_half_edge( + fn replace_edge( &self, original: &Handle, replacement: Handle, From 9a63951e3369397e763761510591a6f2982f8beb Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:52:33 +0200 Subject: [PATCH 54/97] Update trait method name --- crates/fj-core/src/operations/build/shell.rs | 12 ++++++------ crates/fj-core/src/operations/update/cycle.rs | 4 ++-- crates/fj-core/src/validate/shell.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/fj-core/src/operations/build/shell.rs b/crates/fj-core/src/operations/build/shell.rs index be0df735b..fddf2e497 100644 --- a/crates/fj-core/src/operations/build/shell.rs +++ b/crates/fj-core/src/operations/build/shell.rs @@ -46,7 +46,7 @@ pub trait BuildShell { region .update_exterior(|cycle| { cycle - .update_nth_half_edge(0, |edge| { + .update_nth_edge(0, |edge| { edge.reverse_curve_coordinate_systems(services) .insert(services) }) @@ -64,7 +64,7 @@ pub trait BuildShell { region .update_exterior(|cycle| { cycle - .update_nth_half_edge(1, |edge| { + .update_nth_edge(1, |edge| { edge.reverse_curve_coordinate_systems(services) .insert(services) }) @@ -74,7 +74,7 @@ pub trait BuildShell { 2..=2, services, ) - .update_nth_half_edge(0, |edge| { + .update_nth_edge(0, |edge| { edge.reverse_curve_coordinate_systems(services) .insert(services) }) @@ -92,7 +92,7 @@ pub trait BuildShell { region .update_exterior(|cycle| { cycle - .update_nth_half_edge(0, |edge| { + .update_nth_edge(0, |edge| { edge.reverse_curve_coordinate_systems(services) .insert(services) }) @@ -102,7 +102,7 @@ pub trait BuildShell { 1..=1, services, ) - .update_nth_half_edge(1, |edge| { + .update_nth_edge(1, |edge| { edge.reverse_curve_coordinate_systems(services) .insert(services) }) @@ -112,7 +112,7 @@ pub trait BuildShell { 2..=2, services, ) - .update_nth_half_edge(2, |edge| { + .update_nth_edge(2, |edge| { edge.reverse_curve_coordinate_systems(services) .insert(services) }) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 93fcbc8fa..3e8dabfe0 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -27,7 +27,7 @@ pub trait UpdateCycle { /// /// Panics, unless this operation updates exactly one half-edge. #[must_use] - fn update_nth_half_edge( + fn update_nth_edge( &self, index: usize, f: impl FnMut(&Handle) -> Handle, @@ -66,7 +66,7 @@ impl UpdateCycle for Cycle { cycle } - fn update_nth_half_edge( + fn update_nth_edge( &self, index: usize, mut f: impl FnMut(&Handle) -> Handle, diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index dfd1f875a..7da5ff595 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -403,7 +403,7 @@ mod tests { region .update_exterior(|cycle| { cycle - .update_nth_half_edge(0, |half_edge| { + .update_nth_edge(0, |half_edge| { half_edge .replace_path( half_edge.path().reverse(), @@ -448,7 +448,7 @@ mod tests { region .update_exterior(|cycle| { cycle - .update_nth_half_edge(0, |half_edge| { + .update_nth_edge(0, |half_edge| { let curve = Curve::new().insert(&mut services); From 862ee1cbe87088ec5cb32b8154adb233ff5fa9da Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:52:47 +0200 Subject: [PATCH 55/97] Update variable name --- crates/fj-core/src/operations/update/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 3e8dabfe0..68f6c569c 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -36,8 +36,8 @@ pub trait UpdateCycle { impl UpdateCycle for Cycle { fn add_edges(&self, edges: impl IntoIterator>) -> Self { - let half_edges = self.edges().cloned().chain(edges); - Cycle::new(half_edges) + let edges = self.edges().cloned().chain(edges); + Cycle::new(edges) } fn replace_edge( From f082e4b3a88d3177629f5d5d145b062827b96891 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:52:59 +0200 Subject: [PATCH 56/97] Update variable name --- crates/fj-core/src/operations/update/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 68f6c569c..c1876b1aa 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -47,7 +47,7 @@ impl UpdateCycle for Cycle { ) -> Self { let mut num_replacements = 0; - let half_edges = self.edges().map(|half_edge| { + let edges = self.edges().map(|half_edge| { if half_edge.id() == original.id() { num_replacements += 1; replacement.clone() @@ -56,7 +56,7 @@ impl UpdateCycle for Cycle { } }); - let cycle = Cycle::new(half_edges); + let cycle = Cycle::new(edges); assert_eq!( num_replacements, 1, From 491b18e9abeceb0a362bb09bdd7c986ff4e51423 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:53:13 +0200 Subject: [PATCH 57/97] Update argument name --- crates/fj-core/src/operations/update/cycle.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index c1876b1aa..4cfc37de5 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -47,12 +47,12 @@ impl UpdateCycle for Cycle { ) -> Self { let mut num_replacements = 0; - let edges = self.edges().map(|half_edge| { - if half_edge.id() == original.id() { + let edges = self.edges().map(|edge| { + if edge.id() == original.id() { num_replacements += 1; replacement.clone() } else { - half_edge.clone() + edge.clone() } }); From 12e8708aae7c409ee262c33b3ee0fb2f47c4b0a2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:53:31 +0200 Subject: [PATCH 58/97] Update variable name --- crates/fj-core/src/operations/update/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 4cfc37de5..977e826bd 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -73,7 +73,7 @@ impl UpdateCycle for Cycle { ) -> Self { let mut num_replacements = 0; - let half_edges = self.edges().enumerate().map(|(i, half_edge)| { + let edges = self.edges().enumerate().map(|(i, half_edge)| { if i == index { num_replacements += 1; f(half_edge) @@ -82,7 +82,7 @@ impl UpdateCycle for Cycle { } }); - let cycle = Cycle::new(half_edges); + let cycle = Cycle::new(edges); assert_eq!( num_replacements, 1, From 2b293675c264d6638c2b3f59242162af5373c4b8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:53:43 +0200 Subject: [PATCH 59/97] Update argument name --- crates/fj-core/src/operations/update/cycle.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 977e826bd..9a1424d89 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -73,12 +73,12 @@ impl UpdateCycle for Cycle { ) -> Self { let mut num_replacements = 0; - let edges = self.edges().enumerate().map(|(i, half_edge)| { + let edges = self.edges().enumerate().map(|(i, edge)| { if i == index { num_replacements += 1; - f(half_edge) + f(edge) } else { - half_edge.clone() + edge.clone() } }); From a9dd5d77995ce3693cd1d073cf3f0725910dd0b6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:54:02 +0200 Subject: [PATCH 60/97] Update variable name --- crates/fj-core/src/algorithms/sweep/face.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/fj-core/src/algorithms/sweep/face.rs b/crates/fj-core/src/algorithms/sweep/face.rs index b98bfd177..be39e0f64 100644 --- a/crates/fj-core/src/algorithms/sweep/face.rs +++ b/crates/fj-core/src/algorithms/sweep/face.rs @@ -61,9 +61,9 @@ impl Sweep for Handle { let cycle = cycle.reverse(services); let mut top_edges = Vec::new(); - for (half_edge, next) in cycle.edge_pairs() { + for (edge, next) in cycle.edge_pairs() { let (face, top_edge) = ( - half_edge.deref(), + edge.deref(), next.start_vertex(), self.surface().deref(), self.region().color(), @@ -72,11 +72,7 @@ impl Sweep for Handle { faces.push(face); - top_edges.push(( - top_edge, - half_edge.path(), - half_edge.boundary(), - )); + top_edges.push((top_edge, edge.path(), edge.boundary())); } let top_cycle = Cycle::empty() From ca4ec585531de8656db864e353d875c0535f7a4d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:54:19 +0200 Subject: [PATCH 61/97] Update variable name --- crates/fj-core/src/algorithms/transform/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/algorithms/transform/cycle.rs b/crates/fj-core/src/algorithms/transform/cycle.rs index 6fb1b1195..cf6ae97e8 100644 --- a/crates/fj-core/src/algorithms/transform/cycle.rs +++ b/crates/fj-core/src/algorithms/transform/cycle.rs @@ -11,12 +11,12 @@ impl TransformObject for Cycle { services: &mut Services, cache: &mut TransformCache, ) -> Self { - let half_edges = self.edges().map(|half_edge| { + let edges = self.edges().map(|half_edge| { half_edge .clone() .transform_with_cache(transform, services, cache) }); - Self::new(half_edges) + Self::new(edges) } } From 42f9f084f154307165bc684018898d249a1ec4b7 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:54:32 +0200 Subject: [PATCH 62/97] Update argument name --- crates/fj-core/src/algorithms/transform/cycle.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/algorithms/transform/cycle.rs b/crates/fj-core/src/algorithms/transform/cycle.rs index cf6ae97e8..8a6d2ff51 100644 --- a/crates/fj-core/src/algorithms/transform/cycle.rs +++ b/crates/fj-core/src/algorithms/transform/cycle.rs @@ -11,9 +11,8 @@ impl TransformObject for Cycle { services: &mut Services, cache: &mut TransformCache, ) -> Self { - let edges = self.edges().map(|half_edge| { - half_edge - .clone() + let edges = self.edges().map(|edge| { + edge.clone() .transform_with_cache(transform, services, cache) }); From b9ecdbf0a1cc32ecdde20fc9fdd0ca851b8f7837 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:55:21 +0200 Subject: [PATCH 63/97] Update variable name --- crates/fj-core/src/objects/set.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/objects/set.rs b/crates/fj-core/src/objects/set.rs index 3c423f859..59b44c30b 100644 --- a/crates/fj-core/src/objects/set.rs +++ b/crates/fj-core/src/objects/set.rs @@ -61,9 +61,9 @@ impl InsertIntoSet for Curve { impl InsertIntoSet for Cycle { fn insert_into_set(&self, objects: &mut ObjectSet) { - for half_edge in self.edges() { - objects.inner.insert(half_edge.clone().into()); - half_edge.insert_into_set(objects); + for edge in self.edges() { + objects.inner.insert(edge.clone().into()); + edge.insert_into_set(objects); } } } From b7f8ab482aa00d1f44a00386bbda6652b3830f29 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:55:35 +0200 Subject: [PATCH 64/97] Update variable name --- crates/fj-core/src/operations/build/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/operations/build/cycle.rs b/crates/fj-core/src/operations/build/cycle.rs index 6f9805a8e..5ecf4211e 100644 --- a/crates/fj-core/src/operations/build/cycle.rs +++ b/crates/fj-core/src/operations/build/cycle.rs @@ -31,7 +31,7 @@ pub trait BuildCycle { Ps: IntoIterator, Ps::IntoIter: Clone + ExactSizeIterator, { - let half_edges = points + let edges = points .into_iter() .map(Into::into) .circular_tuple_windows() @@ -40,7 +40,7 @@ pub trait BuildCycle { .insert(services) }); - Cycle::new(half_edges) + Cycle::new(edges) } } From 31f08e3be35fcbf8c13bc704321f621a8ffddafd Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:55:53 +0200 Subject: [PATCH 65/97] Update variable name --- crates/fj-core/src/operations/build/face.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index d95247bf5..6dda0bd65 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -32,15 +32,14 @@ pub trait BuildFace { let face = Face::polygon(surface, points_surface, services); let edges = { - let mut half_edges = face.region().exterior().edges().cloned(); + let mut edges = face.region().exterior().edges().cloned(); - let array = - array::from_fn(|_| half_edges.next()).map(|half_edge| { - half_edge - .expect("Just asserted that there are three half-edges") - }); + let array = array::from_fn(|_| edges.next()).map(|half_edge| { + half_edge + .expect("Just asserted that there are three half-edges") + }); - assert!(half_edges.next().is_none()); + assert!(edges.next().is_none()); array }; From 9e4e7013ef7f019d7a6e2f52a538d7ad61e15260 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:56:12 +0200 Subject: [PATCH 66/97] Update argument names --- crates/fj-core/src/operations/build/face.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index 6dda0bd65..333cd1c95 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -34,9 +34,8 @@ pub trait BuildFace { let edges = { let mut edges = face.region().exterior().edges().cloned(); - let array = array::from_fn(|_| edges.next()).map(|half_edge| { - half_edge - .expect("Just asserted that there are three half-edges") + let array = array::from_fn(|_| edges.next()).map(|edge| { + edge.expect("Just asserted that there are three half-edges") }); assert!(edges.next().is_none()); @@ -45,7 +44,7 @@ pub trait BuildFace { }; let vertices = edges .each_ref_ext() - .map(|half_edge: &Handle| half_edge.start_vertex().clone()); + .map(|edge: &Handle| edge.start_vertex().clone()); Polygon { face, From 6cb29ab2e8f0ed030f7065a160603e464ae4682d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:56:48 +0200 Subject: [PATCH 67/97] Update argument name --- crates/fj-core/src/operations/join/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index d61c75ff3..32e3fd676 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -82,9 +82,9 @@ impl JoinCycle for Cycle { Es::IntoIter: Clone + ExactSizeIterator, { self.add_edges(edges.into_iter().circular_tuple_windows().map( - |((prev, _, _), (half_edge, curve, boundary))| { + |((prev, _, _), (edge, curve, boundary))| { Edge::unjoined(curve, boundary, services) - .replace_curve(half_edge.curve().clone()) + .replace_curve(edge.curve().clone()) .replace_start_vertex(prev.start_vertex().clone()) .insert(services) }, From 650727da51273ff92c10ddaa31154d016f096e48 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:57:04 +0200 Subject: [PATCH 68/97] Update variable name --- crates/fj-core/src/operations/join/cycle.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 32e3fd676..1d64e5bfa 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -110,7 +110,7 @@ impl JoinCycle for Cycle { let index = index % self.len(); let index_other = index_other % self.len(); - let half_edge = self + let edge = self .nth_edge(index) .expect("Index must be valid, due to use of `%` above"); let half_edge_other = other @@ -125,10 +125,10 @@ impl JoinCycle for Cycle { let vertex_b = half_edge_other.start_vertex().clone(); let next_edge = cycle - .edge_after(half_edge) + .edge_after(edge) .expect("Cycle must contain edge; just obtained edge from it"); - let this_joined = half_edge + let this_joined = edge .replace_curve(half_edge_other.curve().clone()) .replace_start_vertex(vertex_a) .insert(services); @@ -136,7 +136,7 @@ impl JoinCycle for Cycle { next_edge.replace_start_vertex(vertex_b).insert(services); cycle = cycle - .replace_edge(half_edge, this_joined) + .replace_edge(edge, this_joined) .replace_edge(next_edge, next_joined) } From 2411f67ce58c33a20877e0508d56e0a64669dc1e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:57:20 +0200 Subject: [PATCH 69/97] Update variable name --- crates/fj-core/src/operations/join/cycle.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 1d64e5bfa..719858853 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -113,23 +113,23 @@ impl JoinCycle for Cycle { let edge = self .nth_edge(index) .expect("Index must be valid, due to use of `%` above"); - let half_edge_other = other + let edge_other = other .nth_edge(index_other) .expect("Index must be valid, due to use of `%` above"); let vertex_a = other - .edge_after(half_edge_other) + .edge_after(edge_other) .expect("Cycle must contain edge; just obtained edge from it") .start_vertex() .clone(); - let vertex_b = half_edge_other.start_vertex().clone(); + let vertex_b = edge_other.start_vertex().clone(); let next_edge = cycle .edge_after(edge) .expect("Cycle must contain edge; just obtained edge from it"); let this_joined = edge - .replace_curve(half_edge_other.curve().clone()) + .replace_curve(edge_other.curve().clone()) .replace_start_vertex(vertex_a) .insert(services); let next_joined = From e2a1d50e3b0b2c3f8b54ab870b0827331c8e472e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:57:38 +0200 Subject: [PATCH 70/97] Update argument name --- crates/fj-core/src/queries/all_edges_with_surface.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/queries/all_edges_with_surface.rs b/crates/fj-core/src/queries/all_edges_with_surface.rs index 44a3b4574..809112594 100644 --- a/crates/fj-core/src/queries/all_edges_with_surface.rs +++ b/crates/fj-core/src/queries/all_edges_with_surface.rs @@ -22,7 +22,7 @@ impl AllEdgesWithSurface for Face { cycle .edges() .cloned() - .map(|half_edge| (half_edge, self.surface().clone())), + .map(|edge| (edge, self.surface().clone())), ); } } From 44bb3a9a82a79f613f7787877e28399ebf7a0572 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:58:12 +0200 Subject: [PATCH 71/97] Update method name --- crates/fj-core/src/validate/cycle.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 29e1219fb..b878b0c60 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -10,9 +10,7 @@ impl Validate for Cycle { config: &ValidationConfig, errors: &mut Vec, ) { - CycleValidationError::check_half_edges_disconnected( - self, config, errors, - ); + CycleValidationError::check_edges_disconnected(self, config, errors); CycleValidationError::check_enough_half_edges(self, config, errors); } } @@ -58,7 +56,7 @@ impl CycleValidationError { } } - fn check_half_edges_disconnected( + fn check_edges_disconnected( cycle: &Cycle, config: &ValidationConfig, errors: &mut Vec, From 977dc62ecf625b6f6d5b12c89886b7b165f13d50 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:58:24 +0200 Subject: [PATCH 72/97] Update method name --- crates/fj-core/src/validate/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index b878b0c60..0e7c2f5dc 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -11,7 +11,7 @@ impl Validate for Cycle { errors: &mut Vec, ) { CycleValidationError::check_edges_disconnected(self, config, errors); - CycleValidationError::check_enough_half_edges(self, config, errors); + CycleValidationError::check_enough_edges(self, config, errors); } } @@ -45,7 +45,7 @@ pub enum CycleValidationError { } impl CycleValidationError { - fn check_enough_half_edges( + fn check_enough_edges( cycle: &Cycle, _config: &ValidationConfig, errors: &mut Vec, From 30946cce0b0dffcd7766489bb8b1d67ab01c4f6a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:59:10 +0200 Subject: [PATCH 73/97] Update field name --- crates/fj-core/src/validate/cycle.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 0e7c2f5dc..4fad9d9c9 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -23,7 +23,7 @@ pub enum CycleValidationError { "Adjacent `Edge`s are distinct\n\ - End position of first `Edge`: {end_of_first:?}\n\ - Start position of second `Edge`: {start_of_second:?}\n\ - - `Edge`s: {half_edges:#?}" + - `Edge`s: {edges:#?}" )] EdgesDisconnected { /// The end position of the first [`Edge`] @@ -36,7 +36,7 @@ pub enum CycleValidationError { distance: Scalar, /// The half-edge - half_edges: Box<(Edge, Edge)>, + edges: Box<(Edge, Edge)>, }, /// [`Cycle`]'s should have at least one [`Edge`] @@ -76,7 +76,7 @@ impl CycleValidationError { end_of_first, start_of_second, distance, - half_edges: Box::new(( + edges: Box::new(( first.clone_object(), second.clone_object(), )), From 8dd00b67b18bf6971062a7f45bfb515d7b87536a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 12:59:55 +0200 Subject: [PATCH 74/97] Update test name --- crates/fj-core/src/validate/cycle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 4fad9d9c9..5bacf6684 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -100,7 +100,7 @@ mod tests { }; #[test] - fn half_edges_connected() -> anyhow::Result<()> { + fn edges_connected() -> anyhow::Result<()> { let mut services = Services::new(); let valid = From 8dd60438fc1f38c388ab38fc8f705f12af92a5e6 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:00:10 +0200 Subject: [PATCH 75/97] Update variable names --- crates/fj-core/src/validate/cycle.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 5bacf6684..792cce50c 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -109,14 +109,13 @@ mod tests { valid.validate_and_return_first_error()?; let disconnected = { - let half_edges = [ + let edges = [ Edge::line_segment([[0., 0.], [1., 0.]], None, &mut services), Edge::line_segment([[0., 0.], [1., 0.]], None, &mut services), ]; - let half_edges = - half_edges.map(|half_edge| half_edge.insert(&mut services)); + let edges = edges.map(|half_edge| half_edge.insert(&mut services)); - Cycle::empty().add_edges(half_edges) + Cycle::empty().add_edges(edges) }; assert_contains_err!( From bcec284b6276f03398e4a6abb31c67c8dea7a09c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:00:35 +0200 Subject: [PATCH 76/97] Update argument name --- crates/fj-core/src/validate/cycle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 792cce50c..440f926f1 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -113,7 +113,7 @@ mod tests { Edge::line_segment([[0., 0.], [1., 0.]], None, &mut services), Edge::line_segment([[0., 0.], [1., 0.]], None, &mut services), ]; - let edges = edges.map(|half_edge| half_edge.insert(&mut services)); + let edges = edges.map(|edge| edge.insert(&mut services)); Cycle::empty().add_edges(edges) }; From 80de38a116879030e4344e6c3ced099ff8c52ed2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:00:58 +0200 Subject: [PATCH 77/97] Update field name --- crates/fj-core/src/validate/edge.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index 55ee7edc2..f96fe4596 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -22,7 +22,7 @@ pub enum EdgeValidationError { "Vertices of `Edge` on curve are coincident\n\ - Position of back vertex: {back_position:?}\n\ - Position of front vertex: {front_position:?}\n\ - - `Edge`: {half_edge:#?}" + - `Edge`: {edge:#?}" )] VerticesAreCoincident { /// The position of the back vertex @@ -35,7 +35,7 @@ pub enum EdgeValidationError { distance: Scalar, /// The half-edge - half_edge: Edge, + edge: Edge, }, } @@ -54,7 +54,7 @@ impl EdgeValidationError { back_position, front_position, distance, - half_edge: half_edge.clone(), + edge: half_edge.clone(), } .into(), ); From 0154f69b05174163d847fc9a80c5876d1989ad5c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:01:10 +0200 Subject: [PATCH 78/97] Update argument name --- crates/fj-core/src/validate/edge.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index f96fe4596..acf3e36cd 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -41,11 +41,11 @@ pub enum EdgeValidationError { impl EdgeValidationError { fn check_vertex_coincidence( - half_edge: &Edge, + edge: &Edge, config: &ValidationConfig, errors: &mut Vec, ) { - let [back_position, front_position] = half_edge.boundary().inner; + let [back_position, front_position] = edge.boundary().inner; let distance = (back_position - front_position).magnitude(); if distance < config.distinct_min_distance { @@ -54,7 +54,7 @@ impl EdgeValidationError { back_position, front_position, distance, - edge: half_edge.clone(), + edge: edge.clone(), } .into(), ); From 3152cf32bafa09babf2f2b54b1f8ddcda415c82a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:01:26 +0200 Subject: [PATCH 79/97] Update test name --- crates/fj-core/src/validate/edge.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index acf3e36cd..a8a5172bc 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -75,7 +75,7 @@ mod tests { }; #[test] - fn half_edge_vertices_are_coincident() -> anyhow::Result<()> { + fn edge_vertices_are_coincident() -> anyhow::Result<()> { let mut services = Services::new(); let valid = From 9dfee8772f1eb934a584f9d170adc922c6116117 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:01:40 +0200 Subject: [PATCH 80/97] Update variable name --- crates/fj-core/src/validate/shell.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 7da5ff595..7e405c5d6 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -299,10 +299,10 @@ impl ShellValidationError { for face in shell.faces() { for cycle in face.region().all_cycles() { - for half_edge in cycle.edges() { - let curve = HandleWrapper::from(half_edge.curve().clone()); + for edge in cycle.edges() { + let curve = HandleWrapper::from(edge.curve().clone()); let bounding_vertices = cycle - .bounding_vertices_of_edge(half_edge) + .bounding_vertices_of_edge(edge) .expect( "Cycle should provide bounds of its own half-edge", ) From 53ff3254860fcd41dec2a070c08b5bb6673d99b8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:01:56 +0200 Subject: [PATCH 81/97] Update argument name --- crates/fj-core/src/validate/shell.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 7e405c5d6..2e5ffc623 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -403,13 +403,10 @@ mod tests { region .update_exterior(|cycle| { cycle - .update_nth_edge(0, |half_edge| { - half_edge - .replace_path( - half_edge.path().reverse(), - ) + .update_nth_edge(0, |edge| { + edge.replace_path(edge.path().reverse()) .replace_boundary( - half_edge.boundary().reverse(), + edge.boundary().reverse(), ) .insert(&mut services) }) From 16bc07fb6b8ff2a9dcbc782cd842721cdd4ef1a9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:02:11 +0200 Subject: [PATCH 82/97] Update argument name --- crates/fj-core/src/validate/shell.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 2e5ffc623..8435ca6c9 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -445,12 +445,11 @@ mod tests { region .update_exterior(|cycle| { cycle - .update_nth_edge(0, |half_edge| { + .update_nth_edge(0, |edge| { let curve = Curve::new().insert(&mut services); - half_edge - .replace_curve(curve) + edge.replace_curve(curve) .insert(&mut services) }) .insert(&mut services) From cbacb462a2f639af7798133350cbd8788cac5e32 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:02:38 +0200 Subject: [PATCH 83/97] Update documentation of `Object` --- crates/fj-core/src/objects/object.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/objects/object.rs b/crates/fj-core/src/objects/object.rs index be9e86553..d6b465bf8 100644 --- a/crates/fj-core/src/objects/object.rs +++ b/crates/fj-core/src/objects/object.rs @@ -94,7 +94,7 @@ object!( Curve, "curve", curves; Cycle, "cycle", cycles; Face, "face", faces; - Edge, "half-edge", edges; + Edge, "edge", edges; Region, "region", regions; Shell, "shell", shells; Sketch, "sketch", sketches; From 04192feac5fcddde99ab3dc34ae0960864c9fc3e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:03:32 +0200 Subject: [PATCH 84/97] Update documentation of `Cycle` --- crates/fj-core/src/objects/kinds/cycle.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 84349b51c..787723f01 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -3,7 +3,7 @@ use itertools::Itertools; use crate::{geometry::SurfacePath, objects::Edge, storage::Handle}; -/// A cycle of connected half-edges +/// A cycle of connected edges #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Cycle { edges: Vec>, @@ -16,24 +16,24 @@ impl Cycle { Self { edges } } - /// Access the half-edges that make up the cycle + /// Access the edges that make up the cycle pub fn edges(&self) -> impl Iterator> { self.edges.iter() } - /// Access the half-edges in pairs + /// Access neighboring edges in pairs pub fn edge_pairs( &self, ) -> impl Iterator, &Handle)> { self.edges.iter().circular_tuple_windows() } - /// Access the half-edge with the provided index + /// Access the edge with the provided index pub fn nth_edge(&self, index: usize) -> Option<&Handle> { self.edges.get(index) } - /// Access the half-edge after the provided one + /// Access the edge after the provided one /// /// Returns `None`, if the provided [`Edge`] is not part of the cycle. pub fn edge_after(&self, edge: &Handle) -> Option<&Handle> { @@ -43,12 +43,12 @@ impl Cycle { }) } - /// Return the index of the provided half-edge, if it is in this cycle + /// Return the index of the provided edge, if it is in this cycle pub fn index_of(&self, edge: &Handle) -> Option { self.edges.iter().position(|e| e.id() == edge.id()) } - /// Return the number of half-edges in the cycle + /// Return the number of edges in the cycle pub fn len(&self) -> usize { self.edges.len() } From a986cdf096d171a43fefff30ea1fa2ecb18e1b6c Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:03:50 +0200 Subject: [PATCH 85/97] Update panic message --- crates/fj-core/src/objects/kinds/cycle.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/objects/kinds/cycle.rs b/crates/fj-core/src/objects/kinds/cycle.rs index 787723f01..0af5f5b87 100644 --- a/crates/fj-core/src/objects/kinds/cycle.rs +++ b/crates/fj-core/src/objects/kinds/cycle.rs @@ -71,7 +71,7 @@ impl Cycle { let first = self .edges() .next() - .expect("Invalid cycle: expected at least one half-edge"); + .expect("Invalid cycle: expected at least one edge"); let [a, b] = first.boundary().inner; let edge_direction_positive = a < b; From f3a604a2e7a5b68ee10460fccfe7dcb308da91dd Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:04:19 +0200 Subject: [PATCH 86/97] Update documentation of `Edge` --- crates/fj-core/src/objects/kinds/edge.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/objects/kinds/edge.rs b/crates/fj-core/src/objects/kinds/edge.rs index 1dc01d19e..d7e895984 100644 --- a/crates/fj-core/src/objects/kinds/edge.rs +++ b/crates/fj-core/src/objects/kinds/edge.rs @@ -53,17 +53,17 @@ impl Edge { } } - /// Access the curve that defines the half-edge's geometry + /// Access the curve that defines the edge's geometry pub fn path(&self) -> SurfacePath { self.path } - /// Access the boundary points of the half-edge on the curve + /// Access the boundary points of the edge on the curve pub fn boundary(&self) -> CurveBoundary> { self.boundary } - /// Compute the surface position where the half-edge starts + /// Compute the surface position where the edge starts pub fn start_position(&self) -> Point<2> { // Computing the surface position from the curve position is fine. // `Edge` "owns" its start position. There is no competing code that @@ -73,12 +73,12 @@ impl Edge { self.path.point_from_path_coords(start) } - /// Access the curve of the half-edge + /// Access the curve of the edge pub fn curve(&self) -> &Handle { &self.curve } - /// Access the vertex from where this half-edge starts + /// Access the vertex from where this edge starts pub fn start_vertex(&self) -> &Handle { &self.start_vertex } From cccf70397dc0c3ffa8fc4471f53b1cf473e6fb3e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:04:45 +0200 Subject: [PATCH 87/97] Update documentation of `BuildEdge` --- crates/fj-core/src/operations/build/edge.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/operations/build/edge.rs b/crates/fj-core/src/operations/build/edge.rs index 82b6e12d1..fd33b319e 100644 --- a/crates/fj-core/src/operations/build/edge.rs +++ b/crates/fj-core/src/operations/build/edge.rs @@ -10,7 +10,7 @@ use crate::{ /// Build an [`Edge`] pub trait BuildEdge { - /// Create a half-edge that is not joined to another + /// Create an edge that is not joined to another fn unjoined( path: SurfacePath, boundary: impl Into>>, From ac09efcef4239b9323cd305cb5fe39144c93d457 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:04:59 +0200 Subject: [PATCH 88/97] Update panic message --- crates/fj-core/src/operations/build/face.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/operations/build/face.rs b/crates/fj-core/src/operations/build/face.rs index 333cd1c95..0e56b2665 100644 --- a/crates/fj-core/src/operations/build/face.rs +++ b/crates/fj-core/src/operations/build/face.rs @@ -35,7 +35,7 @@ pub trait BuildFace { let mut edges = face.region().exterior().edges().cloned(); let array = array::from_fn(|_| edges.next()).map(|edge| { - edge.expect("Just asserted that there are three half-edges") + edge.expect("Just asserted that there are three edges") }); assert!(edges.next().is_none()); From 2801c1dbc7ca6f6d2f87226685151245bbe82ddb Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:05:49 +0200 Subject: [PATCH 89/97] Update documentation of `JoinCycle` --- crates/fj-core/src/operations/join/cycle.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 719858853..0d99907ba 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -25,11 +25,11 @@ pub trait JoinCycle { /// Join the cycle to another /// /// Joins the cycle to the other at the provided ranges. The ranges specify - /// the indices of the half-edges that are joined together. + /// the indices of the edges that are joined together. /// /// A modulo operation is applied to all indices before use, so in a cycle - /// of 3 half-edges, indices `0` and `3` refer to the same half-edge. This - /// allows for specifying a range that crosses the "seam" of the cycle. + /// of 3 edges, indices `0` and `3` refer to the same edge. This allows for + /// specifying a range that crosses the "seam" of the cycle. /// /// # Panics /// @@ -40,7 +40,7 @@ pub trait JoinCycle { /// This method makes some assumptions that need to be met, if the operation /// is to result in a valid shape: /// - /// - **The joined half-edges must be coincident.** + /// - **The joined edges must be coincident.** /// - **The locally defined curve coordinate systems of the edges must /// match.** /// From fd078a18b488dc28bbc7bf713844d9b791e26739 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:06:24 +0200 Subject: [PATCH 90/97] Update documentation of `UpdateCycle` --- crates/fj-core/src/operations/update/cycle.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index 9a1424d89..aebc4e59a 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -5,15 +5,15 @@ use crate::{ /// Update a [`Cycle`] pub trait UpdateCycle { - /// Add half-edges to the cycle + /// Add edges to the cycle #[must_use] fn add_edges(&self, edges: impl IntoIterator>) -> Self; - /// Replace the provided half-edge + /// Replace the provided edge /// /// # Panics /// - /// Panics, unless this operation replaces exactly one half-edge. + /// Panics, unless this operation replaces exactly one edge. #[must_use] fn replace_edge( &self, @@ -21,11 +21,11 @@ pub trait UpdateCycle { replacement: Handle, ) -> Self; - /// Update the half-edge at the given index + /// Update the edge at the given index /// /// # Panics /// - /// Panics, unless this operation updates exactly one half-edge. + /// Panics, unless this operation updates exactly one edge. #[must_use] fn update_nth_edge( &self, From c3e00fec47c737a9548928c1d4dec7ee5fd38dbb Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:06:39 +0200 Subject: [PATCH 91/97] Update panic messages --- crates/fj-core/src/operations/update/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index aebc4e59a..4d23ab6d7 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -60,7 +60,7 @@ impl UpdateCycle for Cycle { assert_eq!( num_replacements, 1, - "Expected operation to replace exactly one half-edge" + "Expected operation to replace exactly one edge" ); cycle @@ -86,7 +86,7 @@ impl UpdateCycle for Cycle { assert_eq!( num_replacements, 1, - "Expected operation to replace exactly one half-edge" + "Expected operation to replace exactly one edge" ); cycle From 6bde9f070d39c173ebdc76cba2c92e15e8ae0e69 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:07:03 +0200 Subject: [PATCH 92/97] Update documentation of `UpdateEdge` --- crates/fj-core/src/operations/update/edge.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/operations/update/edge.rs b/crates/fj-core/src/operations/update/edge.rs index 42ac10a32..2db76fec5 100644 --- a/crates/fj-core/src/operations/update/edge.rs +++ b/crates/fj-core/src/operations/update/edge.rs @@ -8,19 +8,19 @@ use crate::{ /// Update a [`Edge`] pub trait UpdateEdge { - /// Replace the path of the half-edge + /// Replace the path of the edge #[must_use] fn replace_path(&self, path: SurfacePath) -> Self; - /// Replace the boundary of the half-edge + /// Replace the boundary of the edge #[must_use] fn replace_boundary(&self, boundary: CurveBoundary>) -> Self; - /// Replace the curve of the half-edge + /// Replace the curve of the edge #[must_use] fn replace_curve(&self, curve: Handle) -> Self; - /// Replace the start vertex of the half-edge + /// Replace the start vertex of the edge #[must_use] fn replace_start_vertex(&self, start_vertex: Handle) -> Self; } From ac75a5fdb071181ab5c34c3ca5805971d11cc606 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:07:27 +0200 Subject: [PATCH 93/97] Update documentation of `CycleValidationError` --- crates/fj-core/src/validate/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 440f926f1..e3e26834f 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -18,7 +18,7 @@ impl Validate for Cycle { /// [`Cycle`] validation failed #[derive(Clone, Debug, thiserror::Error)] pub enum CycleValidationError { - /// [`Cycle`]'s half-edges are not connected + /// [`Cycle`]'s edges are not connected #[error( "Adjacent `Edge`s are distinct\n\ - End position of first `Edge`: {end_of_first:?}\n\ @@ -35,7 +35,7 @@ pub enum CycleValidationError { /// The distance between the two vertices distance: Scalar, - /// The half-edge + /// The edges edges: Box<(Edge, Edge)>, }, From 4ca75f5e53ce26e36c8cdb43664c56a8fa411d06 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:07:45 +0200 Subject: [PATCH 94/97] Update documentation of `EdgeValidationError` --- crates/fj-core/src/validate/edge.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index a8a5172bc..d52d301c5 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -34,7 +34,7 @@ pub enum EdgeValidationError { /// The distance between the two vertices distance: Scalar, - /// The half-edge + /// The edge edge: Edge, }, } From 207576f65f4d93be8263632d4cd5bf60a013b81f Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:08:22 +0200 Subject: [PATCH 95/97] Update comments --- crates/fj-core/src/validate/face.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/validate/face.rs b/crates/fj-core/src/validate/face.rs index 3eb995780..7c336d199 100644 --- a/crates/fj-core/src/validate/face.rs +++ b/crates/fj-core/src/validate/face.rs @@ -39,8 +39,8 @@ pub enum FaceValidationError { impl FaceValidationError { fn check_interior_winding(face: &Face, errors: &mut Vec) { if face.region().exterior().edges().count() == 0 { - // Can't determine winding, if the cycle has no half-edges. Sounds - // like a job for a different validation check. + // Can't determine winding, if the cycle has no edges. Sounds like a + // job for a different validation check. return; } @@ -48,8 +48,8 @@ impl FaceValidationError { for interior in face.region().interiors() { if interior.edges().count() == 0 { - // Can't determine winding, if the cycle has no half-edges. - // Sounds like a job for a different validation check. + // Can't determine winding, if the cycle has no edges. Sounds + // like a job for a different validation check. continue; } let interior_winding = interior.winding(); From c6df4c9d1842c34224155763e963bcb0d3efcf09 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:09:21 +0200 Subject: [PATCH 96/97] Update documentation of `ShellValidationError` --- crates/fj-core/src/validate/shell.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 8435ca6c9..5c522a577 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -35,12 +35,11 @@ pub enum ShellValidationError { )] CurveCoordinateSystemMismatch(Vec), - /// [`Shell`] contains global_edges not referred to by two half-edges + /// [`Shell`] is not watertight #[error("Shell is not watertight")] NotWatertight, - /// [`Shell`] contains half-edges that are coincident, but refer to - /// different global_edges + /// [`Shell`] contains edges that are coincident, but not identical #[error( "`Shell` contains `Edge`s that are coincident but refer to different \ `Curve`s\n\ @@ -49,7 +48,7 @@ pub enum ShellValidationError { )] CoincidentEdgesNotIdentical(Handle, Handle), - /// [`Shell`] contains half-edges that are identical, but do not coincide + /// [`Shell`] contains edges that are identical, but do not coincide #[error( "Shell contains `Edge`s that are identical but do not coincide\n\ Edge 1: {edge_a:#?}\n\ From 93bac1994640ea910f09ba06c8fb2b1c748c81d0 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 18 Aug 2023 13:09:42 +0200 Subject: [PATCH 97/97] Update panic message --- crates/fj-core/src/validate/shell.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 5c522a577..fa914bc5d 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -302,9 +302,7 @@ impl ShellValidationError { let curve = HandleWrapper::from(edge.curve().clone()); let bounding_vertices = cycle .bounding_vertices_of_edge(edge) - .expect( - "Cycle should provide bounds of its own half-edge", - ) + .expect("Cycle should provide bounds of its own edge") .normalize(); let edge = (curve, bounding_vertices);