mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 18:08:26 +00:00
Prepare for follow-on change
This commit is contained in:
parent
978d4c00f1
commit
e7edc33bcb
@ -27,48 +27,59 @@ impl Approx for (&Handle<HalfEdge>, &Handle<Surface>) {
|
|||||||
geometry: &Geometry,
|
geometry: &Geometry,
|
||||||
) -> Self::Approximation {
|
) -> Self::Approximation {
|
||||||
let (half_edge, surface) = self;
|
let (half_edge, surface) = self;
|
||||||
let tolerance = tolerance.into();
|
approx_half_edge(half_edge, surface, tolerance, cache, geometry)
|
||||||
|
|
||||||
let boundary = geometry.of_half_edge(half_edge).boundary;
|
|
||||||
let [start_position_curve, _] = boundary.inner;
|
|
||||||
|
|
||||||
let start = approx_vertex(
|
|
||||||
half_edge.start_vertex().clone(),
|
|
||||||
half_edge.curve(),
|
|
||||||
surface,
|
|
||||||
start_position_curve,
|
|
||||||
&mut cache.start_position,
|
|
||||||
geometry,
|
|
||||||
);
|
|
||||||
|
|
||||||
let rest = approx_curve_with_cache(
|
|
||||||
half_edge.curve(),
|
|
||||||
surface,
|
|
||||||
boundary,
|
|
||||||
tolerance,
|
|
||||||
&mut cache.curve,
|
|
||||||
geometry,
|
|
||||||
);
|
|
||||||
|
|
||||||
let points = iter::once(start)
|
|
||||||
.chain(rest.points)
|
|
||||||
.map(|point| {
|
|
||||||
let point_surface = geometry
|
|
||||||
.of_curve(half_edge.curve())
|
|
||||||
.unwrap()
|
|
||||||
.local_on(surface)
|
|
||||||
.unwrap()
|
|
||||||
.path
|
|
||||||
.point_from_path_coords(point.local_form);
|
|
||||||
|
|
||||||
ApproxPoint::new(point_surface, point.global_form)
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
HalfEdgeApprox { points }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Approximate the provided half-edge
|
||||||
|
pub fn approx_half_edge(
|
||||||
|
half_edge: &Handle<HalfEdge>,
|
||||||
|
surface: &Handle<Surface>,
|
||||||
|
tolerance: impl Into<Tolerance>,
|
||||||
|
cache: &mut HalfEdgeApproxCache,
|
||||||
|
geometry: &Geometry,
|
||||||
|
) -> HalfEdgeApprox {
|
||||||
|
let tolerance = tolerance.into();
|
||||||
|
|
||||||
|
let boundary = geometry.of_half_edge(half_edge).boundary;
|
||||||
|
let [start_position_curve, _] = boundary.inner;
|
||||||
|
|
||||||
|
let start = approx_vertex(
|
||||||
|
half_edge.start_vertex().clone(),
|
||||||
|
half_edge.curve(),
|
||||||
|
surface,
|
||||||
|
start_position_curve,
|
||||||
|
&mut cache.start_position,
|
||||||
|
geometry,
|
||||||
|
);
|
||||||
|
|
||||||
|
let rest = approx_curve_with_cache(
|
||||||
|
half_edge.curve(),
|
||||||
|
surface,
|
||||||
|
boundary,
|
||||||
|
tolerance,
|
||||||
|
&mut cache.curve,
|
||||||
|
geometry,
|
||||||
|
);
|
||||||
|
|
||||||
|
let points = iter::once(start)
|
||||||
|
.chain(rest.points)
|
||||||
|
.map(|point| {
|
||||||
|
let point_surface = geometry
|
||||||
|
.of_curve(half_edge.curve())
|
||||||
|
.unwrap()
|
||||||
|
.local_on(surface)
|
||||||
|
.unwrap()
|
||||||
|
.path
|
||||||
|
.point_from_path_coords(point.local_form);
|
||||||
|
|
||||||
|
ApproxPoint::new(point_surface, point.global_form)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
HalfEdgeApprox { points }
|
||||||
|
}
|
||||||
|
|
||||||
/// An approximation of a [`HalfEdge`]
|
/// An approximation of a [`HalfEdge`]
|
||||||
///
|
///
|
||||||
/// The approximation of a half-edge is its first vertex, combined with the
|
/// The approximation of a half-edge is its first vertex, combined with the
|
||||||
|
Loading…
Reference in New Issue
Block a user