pub struct SphericalSurface { /* private fields */ }Expand description
An infinite spherical surface (actually a sphere).
Parameterized as P(u, v) = center + radius*(cos(v)*cos(u)*x + cos(v)*sin(u)*y + sin(v)*z)
where u ∈ [0, 2π) (longitude) and v ∈ [-π/2, π/2] (latitude).
Implementations§
Source§impl SphericalSurface
impl SphericalSurface
Sourcepub fn with_axis(
center: Point3,
radius: f64,
z_axis: Vec3,
) -> Result<Self, MathError>
pub fn with_axis( center: Point3, radius: f64, z_axis: Vec3, ) -> Result<Self, MathError>
Creates a spherical surface with a custom orientation.
§Errors
Returns an error if radius is not positive or the z-axis is zero.
Sourcepub fn translated(&self, offset: Vec3) -> Self
pub fn translated(&self, offset: Vec3) -> Self
Returns a copy of this sphere with its center translated by offset.
Sourcepub fn aabb(&self) -> Aabb3
pub fn aabb(&self) -> Aabb3
Axis-aligned bounding box of the full sphere (center ± radius on every
axis). Orientation-independent and a sound superset of any spherical
patch — the boolean broad-phase uses it because a face’s boundary-only
bbox misses the surface bulge between its boundary edges (a hemisphere’s
only boundary is its equator).
Sourcepub fn aabb_region(&self, pole: Vec3) -> Aabb3
pub fn aabb_region(&self, pole: Vec3) -> Aabb3
Axis-aligned bounding box of the hemisphere on the pole-axis side —
the half-ball {center + radius·d : d·pole ≥ 0}. A tight, sound superset
of any spherical patch lying on that side; the boolean broad-phase uses
it so that one hemisphere face’s box does not admit the other’s sections
(the full-sphere aabb would). Falls back to the full sphere when pole
is degenerate (side ambiguous).
Sourcepub fn project_point(&self, point: Point3) -> (f64, f64)
pub fn project_point(&self, point: Point3) -> (f64, f64)
Project a 3D point onto the sphere, returning (u, v) parameters.
u is the longitudinal angle [0, 2π), v is the latitude [-π/2, π/2].
Trait Implementations§
Source§impl Clone for SphericalSurface
impl Clone for SphericalSurface
Source§fn clone(&self) -> SphericalSurface
fn clone(&self) -> SphericalSurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more