Class: Globe2D

Globe2D()

Represents a 2D flat globe with a configurable projection. The default rectangular projection scrolls longitudinally.

Constructor

new Globe2D()

Constructs a 2D globe with a default ElevationModel and equirectangular projection.
Source:

Extends

Members

(readonly) continuous :Boolean

Indicates whether this globe is 2D and continuous with itself -- that it should scroll continuously horizontally.
Type:
  • Boolean
Inherited From:
Source:

eccentricitySquared :Number

This globe's eccentricity squared.
Type:
  • Number
Inherited From:
Default Value:
  • 0.00669437999013
Source:

elevationModel :ElevationModel

This globe's elevation model.
Type:
Inherited From:
Source:

equatorialRadius :Number

This globe's equatorial radius.
Type:
  • Number
Inherited From:
Default Value:
  • 6378137.0 meters
Source:

offset :Number

An offset to apply to this globe when translating between Geographic positions and Cartesian points. Used during scrolling to position points appropriately. Applications typically do not access this property. It is used by the associated globe.
Type:
  • Number
Inherited From:
Source:

polarRadius :Number

This globe's polar radius.
Type:
  • Number
Inherited From:
Default Value:
  • 6356752.3 meters
Source:

projection :GeographicProjection

The projection used by this globe.
Type:
Inherited From:
Default Value:
Source:

projectionLimits :Sector

The projection limits of the associated projection.
Type:
Inherited From:
Source:

(readonly) stateKey :String

A string identifying this globe's current state. Used to compare states during rendering to determine whether globe-state dependent cached values must be updated. Applications typically do not interact with this property.
Type:
  • String
Inherited From:
Source:

tessellator :Tessellator

The tessellator used to create this globe's terrain.
Type:
Inherited From:
Source:

Methods

computePointFromLocation(latitude, longitude, result) → {Vec3}

Computes a Cartesian point from a specified location. See this class' Overview section for a description of the Cartesian coordinate system used.
Parameters:
Name Type Description
latitude Number The position's latitude.
longitude Number The position's longitude.
result Vec3 A reference to a pre-allocated Vec3 in which to return the computed X, Y and Z Cartesian coordinates.
Inherited From:
Source:
Throws:
If the specified result argument is null or undefined.
Type
ArgumentError
Returns:
The result argument.
Type
Vec3

computePointFromPosition(latitude, longitude, altitude, result) → {Vec3}

Computes a Cartesian point from a specified position. See this class' Overview section for a description of the Cartesian coordinate system used.
Parameters:
Name Type Description
latitude Number The position's latitude.
longitude Number The position's longitude.
altitude Number The position's altitude.
result Vec3 A reference to a pre-allocated Vec3 in which to return the computed X, Y and Z Cartesian coordinates.
Inherited From:
Source:
Throws:
If the specified result argument is null or undefined.
Type
ArgumentError
Returns:
The result argument.
Type
Vec3

computePointsForGrid(sector, numLat, numLon, elevations, referencePoint, result) → {Float32Array}

Computes a grid of Cartesian points within a specified sector and relative to a specified Cartesian reference point.

This method is used to compute a collection of points within a sector. It is used by tessellators to efficiently generate a tile's interior points. The number of points to generate is indicated by the numLon and numLat parameters.

For each implied position within the sector, an elevation value is specified via an array of elevations. The calculation at each position incorporates the associated elevation. There must be numLat x numLon elevations in the array.

Parameters:
Name Type Description
sector Sector The sector for which to compute the points.
numLat Number The number of latitudinal points in the grid.
numLon Number The number of longitudinal points in the grid.
elevations Array.<Number> An array of elevations to incorporate in the point calculations. There must be one elevation value in the array for each generated point. Elevations are in meters. There must be numLat x numLon elevations in the array.
referencePoint Vec3 The X, Y and Z Cartesian coordinates to subtract from the computed coordinates. This makes the computed coordinates relative to the specified point.
result Float32Array A typed array to hold the computed coordinates. It must be at least of size numLat x numLon. The points are returned in row major order, beginning with the row of minimum latitude.
Inherited From:
Source:
Throws:
if the specified sector, elevations array or results arrays are null or undefined, or if the lengths of any of the arrays are insufficient.
Type
ArgumentError
Returns:
The specified result argument.
Type
Float32Array

computePositionFromPoint(x, y, z, result) → {Position}

Computes a geographic position from a specified Cartesian point. See this class' Overview section for a description of the Cartesian coordinate system used.
Parameters:
Name Type Description
x Number The X coordinate.
y Number The Y coordinate.
z Number The Z coordinate.
result Position A pre-allocated Position instance in which to return the computed position.
Inherited From:
Source:
Throws:
If the specified result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result position.
Type
Position

elevationAtLocation(latitude, longitude) → {Number}

Returns the elevation at a specified location.
Parameters:
Name Type Description
latitude Number The location's latitude in degrees.
longitude Number The location's longitude in degrees.
Inherited From:
Source:
Returns:
The elevation at the specified location, in meters. Returns zero if the location is outside the coverage area of this elevation model.
Type
Number

elevationsForGrid(sector, numLat, numLon, targetResolution, result) → {Number}

Returns the elevations at locations within a specified sector.
Parameters:
Name Type Description
sector Sector The sector for which to determine the elevations.
numLat Number The number of latitudinal sample locations within the sector.
numLon Number The number of longitudinal sample locations within the sector.
targetResolution Number The desired elevation resolution, in degrees. (To compute degrees from meters, divide the number of meters by the globe's radius to obtain radians and convert the result to degrees.)
result Array.<Number> An array in which to return the requested elevations.
Inherited From:
Source:
Throws:
If the specified sector or result array is null or undefined, or if either of the specified numLat or numLon values is less than one.
Type
ArgumentError
Returns:
The resolution actually achieved, which may be greater than that requested if the elevation data for the requested resolution is not currently available.
Type
Number

elevationTimestamp() → {Number}

Returns the time at which any elevations associated with this globe last changed.
Inherited From:
Source:
Returns:
The time in milliseconds relative to the Epoch of the most recent elevation change.
Type
Number

intersectsFrustum(frustum) → {Boolean}

Indicates whether this globe intersects a specified frustum.
Parameters:
Name Type Description
frustum Frustum The frustum to test.
Inherited From:
Source:
Throws:
If the specified frustum is null or undefined.
Type
ArgumentError
Returns:
true if this globe intersects the frustum, otherwise false.
Type
Boolean

intersectsLine(line, result) → {boolean}

Computes the first intersection of this globe with a specified line. The line is interpreted as a ray; intersection points behind the line's origin are ignored.
Parameters:
Name Type Description
line Line The line to intersect with this globe.
result Vec3 A pre-allocated Vec3 in which to return the computed point.
Inherited From:
Source:
Throws:
If the specified line or result argument is null or undefined.
Type
ArgumentError
Returns:
true If the ray intersects the globe, otherwise false.
Type
boolean

is2D() → {Boolean}

Indicates whether this is a 2D globe.
Inherited From:
Source:
Returns:
true if this is a 2D globe, otherwise false.
Type
Boolean

maxElevation() → {Number}

Returns this globe's maximum elevation.
Inherited From:
Source:
Returns:
This globe's maximum elevation.
Type
Number

minAndMaxElevationsForSector(sector) → {Array.<Number>}

Returns the minimum and maximum elevations within a specified sector of this globe.
Parameters:
Name Type Description
sector Sector The sector for which to determine extreme elevations.
Inherited From:
Source:
Throws:
If the specified sector is null or undefined.
Type
ArgumentError
Returns:
The An array containing the minimum and maximum elevations.
Type
Array.<Number>

minElevation() → {Number}

Returns this globe's minimum elevation.
Inherited From:
Source:
Returns:
This globe's minimum elevation.
Type
Number

northTangentAtLocation(latitude, longitude, result) → {Vec3}

Computes the north-pointing tangent vector to this globe's surface at a specified location.
Parameters:
Name Type Description
latitude Number The location's latitude.
longitude Number The location's longitude.
result Vec3 A pre-allocated Vec3 instance in which to return the computed vector. The returned tangent vector is unit length.
Inherited From:
Source:
Throws:
If the specified result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result vector.
Type
Vec3

northTangentAtPoint(x, y, z, result) → {Vec3}

Computes the north-pointing tangent vector to this globe's surface at a specified Cartesian point.
Parameters:
Name Type Description
x Number The point's X coordinate.
y Number The point's Y coordinate.
z Number The point's Z coordinate.
result Vec3 A pre-allocated Vec3 instance in which to return the computed vector. The returned tangent vector is unit length.
Inherited From:
Source:
Throws:
If the specified result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result vector.
Type
Vec3

radiusAt(latitude, longitude) → {Number}

Computes the radius of this globe at a specified location.
Parameters:
Name Type Description
latitude Number The locations' latitude.
longitude Number The locations' longitude.
Inherited From:
Source:
Returns:
The radius at the specified location.
Type
Number

surfaceNormalAtLocation(latitude, longitude, result) → {Vec3}

Computes the normal vector to this globe's surface at a specified location.
Parameters:
Name Type Description
latitude Number The location's latitude.
longitude Number The location's longitude.
result Vec3 A pre-allocated Vec3 instance in which to return the computed vector. The returned normal vector is unit length.
Inherited From:
Source:
Throws:
If the specified result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result vector. The returned normal vector is unit length.
Type
Vec3

surfaceNormalAtPoint(x, y, z, result) → {Vec3}

Computes the normal vector to this globe's surface at a specified Cartesian point.
Parameters:
Name Type Description
x Number The point's X coordinate.
y Number The point's Y coordinate.
z Number The point's Z coordinate.
result Vec3 A pre-allocated Vec3 instance in which to return the computed vector. The returned normal vector is unit length.
Inherited From:
Source:
Throws:
If the specified result argument is null or undefined.
Type
ArgumentError
Returns:
The specified result vector.
Type
Vec3