mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-21 09:26:10 +00:00
Shorten HalfEdgeGeometry
to HalfEdgeGeom
Geometry is a very common concept within `fj-core`, and `HalfEdgeGeometry` is used in many places. A shorthand seems justified.
This commit is contained in:
parent
9e67c4b8c6
commit
2b49b57faf
@ -6,7 +6,7 @@ use fj_math::Point;
|
||||
|
||||
use crate::{
|
||||
geometry::{
|
||||
CurveBoundary, Geometry, GlobalPath, HalfEdgeGeometry, SurfaceGeometry,
|
||||
CurveBoundary, Geometry, GlobalPath, HalfEdgeGeom, SurfaceGeometry,
|
||||
SurfacePath,
|
||||
},
|
||||
storage::Handle,
|
||||
@ -15,7 +15,7 @@ use crate::{
|
||||
|
||||
use super::{Approx, ApproxPoint, Tolerance};
|
||||
|
||||
impl Approx for (&Handle<Curve>, &HalfEdgeGeometry, &Handle<Surface>) {
|
||||
impl Approx for (&Handle<Curve>, &HalfEdgeGeom, &Handle<Surface>) {
|
||||
type Approximation = CurveApprox;
|
||||
type Cache = CurveApproxCache;
|
||||
|
||||
@ -182,7 +182,7 @@ mod tests {
|
||||
|
||||
use crate::{
|
||||
algorithms::approx::{Approx, ApproxPoint},
|
||||
geometry::{CurveBoundary, GlobalPath, HalfEdgeGeometry, SurfacePath},
|
||||
geometry::{CurveBoundary, GlobalPath, HalfEdgeGeom, SurfacePath},
|
||||
operations::{build::BuildSurface, insert::Insert},
|
||||
topology::{Curve, Surface},
|
||||
Core,
|
||||
@ -196,7 +196,7 @@ mod tests {
|
||||
let (path, boundary) =
|
||||
SurfacePath::line_from_points([[1., 1.], [2., 1.]]);
|
||||
let boundary = CurveBoundary::from(boundary);
|
||||
let half_edge = HalfEdgeGeometry { path, boundary };
|
||||
let half_edge = HalfEdgeGeom { path, boundary };
|
||||
let surface = core.layers.topology.surfaces.xz_plane();
|
||||
|
||||
let tolerance = 1.;
|
||||
@ -214,7 +214,7 @@ mod tests {
|
||||
let (path, boundary) =
|
||||
SurfacePath::line_from_points([[1., 1.], [2., 1.]]);
|
||||
let boundary = CurveBoundary::from(boundary);
|
||||
let half_edge = HalfEdgeGeometry { path, boundary };
|
||||
let half_edge = HalfEdgeGeom { path, boundary };
|
||||
let surface = Surface::from_uv(
|
||||
GlobalPath::circle_from_radius(1.),
|
||||
[0., 0., 1.],
|
||||
@ -239,7 +239,7 @@ mod tests {
|
||||
([TAU], [TAU, 1.]),
|
||||
]);
|
||||
let boundary = CurveBoundary::from([[0.], [TAU]]);
|
||||
let half_edge = HalfEdgeGeometry { path, boundary };
|
||||
let half_edge = HalfEdgeGeom { path, boundary };
|
||||
let surface = Surface::from_uv(global_path, [0., 0., 1.], &mut core);
|
||||
|
||||
let tolerance = 1.;
|
||||
@ -269,7 +269,7 @@ mod tests {
|
||||
let curve = Curve::new().insert(&mut core);
|
||||
let path = SurfacePath::circle_from_center_and_radius([0., 0.], 1.);
|
||||
let boundary = CurveBoundary::from([[0.], [TAU]]);
|
||||
let half_edge = HalfEdgeGeometry { path, boundary };
|
||||
let half_edge = HalfEdgeGeom { path, boundary };
|
||||
let surface = core.layers.topology.surfaces.xz_plane();
|
||||
|
||||
let tolerance = 1.;
|
||||
|
@ -7,11 +7,11 @@ use crate::{
|
||||
topology::{HalfEdge, Surface, Topology},
|
||||
};
|
||||
|
||||
use super::{GlobalPath, HalfEdgeGeometry, SurfaceGeometry};
|
||||
use super::{GlobalPath, HalfEdgeGeom, SurfaceGeometry};
|
||||
|
||||
/// Geometric data that is associated with topological objects
|
||||
pub struct Geometry {
|
||||
half_edge: BTreeMap<Handle<HalfEdge>, HalfEdgeGeometry>,
|
||||
half_edge: BTreeMap<Handle<HalfEdge>, HalfEdgeGeom>,
|
||||
surface: BTreeMap<Handle<Surface>, SurfaceGeometry>,
|
||||
|
||||
xy_plane: Handle<Surface>,
|
||||
@ -59,7 +59,7 @@ impl Geometry {
|
||||
pub(crate) fn define_half_edge_inner(
|
||||
&mut self,
|
||||
half_edge: Handle<HalfEdge>,
|
||||
geometry: HalfEdgeGeometry,
|
||||
geometry: HalfEdgeGeom,
|
||||
) {
|
||||
self.half_edge.insert(half_edge, geometry);
|
||||
}
|
||||
@ -77,10 +77,7 @@ impl Geometry {
|
||||
/// ## Panics
|
||||
///
|
||||
/// Panics, if the geometry of the half-edge is not defined.
|
||||
pub fn of_half_edge(
|
||||
&self,
|
||||
half_edge: &Handle<HalfEdge>,
|
||||
) -> &HalfEdgeGeometry {
|
||||
pub fn of_half_edge(&self, half_edge: &Handle<HalfEdge>) -> &HalfEdgeGeom {
|
||||
self.half_edge
|
||||
.get(half_edge)
|
||||
.expect("Expected geometry of half-edge to be defined")
|
||||
|
@ -4,7 +4,7 @@ use super::{CurveBoundary, SurfacePath};
|
||||
|
||||
/// The geometry of a half-edge
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct HalfEdgeGeometry {
|
||||
pub struct HalfEdgeGeom {
|
||||
/// # The path of the half-edge
|
||||
///
|
||||
/// ## Implementation Note
|
||||
@ -36,7 +36,7 @@ pub struct HalfEdgeGeometry {
|
||||
pub boundary: CurveBoundary<Point<1>>,
|
||||
}
|
||||
|
||||
impl HalfEdgeGeometry {
|
||||
impl HalfEdgeGeom {
|
||||
/// Update the boundary
|
||||
pub fn with_boundary(
|
||||
mut self,
|
||||
|
@ -9,7 +9,7 @@ mod surface;
|
||||
pub use self::{
|
||||
boundary::{CurveBoundary, CurveBoundaryElement},
|
||||
geometry::Geometry,
|
||||
half_edge::HalfEdgeGeometry,
|
||||
half_edge::HalfEdgeGeom,
|
||||
path::{GlobalPath, SurfacePath},
|
||||
surface::SurfaceGeometry,
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Layer infrastructure for [`Geometry`]
|
||||
|
||||
use crate::{
|
||||
geometry::{Geometry, HalfEdgeGeometry, SurfaceGeometry},
|
||||
geometry::{Geometry, HalfEdgeGeom, SurfaceGeometry},
|
||||
storage::Handle,
|
||||
topology::{HalfEdge, Surface},
|
||||
};
|
||||
@ -13,7 +13,7 @@ impl Layer<Geometry> {
|
||||
pub fn define_half_edge(
|
||||
&mut self,
|
||||
half_edge: Handle<HalfEdge>,
|
||||
geometry: HalfEdgeGeometry,
|
||||
geometry: HalfEdgeGeom,
|
||||
) {
|
||||
let mut events = Vec::new();
|
||||
self.process(
|
||||
@ -39,7 +39,7 @@ impl Layer<Geometry> {
|
||||
/// Define the geometry of a half-edge
|
||||
pub struct DefineHalfEdge {
|
||||
half_edge: Handle<HalfEdge>,
|
||||
geometry: HalfEdgeGeometry,
|
||||
geometry: HalfEdgeGeom,
|
||||
}
|
||||
|
||||
impl Command<Geometry> for DefineHalfEdge {
|
||||
|
@ -2,7 +2,7 @@ use fj_interop::ext::ArrayExt;
|
||||
use fj_math::{Arc, Point, Scalar};
|
||||
|
||||
use crate::{
|
||||
geometry::{HalfEdgeGeometry, SurfacePath},
|
||||
geometry::{HalfEdgeGeom, SurfacePath},
|
||||
operations::{geometry::UpdateHalfEdgeGeometry, insert::Insert},
|
||||
storage::Handle,
|
||||
topology::{Curve, HalfEdge, Vertex},
|
||||
@ -63,7 +63,7 @@ pub trait BuildHalfEdge {
|
||||
let half_edge = HalfEdge::unjoined(core).insert(core);
|
||||
core.layers.geometry.define_half_edge(
|
||||
half_edge.clone(),
|
||||
HalfEdgeGeometry {
|
||||
HalfEdgeGeom {
|
||||
path,
|
||||
boundary: boundary.into(),
|
||||
},
|
||||
@ -85,7 +85,7 @@ pub trait BuildHalfEdge {
|
||||
let half_edge = HalfEdge::unjoined(core).insert(core);
|
||||
core.layers.geometry.define_half_edge(
|
||||
half_edge.clone(),
|
||||
HalfEdgeGeometry {
|
||||
HalfEdgeGeom {
|
||||
path,
|
||||
boundary: boundary.into(),
|
||||
},
|
||||
@ -107,7 +107,7 @@ pub trait BuildHalfEdge {
|
||||
);
|
||||
|
||||
HalfEdge::unjoined(core).insert(core).set_geometry(
|
||||
HalfEdgeGeometry {
|
||||
HalfEdgeGeom {
|
||||
path,
|
||||
boundary: boundary.into(),
|
||||
},
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
geometry::{Geometry, HalfEdgeGeometry},
|
||||
geometry::{Geometry, HalfEdgeGeom},
|
||||
layers::Layer,
|
||||
storage::Handle,
|
||||
topology::HalfEdge,
|
||||
@ -10,7 +10,7 @@ pub trait UpdateHalfEdgeGeometry {
|
||||
/// Set the path of the half-edge
|
||||
fn set_geometry(
|
||||
self,
|
||||
geometry: HalfEdgeGeometry,
|
||||
geometry: HalfEdgeGeom,
|
||||
layer: &mut Layer<Geometry>,
|
||||
) -> Self;
|
||||
}
|
||||
@ -18,7 +18,7 @@ pub trait UpdateHalfEdgeGeometry {
|
||||
impl UpdateHalfEdgeGeometry for Handle<HalfEdge> {
|
||||
fn set_geometry(
|
||||
self,
|
||||
geometry: HalfEdgeGeometry,
|
||||
geometry: HalfEdgeGeom,
|
||||
layer: &mut Layer<Geometry>,
|
||||
) -> Self {
|
||||
layer.define_half_edge(self.clone(), geometry);
|
||||
|
@ -3,7 +3,7 @@ use std::ops::RangeInclusive;
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::{
|
||||
geometry::HalfEdgeGeometry,
|
||||
geometry::HalfEdgeGeom,
|
||||
operations::{
|
||||
build::BuildHalfEdge,
|
||||
geometry::UpdateHalfEdgeGeometry,
|
||||
@ -21,7 +21,7 @@ pub trait JoinCycle {
|
||||
#[must_use]
|
||||
fn add_joined_edges<Es>(&self, edges: Es, core: &mut Core) -> Self
|
||||
where
|
||||
Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeometry)>,
|
||||
Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeom)>,
|
||||
Es::IntoIter: Clone + ExactSizeIterator;
|
||||
|
||||
/// Join the cycle to another
|
||||
@ -78,7 +78,7 @@ pub trait JoinCycle {
|
||||
impl JoinCycle for Cycle {
|
||||
fn add_joined_edges<Es>(&self, edges: Es, core: &mut Core) -> Self
|
||||
where
|
||||
Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeometry)>,
|
||||
Es: IntoIterator<Item = (Handle<HalfEdge>, HalfEdgeGeom)>,
|
||||
Es::IntoIter: Clone + ExactSizeIterator,
|
||||
{
|
||||
let half_edges = edges
|
||||
|
Loading…
x
Reference in New Issue
Block a user