STEP import: a whole round face whose seam is off its frame's quarter lines is turned onto one

A cylinder, cone, sphere or torus face of one whole turn has a NURBS form of the four
quarters from the one its seam starts in (brep::form::face_quarters). When the seam is
not on a quarter line of the file's frame, the seam's second use lies a period on, past
the form's end: the face's domain stopped at the form's end and SMLib measured a ball
whose seam meridian is 0.7 rad off its frame's x axis 2.2% short
(tilted_seam_only_sphere_imports_as_a_whole_ball: 32.03 vs 32.74 mm3), and a 5 mm ball
with its seam 1 rad off, holding a 2 mm void, 481.0 vs 490.1
(seam_only_sphere_void_is_turned_inside_out).

turn_quarters, which says whether turn_frames (ee4d4b5a5) turns a face's frame, counted
such a whole turn as four quarters, never a spill. It now counts the quarters the face's
angle interval needs on the grid (brep::form::quarters, as for a face of less than a
turn): five for a whole turn off the quarter lines, so the frame is turned about its
axis to put the seam on one, and the form's seam is the face's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-28 18:14:38 -04:00
committed by Irakli Kourtis
parent fc3a13f176
commit 4688c0f20a
2 changed files with 10 additions and 6 deletions
+7 -5
View File
@@ -172,15 +172,17 @@ fn reaches(s: &Surface, v: [f64; 2], tolerance: f64) -> (f64, f64) {
}
/// How many quarters a cylinder, cone, sphere or torus face over `[u, v]` (its box on the label,
/// as for [`surface_within`]) spans about the axis on its frame's quarter grid: four for a whole
/// turn, up to five for less, when the face does not start on a quarter line and more than three
/// quarters are left to it, so that its form runs past one turn (a NURBS that covers part of its
/// surface twice). [`turned`] puts its start on a quarter line. `None` for another surface.
/// as for [`surface_within`]) spans about the axis on its frame's quarter grid: five when the face
/// does not start on a quarter line and more than three quarters are left to it. A face of less
/// than one turn then has a form past one turn (a NURBS that covers part of its surface twice); a
/// whole turn has a form of four quarters from the one it starts in, which ends short of the
/// face's seam, so the seam's second use lies off the form. [`turned`] puts its start on a quarter
/// line. `None` for another surface.
pub fn turn_quarters(s: &Surface, [u, v]: [[f64; 2]; 2], tolerance: f64) -> Option<usize> {
if !matches!(s, Surface::Cylinder { .. } | Surface::Cone { .. } | Surface::Sphere { .. } | Surface::Torus { .. }) {
return None;
}
Some(face_quarters(u, reaches(s, v, tolerance).0)?.0.1)
Some(quarters(u, reaches(s, v, tolerance).0)?.1)
}
/// A cylinder, cone, sphere or torus with its frame turned by `angle` about its own axis (its x
+3 -1
View File
@@ -2,7 +2,9 @@
//! torus face's NURBS form spans the quarters of its frame's quarter grid that its angle interval
//! needs (`brep::form`); a face of less than one turn that does not start on a quarter line and
//! has more than three quarters left spills into a fifth, so its form runs past one turn and
//! covers part of its surface twice, which no kernel takes as a face. The file's reference
//! covers part of its surface twice, which no kernel takes as a face. A whole turn whose seam is
//! off a quarter line spills the same way: its form is the four quarters from the one it starts
//! in, and the seam's second use lies past their end, off the form. The file's reference
//! direction is the writer's: the face's frame is turned about its own axis (the same surface,
//! its angle parameter measured from further on) so that the face starts on a quarter line, and
//! its form spans the four quarters (or fewer) it covers.