mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-15 03:35:52 +00:00
Avoid using Curve::global_form
This commit is contained in:
parent
41e4d0db5e
commit
1fe5b4b62e
@ -19,7 +19,7 @@ use crate::{
|
|||||||
|
|
||||||
use super::{path::RangeOnPath, Approx, ApproxPoint, Tolerance};
|
use super::{path::RangeOnPath, Approx, ApproxPoint, Tolerance};
|
||||||
|
|
||||||
impl Approx for (&Handle<Curve>, &Surface, RangeOnPath) {
|
impl Approx for (&Handle<Curve>, &Surface, Handle<GlobalCurve>, RangeOnPath) {
|
||||||
type Approximation = CurveApprox;
|
type Approximation = CurveApprox;
|
||||||
type Cache = CurveCache;
|
type Cache = CurveCache;
|
||||||
|
|
||||||
@ -28,9 +28,8 @@ impl Approx for (&Handle<Curve>, &Surface, RangeOnPath) {
|
|||||||
tolerance: impl Into<Tolerance>,
|
tolerance: impl Into<Tolerance>,
|
||||||
cache: &mut Self::Cache,
|
cache: &mut Self::Cache,
|
||||||
) -> Self::Approximation {
|
) -> Self::Approximation {
|
||||||
let (curve, surface, range) = self;
|
let (curve, surface, global_curve, range) = self;
|
||||||
|
|
||||||
let global_curve = curve.global_form().clone();
|
|
||||||
let global_curve_approx = match cache.get(global_curve.clone(), range) {
|
let global_curve_approx = match cache.get(global_curve.clone(), range) {
|
||||||
Some(approx) => approx,
|
Some(approx) => approx,
|
||||||
None => {
|
None => {
|
||||||
@ -237,7 +236,9 @@ mod tests {
|
|||||||
.insert(&mut services.objects);
|
.insert(&mut services.objects);
|
||||||
let range = RangeOnPath::from([[0.], [1.]]);
|
let range = RangeOnPath::from([[0.], [1.]]);
|
||||||
|
|
||||||
let approx = (&curve, surface.deref(), range).approx(1.);
|
let approx =
|
||||||
|
(&curve, surface.deref(), curve.global_form().clone(), range)
|
||||||
|
.approx(1.);
|
||||||
|
|
||||||
assert_eq!(approx, CurveApprox::empty());
|
assert_eq!(approx, CurveApprox::empty());
|
||||||
}
|
}
|
||||||
@ -259,7 +260,9 @@ mod tests {
|
|||||||
.insert(&mut services.objects);
|
.insert(&mut services.objects);
|
||||||
let range = RangeOnPath::from([[0.], [1.]]);
|
let range = RangeOnPath::from([[0.], [1.]]);
|
||||||
|
|
||||||
let approx = (&curve, surface.deref(), range).approx(1.);
|
let approx =
|
||||||
|
(&curve, surface.deref(), curve.global_form().clone(), range)
|
||||||
|
.approx(1.);
|
||||||
|
|
||||||
assert_eq!(approx, CurveApprox::empty());
|
assert_eq!(approx, CurveApprox::empty());
|
||||||
}
|
}
|
||||||
@ -281,7 +284,9 @@ mod tests {
|
|||||||
let range = RangeOnPath::from([[0.], [TAU]]);
|
let range = RangeOnPath::from([[0.], [TAU]]);
|
||||||
let tolerance = 1.;
|
let tolerance = 1.;
|
||||||
|
|
||||||
let approx = (&curve, surface.deref(), range).approx(tolerance);
|
let approx =
|
||||||
|
(&curve, surface.deref(), curve.global_form().clone(), range)
|
||||||
|
.approx(tolerance);
|
||||||
|
|
||||||
let expected_approx = (path, range)
|
let expected_approx = (path, range)
|
||||||
.approx(tolerance)
|
.approx(tolerance)
|
||||||
@ -310,7 +315,9 @@ mod tests {
|
|||||||
|
|
||||||
let range = RangeOnPath::from([[0.], [TAU]]);
|
let range = RangeOnPath::from([[0.], [TAU]]);
|
||||||
let tolerance = 1.;
|
let tolerance = 1.;
|
||||||
let approx = (&curve, surface.deref(), range).approx(tolerance);
|
let approx =
|
||||||
|
(&curve, surface.deref(), curve.global_form().clone(), range)
|
||||||
|
.approx(tolerance);
|
||||||
|
|
||||||
let expected_approx = (curve.path(), range)
|
let expected_approx = (curve.path(), range)
|
||||||
.approx(tolerance)
|
.approx(tolerance)
|
||||||
|
@ -35,7 +35,12 @@ impl Approx for (&Handle<HalfEdge>, &Surface) {
|
|||||||
half_edge.start_vertex().global_form().position(),
|
half_edge.start_vertex().global_form().position(),
|
||||||
)
|
)
|
||||||
.with_source((half_edge.clone(), half_edge.boundary()[0]));
|
.with_source((half_edge.clone(), half_edge.boundary()[0]));
|
||||||
let curve_approx = (half_edge.curve(), surface, range)
|
let curve_approx = (
|
||||||
|
half_edge.curve(),
|
||||||
|
surface,
|
||||||
|
half_edge.global_form().curve().clone(),
|
||||||
|
range,
|
||||||
|
)
|
||||||
.approx_with_cache(tolerance, cache);
|
.approx_with_cache(tolerance, cache);
|
||||||
|
|
||||||
HalfEdgeApprox {
|
HalfEdgeApprox {
|
||||||
|
Loading…
Reference in New Issue
Block a user