forked from 1b-agent/opencadstudio-upstream
refactor(trim): find an extension's boundary with the kernel
EXTEND asked where a line reaches by matching over every Geo variant and running its own line-line, line-circle and line-ellipse test — twice over, once for a LINE and once for a polyline's terminal segment, about two hundred and sixty lines between them. A boundary spline was walked as sixty-four chords there rather than intersected, so an extend landed on the chord nearest the spline instead of on the spline. Both are one call now: shoot the segment's own infinite line and take the nearest crossing on the side being extended. That is `cut_params`, which every other cut in the file already goes through. With those two gone, the sampled copy carried beside each boundary spline had no remaining reader, so a spline boundary is now only ever the exact NURBS. The line-ellipse adapter lost its last caller with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ca85856f52
commit
f3c2e061e0
2 files changed
+50
-324
No files matched your search
@@ -15,7 +15,7 @@ use acadrust::kernel::geom2d::{self, Ellipse};
|
||||
|
||||
/// Re-exported unchanged: these already speak in plain `f64`, so there is no
|
||||
/// call-shape difference for this module to absorb.
|
||||
pub use acadrust::kernel::geom2d::{angle_within_arc, arc_parameter, lerp, normalize_angle};
|
||||
pub use acadrust::kernel::geom2d::{arc_parameter, lerp, normalize_angle};
|
||||
|
||||
/// Preview geometry keeps the density the commands have always used.
|
||||
const SEGMENTS_PER_RADIAN: f64 = geom2d::DEFAULT_SEGMENTS_PER_RADIAN;
|
||||
@@ -51,35 +51,6 @@ pub fn line_circle(px: f64, py: f64, dx: f64, dy: f64, cx: f64, cy: f64, r: f64)
|
||||
geom2d::line_circle([px, py], [dx, dy], [cx, cy], r)
|
||||
}
|
||||
|
||||
/// `(s_on_line, t_on_ellipse)` pairs where a line meets an ellipse.
|
||||
///
|
||||
/// `nx, ny` is the unit major axis.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn line_ellipse(
|
||||
px: f64,
|
||||
py: f64,
|
||||
dx: f64,
|
||||
dy: f64,
|
||||
cx: f64,
|
||||
cy: f64,
|
||||
a: f64,
|
||||
b: f64,
|
||||
nx: f64,
|
||||
ny: f64,
|
||||
) -> Vec<(f64, f64)> {
|
||||
geom2d::line_ellipse(
|
||||
[px, py],
|
||||
[dx, dy],
|
||||
&Ellipse {
|
||||
centre: [cx, cy],
|
||||
major_radius: a,
|
||||
minor_radius: b,
|
||||
major_axis: [nx, ny],
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/// The two endpoints of a straight segment, as render vertices.
|
||||
pub fn line_points(start: [f64; 3], end: [f64; 3]) -> Vec<[f32; 3]> {
|
||||
narrow(vec![start, end])
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user