Class GeoSphere

All Implemented Interfaces:
Pickable, Hintable, Renderable, Savable

public class GeoSphere extends Mesh
GeoSphere - generate a polygon mesh approximating a sphere by recursive subdivision. First approximation is an octahedron; each level of refinement increases the number of polygons by a factor of 4. Shared vertices are not retained, so numerical errors may produce cracks between polygons at high subdivision levels. Initial idea and text from C-Sourcecode by Jon Leech 3/24/89
  • Constructor Details

    • GeoSphere

      public GeoSphere(String name, boolean useIcosahedron, double radius, int maxlevels, GeoSphere.TextureMode textureMode)
      Parameters:
      name - name of the spatial
      useIcosahedron - true to start with a 20 triangle mesh, false to start with a 8 triangle mesh
      radius - the radius of this sphere
      maxlevels - an integer >= 1 setting the recursion level
      textureMode - the texture mode to use when generating texture coordinates
    • GeoSphere

      public GeoSphere()
      Default Constructor for Savable use.
  • Method Details

    • getRadius

      public double getRadius()
    • isUsingIcosahedron

      public boolean isUsingIcosahedron()
    • setTextureMode

      public void setTextureMode(GeoSphere.TextureMode textureMode)
    • getTextureMode

      public GeoSphere.TextureMode getTextureMode()
    • createMidpoint

      protected Vector3 createMidpoint(Vector3 a, Vector3 b)
      Compute the average of two vectors.
      Parameters:
      a - first vector
      b - second vector
      Returns:
      the average of two points