mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-12 13:58:28 +00:00
Simplify function parameter
This commit is contained in:
parent
0a60e65468
commit
1cfaaeab31
@ -56,7 +56,7 @@ impl<const D: usize> GenPolyline<D> for Circle<D> {
|
|||||||
tolerance: Tolerance,
|
tolerance: Tolerance,
|
||||||
) -> Vec<Point<1>> {
|
) -> Vec<Point<1>> {
|
||||||
let params = CircleApproxParams::new(self, tolerance);
|
let params = CircleApproxParams::new(self, tolerance);
|
||||||
params.approx_circle(boundary).collect()
|
params.approx_circle(boundary.inner).collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,10 +94,8 @@ impl CircleApproxParams {
|
|||||||
/// # Generate points to approximate the circle within a given boundary
|
/// # Generate points to approximate the circle within a given boundary
|
||||||
pub fn approx_circle(
|
pub fn approx_circle(
|
||||||
&self,
|
&self,
|
||||||
boundary: impl Into<CurveBoundary<Point<1>>>,
|
boundary: [Point<1>; 2],
|
||||||
) -> impl Iterator<Item = Point<1>> + '_ {
|
) -> impl Iterator<Item = Point<1>> + '_ {
|
||||||
let boundary = boundary.into().inner;
|
|
||||||
|
|
||||||
let [a, b] = boundary.map(|point| point.t / self.increment);
|
let [a, b] = boundary.map(|point| point.t / self.increment);
|
||||||
let direction = (b - a).sign();
|
let direction = (b - a).sign();
|
||||||
let [min, max] = if a < b { [a, b] } else { [b, a] };
|
let [min, max] = if a < b { [a, b] } else { [b, a] };
|
||||||
@ -202,7 +200,9 @@ mod tests {
|
|||||||
let circle = Circle::from_center_and_radius([0., 0.], radius);
|
let circle = Circle::from_center_and_radius([0., 0.], radius);
|
||||||
let params = CircleApproxParams::new(&circle, tolerance);
|
let params = CircleApproxParams::new(&circle, tolerance);
|
||||||
|
|
||||||
let points = params.approx_circle(boundary).collect::<Vec<_>>();
|
let points = params
|
||||||
|
.approx_circle(boundary.into().inner)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let expected_points = expected_coords
|
let expected_points = expected_coords
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
Loading…
Reference in New Issue
Block a user