pub enum AnalyticSurface {
Plane {
origin: Vec3,
u_dir: Vec3,
v_dir: Vec3,
u_domain: [f64; 2],
v_domain: [f64; 2],
},
RuledRevolution {
frame: RevolutionFrame,
rho0: f64,
rho1: f64,
height: f64,
},
Sphere {
frame: RevolutionFrame,
radius: f64,
},
Torus {
frame: RevolutionFrame,
major_radius: f64,
minor_radius: f64,
},
Revolution {
frame: RevolutionFrame,
spans: usize,
sweep: f64,
generatrix: NurbsCurve,
},
}Variants§
Plane
Affine patch: S(u,v) = origin + u·u_dir + v·v_dir over the knot domain.
RuledRevolution
Full revolution of a straight generatrix: cylinders (rho0 == rho1) and cones/frusta, with v linear along the generatrix over [0, 1].
Sphere
Full revolution of a -π/2..π/2 polar meridian arc (two 90° spans).
Torus
Full revolution of a full tube circle (four 90° spans in v).
Revolution
GENERAL revolution (full or partial sweep) of an arbitrary
generatrix — every other make_revolution product the classic
quadric variants above do not cover. The closest surface point to
a query lies in the query’s meridian half-plane, so projection
reduces exactly to a 1D projection onto the generatrix (rotated
rigidly about the axis); out-of-sweep queries compare the two
boundary meridians instead (Golovanov §4.13: prefer analytic
constructions — this was the unrecognized carrier that sent
tangent glue pairs into the marcher).
Implementations§
Source§impl AnalyticSurface
impl AnalyticSurface
Sourcepub fn sphere_geometry(&self) -> Option<(Vec3, f64)>
pub fn sphere_geometry(&self) -> Option<(Vec3, f64)>
The centre and radius of a carrier that IS a sphere, whichever way it is parameterized.
The Sphere variant is the south-to-north meridian swept
counter-clockwise about its polar axis — exactly what make_sphere_surface
builds. A REFLECTED sphere (the mirror feature, any negative-determinant
transform_brep) is the same point set with the opposite handedness:
relative to the u-consistent right-handed frame the recognizer derives,
its meridian runs north → south, so the Sphere template rejects it and
it recognizes as a general Revolution. That representation is
faithful (explicit generatrix, exact projection), but a closed-form
consumer keyed on the Sphere variant alone then falls back to the
marcher — which cannot terminate on a point tangency (a corner blend’s
sphere kissing the mirrored copy’s face plane).
Verified by exact reconstruction like every recognition: the generatrix
must be the polar meridian semicircle of (centre, radius) in either
direction, every control point and weight matching.
Sourcepub fn sphere_frame(&self) -> Option<(Vec3, f64, [Vec3; 3])>
pub fn sphere_frame(&self) -> Option<(Vec3, f64, [Vec3; 3])>
The centre, radius and a RIGHT-HANDED orthonormal basis of a carrier
that IS a sphere — Self::sphere_geometry plus the orientation the
pole-free cube atlas (geometry/sphere_chart.rs) is built on.
The basis is [x_axis, y_axis, axis] of the recognition frame, so
basis[2] is the polar axis: the atlas puts the two degenerate poles at
the CENTRES of its ±z charts, which is the whole point — a pole is then
an ordinary interior point of a regular chart rather than a coordinate
singularity. Derived only from data stored on the surface, so two call
sites looking at the same surface always build the same atlas, and a
REFLECTED sphere (which recognizes as a general Revolution) gets a
basis exactly as a direct one does.
Sourcepub fn torus_geometry(&self) -> Option<(RevolutionFrame, f64, f64)>
pub fn torus_geometry(&self) -> Option<(RevolutionFrame, f64, f64)>
The frame (origin ON the axis at the tube centre’s axial position),
major and minor radius of a carrier that IS a torus, whichever way it
is parameterized — the Torus variant, or the general Revolution a
reflected torus recognizes as (its tube circle runs the opposite way
round, so the Torus template rejects it; see Self::sphere_geometry).
Verified by exact reconstruction of the tube circle in either direction.
Source§impl AnalyticSurface
impl AnalyticSurface
Sourcepub fn kind_label(&self) -> &'static str
pub fn kind_label(&self) -> &'static str
A short, human-readable classification of this analytic carrier for the
Properties Info panel: "Plane", "Cylinder", "Cone", "Sphere",
"Torus", or "Surface of revolution". A RuledRevolution is a
cylinder when its two generatrix radii match (relative tolerance, same
style as recognition) and a cone otherwise — a zero end-radius apex is
still a cone, no special case needed. A partial-sweep revolve of a
straight profile recognizes as the general Revolution (not
RuledRevolution), so it reads “Surface of revolution” rather than
“Cylinder”/“Cone”.
Source§impl AnalyticSurface
impl AnalyticSurface
Sourcepub fn project(
&self,
surface: &NurbsSurface,
point: Vec3,
) -> Option<SurfaceProjection>
pub fn project( &self, surface: &NurbsSurface, point: Vec3, ) -> Option<SurfaceProjection>
Closed-form point projection in the surface’s own parameterization. Returns the exact nearest parameter; the caller evaluates the NURBS at that parameter so results stay bit-consistent with the carrier.
Sourcepub fn frame(&self) -> Option<&RevolutionFrame>
pub fn frame(&self) -> Option<&RevolutionFrame>
True when the closed-form projection is the exact global minimizer (everywhere except on-axis queries, where any meridian ties).
Trait Implementations§
Source§impl Clone for AnalyticSurface
impl Clone for AnalyticSurface
Source§fn clone(&self) -> AnalyticSurface
fn clone(&self) -> AnalyticSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more