Class Sphere

java.lang.Object
org.episteme.core.mathematics.geometry.surfaces.Sphere
All Implemented Interfaces:
Function<Vector<Real>, Vector<Real>>, ContinuousFunction<Vector<Real>, Vector<Real>>, DifferentiableFunction<Vector<Real>, Vector<Real>>, Function<Vector<Real>, Vector<Real>>, Relation<Vector<Real>, Vector<Real>>, ParametricSurface

public class Sphere extends Object implements ParametricSurface
Represents a sphere as a parametric surface.

Spherical coordinates parametrization: S(θ,φ) = center + (r*sin(θ)*cos(φ), r*sin(θ)*sin(φ), r*cos(θ)) where θ ∈ [0,π] is the polar angle and φ ∈ [0,2π] is the azimuthal angle.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • Sphere

      public Sphere(PointND center, Real radius)
      Creates a sphere.
      Parameters:
      center - the center point (must be 3D)
      radius - the radius
  • Method Details

    • at

      public PointND at(Real theta, Real phi)
      Description copied from interface: ParametricSurface
      Evaluates the surface at parameters (u, v).
      Specified by:
      at in interface ParametricSurface
      Parameters:
      theta - the first parameter
      phi - the second parameter
      Returns:
      the point on the surface
    • normal

      public Vector<Real> normal(Real theta, Real phi, Real h)
      Description copied from interface: ParametricSurface
      Returns the normal vector at (u, v).

      The normal is computed as: N = ∂S/∂u × ∂S/∂v

      Specified by:
      normal in interface ParametricSurface
      Parameters:
      theta - the first parameter
      phi - the second parameter
      h - the step size for numerical differentiation
      Returns:
      the unit normal vector
    • gaussianCurvature

      public Real gaussianCurvature(Real theta, Real phi, Real h)
      Description copied from interface: ParametricSurface
      Returns the Gaussian curvature at (u, v).

      K = (LN - M²) / (EG - F²) where L, M, N are second fundamental form coefficients and E, F, G are first fundamental form coefficients.

      Specified by:
      gaussianCurvature in interface ParametricSurface
      Parameters:
      theta - the first parameter
      phi - the second parameter
      h - the step size
      Returns:
      the Gaussian curvature
    • surfaceArea

      public Real surfaceArea()
      Returns the surface area of the sphere.
      Returns:
      4πr²
    • volume

      public Real volume()
      Returns the volume of the sphere.
      Returns:
      (4/3)πr³
    • getCenter

      public PointND getCenter()
      Returns the center of the sphere.
      Returns:
      the center point
    • getRadius

      public Real getRadius()
      Returns the radius of the sphere.
      Returns:
      the radius
    • contains

      public boolean contains(PointND point, Real tolerance)
      Checks if a point is on the surface of the sphere.
      Parameters:
      point - the point to check
      tolerance - the tolerance
      Returns:
      true if on surface
    • toString

      public String toString()
      Overrides:
      toString in class Object