Class Sphere.SphereMeshApproximationBuilder

java.lang.Object
org.apache.commons.geometry.euclidean.threed.shape.Sphere.SphereMeshApproximationBuilder
Enclosing class:
Sphere

private static final class Sphere.SphereMeshApproximationBuilder extends Object
Internal class used to construct geodesic mesh sphere approximations. The class begins with an octahedron inscribed in the sphere and then subdivides each triangular face a specified number of times.
  • Field Details

    • sphere

      private final Sphere sphere
      The sphere that an approximation is being created for.
    • subdivisions

      private final int subdivisions
      The number of triangular subdivisions to use.
    • builder

      private final SimpleTriangleMesh.Builder builder
      Mesh builder object.
  • Constructor Details

    • SphereMeshApproximationBuilder

      SphereMeshApproximationBuilder(Sphere sphere, int subdivisions)
      Construct a new builder for creating a mesh approximation of the given sphere.
      Parameters:
      sphere - the sphere to create an approximation of
      subdivisions - the number of triangle subdivisions to use in mesh creation
  • Method Details

    • build

      public SimpleTriangleMesh build()
      Build the mesh approximation of the configured sphere.
      Returns:
      the mesh approximation of the configured sphere
    • addSubdivided

      private void addSubdivided(Vector3D p1, Vector3D p2, Vector3D p3, int level)
      Recursively subdivide and add triangular faces between the given outer boundary points.
      Parameters:
      p1 - first point
      p2 - second point
      p3 - third point
      level - recursion level; counts up