Class Sphere.SphereMeshApproximationBuilder

  • Enclosing class:
    Sphere

    private static final class Sphere.SphereMeshApproximationBuilder
    extends java.lang.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.
    • Constructor Summary

      Constructors 
      Constructor Description
      SphereMeshApproximationBuilder​(Sphere sphere, int subdivisions)
      Construct a new builder for creating a mesh approximation of the given sphere.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void addSubdivided​(Vector3D p1, Vector3D p2, Vector3D p3, int level)
      Recursively subdivide and add triangular faces between the given outer boundary points.
      SimpleTriangleMesh build()
      Build the mesh approximation of the configured sphere.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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.
    • Constructor Detail

      • 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 Detail

      • 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