Interface Terrain

  • All Known Implementing Classes:
    BasicTerrain

    public interface Terrain
    Surface of a planet or celestial object.
    Models the geometric surface defined by an ellipsoidal globe and its associated elevations. Terrain uses the Cartesian coordinate system specified by a GeographicProjection and is capable of representing both a 3D ellipsoid and a 2D map projection, though not simultaneously.

    Caching Terrain Queries

    Terrain implementations typically model a subset of the globe's surface at varying resolution. In this case results from the methods intersect and surfacePoint cannot be cached. Either method may fail to compute a result when the terrain surface has no geometry in the region queried, and even if computation is successful the result is based on an unknown resolution. However, if the terrain implementation is known to model a pre-determined resolution and region of interest results from the methods intersect and surfacePoint may be cached.

    See Also:
    GeographicProjection
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Sector getSector()
      Indicates the geographic rectangular region that contains this terrain.
      boolean intersect​(Line line, Vec3 result)
      Computes the first intersection of this terrain with a specified line in Cartesian coordinates.
      boolean surfacePoint​(double latitude, double longitude, Vec3 result)
      Computes the Cartesian coordinates of a geographic location on the terrain surface.
    • Method Detail

      • getSector

        Sector getSector()
        Indicates the geographic rectangular region that contains this terrain. The returned sector may contain geographic areas where the terrain is nonexistent.
        Returns:
        the terrain's bounding sector
      • intersect

        boolean intersect​(Line line,
                          Vec3 result)
        Computes the first intersection of this terrain with a specified line in Cartesian coordinates. The line is interpreted as a ray; intersection points behind the line's origin are ignored. If the line does not intersect the geometric surface modeled by this terrain, this returns false and does not modify the result argument.
        Parameters:
        line - the line to intersect with this terrain
        result - a pre-allocated Vec3 in which to return the intersection point
        Returns:
        true if the ray intersects this terrain, otherwise false
        Throws:
        java.lang.IllegalArgumentException - if either argument is null
      • surfacePoint

        boolean surfacePoint​(double latitude,
                             double longitude,
                             Vec3 result)
        Computes the Cartesian coordinates of a geographic location on the terrain surface. If the latitude and longitude are outside the geometric surface modeled by this terrain, this returns false and does not modify the result argument.
        Parameters:
        latitude - the location's latitude in degrees
        longitude - the location's longitude in degrees
        result - a pre-allocated Vec3 in which to store the computed X, Y and Z Cartesian coordinates
        Returns:
        true if the geographic location is on the terrain surface, otherwise false
        Throws:
        java.lang.IllegalArgumentException - if the result is null