Update name of GlobalEdgeApprox

This commit is contained in:
Hanno Braun 2023-02-22 13:37:55 +01:00
parent e7d8b24b6b
commit 073531e5f3

View File

@ -103,7 +103,7 @@ fn approx_edge(
surface: &Surface, surface: &Surface,
range: RangeOnPath, range: RangeOnPath,
tolerance: impl Into<Tolerance>, tolerance: impl Into<Tolerance>,
) -> GlobalCurveApprox { ) -> GlobalEdgeApprox {
// There are different cases of varying complexity. Circles are the hard // There are different cases of varying complexity. Circles are the hard
// part here, as they need to be approximated, while lines don't need to be. // part here, as they need to be approximated, while lines don't need to be.
// //
@ -171,13 +171,13 @@ fn approx_edge(
ApproxPoint::new(point_curve, point_global) ApproxPoint::new(point_curve, point_global)
}) })
.collect(); .collect();
GlobalCurveApprox { points } GlobalEdgeApprox { points }
} }
/// A cache for results of an approximation /// A cache for results of an approximation
#[derive(Default)] #[derive(Default)]
pub struct CurveCache { pub struct CurveCache {
inner: BTreeMap<(ObjectId, RangeOnPath), GlobalCurveApprox>, inner: BTreeMap<(ObjectId, RangeOnPath), GlobalEdgeApprox>,
} }
impl CurveCache { impl CurveCache {
@ -191,8 +191,8 @@ impl CurveCache {
&mut self, &mut self,
handle: Handle<GlobalEdge>, handle: Handle<GlobalEdge>,
range: RangeOnPath, range: RangeOnPath,
approx: GlobalCurveApprox, approx: GlobalEdgeApprox,
) -> GlobalCurveApprox { ) -> GlobalEdgeApprox {
self.inner.insert((handle.id(), range), approx.clone()); self.inner.insert((handle.id(), range), approx.clone());
approx approx
} }
@ -202,7 +202,7 @@ impl CurveCache {
&self, &self,
handle: Handle<GlobalEdge>, handle: Handle<GlobalEdge>,
range: RangeOnPath, range: RangeOnPath,
) -> Option<GlobalCurveApprox> { ) -> Option<GlobalEdgeApprox> {
if let Some(approx) = self.inner.get(&(handle.id(), range)) { if let Some(approx) = self.inner.get(&(handle.id(), range)) {
return Some(approx.clone()); return Some(approx.clone());
} }
@ -218,12 +218,12 @@ impl CurveCache {
/// An approximation of a [`GlobalCurve`] /// An approximation of a [`GlobalCurve`]
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct GlobalCurveApprox { pub struct GlobalEdgeApprox {
/// The points that approximate the curve /// The points that approximate the curve
pub points: Vec<ApproxPoint<1>>, pub points: Vec<ApproxPoint<1>>,
} }
impl GlobalCurveApprox { impl GlobalEdgeApprox {
/// Reverse the order of the approximation /// Reverse the order of the approximation
pub fn reverse(mut self) -> Self { pub fn reverse(mut self) -> Self {
self.points.reverse(); self.points.reverse();