mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-06 20:02:16 +00:00
brep: a full circle in a profile is one closed arc
Loop2::circle and circle_from gave two half arcs, so everything built from a circle came out in
two: an extruded wall in two faces, a rim in two edges, and so every round, chamfer or sweep on
it in two B-spline halves that SMLib cannot join (two separately parameterised arcs meet at
different curve parameters, SmVertex::IsTopologicalVertex; different free-form surfaces are not
topological, SmEdge::IsTopological). A circle is now one arc of a whole turn from its start
angle: one closed edge, one wall with a seam, one round. Sketch circles, the cylinder builder
(circle_from at its seam angle) and every other builder take it through Loop2; SMLib's arc
curves take a whole turn (smlib_sweeps clamps to one) and ArcSweepCylinder makes the whole
cylinder.
Cases, singly on 9f5ad20c: fillets/1191, 2797, 3753 and sweeps/1269, 2295 fail before and pass
now; eight hole and six thread cases give what the base gives (12 pass, booleans/1279,
booleans/307 and threads/2038 fail as on the base).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
@@ -497,19 +497,14 @@ impl Loop2 {
|
||||
pub fn inradius(&self, tol: f64) -> f64 {
|
||||
max_clearance(&[self.polyline(tol)])
|
||||
}
|
||||
/// Full circle as two half arcs (counter-clockwise).
|
||||
/// Full circle as one arc from angle 0 (counter-clockwise): one closed curve, so a solid
|
||||
/// swept from it has one wall, and an edge round it is one edge.
|
||||
pub fn circle(center: Vec2, radius: f64) -> Loop2 {
|
||||
Loop2 {
|
||||
segs: vec![
|
||||
Seg2::Arc { center, radius, start: 0.0, sweep: std::f64::consts::PI },
|
||||
Seg2::Arc { center, radius, start: std::f64::consts::PI, sweep: std::f64::consts::PI },
|
||||
],
|
||||
}
|
||||
Loop2::circle_from(center, radius, 0.0)
|
||||
}
|
||||
/// Full circle starting (and split) at angle `start`.
|
||||
/// Full circle as one arc starting (and ending) at angle `start`, counter-clockwise.
|
||||
pub fn circle_from(center: Vec2, radius: f64, start: f64) -> Loop2 {
|
||||
use std::f64::consts::PI;
|
||||
Loop2 { segs: vec![Seg2::Arc { center, radius, start, sweep: PI }, Seg2::Arc { center, radius, start: start + PI, sweep: PI }] }
|
||||
Loop2 { segs: vec![Seg2::Arc { center, radius, start, sweep: TAU }] }
|
||||
}
|
||||
pub fn polygon(pts: &[Vec2]) -> Loop2 {
|
||||
let n = pts.len();
|
||||
|
||||
Reference in New Issue
Block a user