mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-03 17:38:27 +00:00
Prepare to support curved curves
This commit is contained in:
parent
46ef1d2f98
commit
4974feaa4f
@ -107,7 +107,7 @@ fn approximate_half_edge(
|
||||
half_edge,
|
||||
end_vertex,
|
||||
}: HalfEdgeWithEndVertex,
|
||||
_: impl Into<Tolerance>,
|
||||
tolerance: impl Into<Tolerance>,
|
||||
) -> Vec<Point<3>> {
|
||||
let [start, end] =
|
||||
[&half_edge.start, end_vertex].map(|vertex| vertex.point);
|
||||
@ -115,7 +115,10 @@ fn approximate_half_edge(
|
||||
let boundary_local = [start, end].map(|point_global| {
|
||||
half_edge.curve.geometry.project_point(point_global)
|
||||
});
|
||||
let points_local = half_edge.curve.geometry.approximate(boundary_local);
|
||||
let points_local = half_edge
|
||||
.curve
|
||||
.geometry
|
||||
.approximate(boundary_local, tolerance.into());
|
||||
|
||||
let mut points_global = vec![start];
|
||||
points_global.extend(points_local.into_iter().map(|point_local| {
|
||||
|
@ -1,3 +1,4 @@
|
||||
use fj_interop::Tolerance;
|
||||
use fj_math::{Line, Point, Transform, Vector};
|
||||
|
||||
pub trait CurveGeometry {
|
||||
@ -17,7 +18,11 @@ pub trait CurveGeometry {
|
||||
/// This method should take a tolerance parameter, to define how far the
|
||||
/// approximation is allowed to deviate from the actual curve. So far, this
|
||||
/// has not been necessary.
|
||||
fn approximate(&self, boundary: [Point<1>; 2]) -> Vec<Point<1>>;
|
||||
fn approximate(
|
||||
&self,
|
||||
boundary: [Point<1>; 2],
|
||||
tolerance: Tolerance,
|
||||
) -> Vec<Point<1>>;
|
||||
}
|
||||
|
||||
impl CurveGeometry for Line<3> {
|
||||
@ -38,7 +43,7 @@ impl CurveGeometry for Line<3> {
|
||||
Box::new(translated)
|
||||
}
|
||||
|
||||
fn approximate(&self, _: [Point<1>; 2]) -> Vec<Point<1>> {
|
||||
fn approximate(&self, _: [Point<1>; 2], _: Tolerance) -> Vec<Point<1>> {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user