or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

3d-tiles.mdcore-math-geometry.mddata-sources.mdentity-data-visualization.mdimagery-terrain.mdindex.mdscene-3d-graphics.mdtime-animation.mdviewer-widgets.md
tile.json

core-math-geometry.mddocs/

Core Mathematics and Geometry

Core mathematical types, coordinate systems, geometric calculations, and utility functions essential for 3D graphics operations.

Capabilities

3D Vector Mathematics

Core 3D vector operations for positions, directions, and transformations.

/**
 * A 3D Cartesian point/vector with x, y, z components
 */
class Cartesian3 {
  constructor(x?: number, y?: number, z?: number);
  x: number;
  y: number;
  z: number;
  
  static fromDegrees(longitude: number, latitude: number, height?: number, ellipsoid?: Ellipsoid, result?: Cartesian3): Cartesian3;
  static fromRadians(longitude: number, latitude: number, height?: number, ellipsoid?: Ellipsoid, result?: Cartesian3): Cartesian3;
  static fromCartographicArray(cartographics: Cartographic[], ellipsoid?: Ellipsoid, result?: Cartesian3[]): Cartesian3[];
  static clone(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
  static add(left: Cartesian3, right: Cartesian3, result?: Cartesian3): Cartesian3;
  static subtract(left: Cartesian3, right: Cartesian3, result?: Cartesian3): Cartesian3;
  static multiplyByScalar(cartesian: Cartesian3, scalar: number, result?: Cartesian3): Cartesian3;
  static divideByScalar(cartesian: Cartesian3, scalar: number, result?: Cartesian3): Cartesian3;
  static negate(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
  static dot(left: Cartesian3, right: Cartesian3): number;
  static cross(left: Cartesian3, right: Cartesian3, result?: Cartesian3): Cartesian3;
  static magnitude(cartesian: Cartesian3): number;
  static magnitudeSquared(cartesian: Cartesian3): number;
  static normalize(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
  static distance(left: Cartesian3, right: Cartesian3): number;
  static distanceSquared(left: Cartesian3, right: Cartesian3): number;
  static lerp(start: Cartesian3, end: Cartesian3, t: number, result?: Cartesian3): Cartesian3;
  static equals(left?: Cartesian3, right?: Cartesian3): boolean;
  
  clone(result?: Cartesian3): Cartesian3;
  equals(right?: Cartesian3): boolean;
  toString(): string;
}

/**
 * A 2D Cartesian point/vector with x, y components
 */
class Cartesian2 {
  constructor(x?: number, y?: number);
  x: number;
  y: number;
  
  static clone(cartesian: Cartesian2, result?: Cartesian2): Cartesian2;
  static add(left: Cartesian2, right: Cartesian2, result?: Cartesian2): Cartesian2;
  static subtract(left: Cartesian2, right: Cartesian2, result?: Cartesian2): Cartesian2;
  static multiplyByScalar(cartesian: Cartesian2, scalar: number, result?: Cartesian2): Cartesian2;
  static dot(left: Cartesian2, right: Cartesian2): number;
  static magnitude(cartesian: Cartesian2): number;
  static normalize(cartesian: Cartesian2, result?: Cartesian2): Cartesian2;
  static distance(left: Cartesian2, right: Cartesian2): number;
  static equals(left?: Cartesian2, right?: Cartesian2): boolean;
}

/**
 * A 4D Cartesian point/vector with x, y, z, w components
 */
class Cartesian4 {
  constructor(x?: number, y?: number, z?: number, w?: number);
  x: number;
  y: number;
  z: number;
  w: number;
  
  static add(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4;
  static subtract(left: Cartesian4, right: Cartesian4, result?: Cartesian4): Cartesian4;
  static multiplyByScalar(cartesian: Cartesian4, scalar: number, result?: Cartesian4): Cartesian4;
  static dot(left: Cartesian4, right: Cartesian4): number;
  static magnitude(cartesian: Cartesian4): number;
  static equals(left?: Cartesian4, right?: Cartesian4): boolean;
}

Matrix Mathematics

Matrix operations for transformations, rotations, and projections.

/**
 * A 4x4 matrix for 3D transformations
 */
class Matrix4 {
  constructor(
    column0Row0?: number, column1Row0?: number, column2Row0?: number, column3Row0?: number,
    column0Row1?: number, column1Row1?: number, column2Row1?: number, column3Row1?: number,
    column0Row2?: number, column1Row2?: number, column2Row2?: number, column3Row2?: number,
    column0Row3?: number, column1Row3?: number, column2Row3?: number, column3Row3?: number
  );
  
  static clone(matrix: Matrix4, result?: Matrix4): Matrix4;
  static fromArray(array: number[], startingIndex?: number, result?: Matrix4): Matrix4;
  static fromColumnMajorArray(values: number[], result?: Matrix4): Matrix4;
  static fromTranslation(translation: Cartesian3, result?: Matrix4): Matrix4;
  static fromScale(scale: Cartesian3, result?: Matrix4): Matrix4;
  static fromRotationTranslation(rotation: Matrix3, translation?: Cartesian3, result?: Matrix4): Matrix4;
  static fromCamera(camera: Camera, result?: Matrix4): Matrix4;
  static computePerspectiveFieldOfView(fovY: number, aspectRatio: number, near: number, far: number, result?: Matrix4): Matrix4;
  static computeOrthographicOffCenter(left: number, right: number, bottom: number, top: number, near: number, far: number, result?: Matrix4): Matrix4;
  static computeViewportTransformation(viewport: BoundingRectangle, nearDepthRange?: number, farDepthRange?: number, result?: Matrix4): Matrix4;
  static multiply(left: Matrix4, right: Matrix4, result?: Matrix4): Matrix4;
  static multiplyByVector(matrix: Matrix4, cartesian: Cartesian4, result?: Cartesian4): Cartesian4;
  static multiplyByPoint(matrix: Matrix4, cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
  static multiplyByPointAsVector(matrix: Matrix4, cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
  static multiplyByTranslation(matrix: Matrix4, translation: Cartesian3, result?: Matrix4): Matrix4;
  static multiplyByScale(matrix: Matrix4, scale: Cartesian3, result?: Matrix4): Matrix4;
  static transpose(matrix: Matrix4, result?: Matrix4): Matrix4;
  static inverse(matrix: Matrix4, result?: Matrix4): Matrix4;
  static getTranslation(matrix: Matrix4, result?: Cartesian3): Cartesian3;
  static getMatrix3(matrix: Matrix4, result?: Matrix3): Matrix3;
  static equals(left?: Matrix4, right?: Matrix4): boolean;
}

/**
 * A 3x3 matrix for rotations and 2D transformations
 */
class Matrix3 {
  constructor(
    column0Row0?: number, column1Row0?: number, column2Row0?: number,
    column0Row1?: number, column1Row1?: number, column2Row1?: number,
    column0Row2?: number, column1Row2?: number, column2Row2?: number
  );
  
  static fromRotationX(angle: number, result?: Matrix3): Matrix3;
  static fromRotationY(angle: number, result?: Matrix3): Matrix3;
  static fromRotationZ(angle: number, result?: Matrix3): Matrix3;
  static fromScale(scale: Cartesian2, result?: Matrix3): Matrix3;
  static multiply(left: Matrix3, right: Matrix3, result?: Matrix3): Matrix3;
  static transpose(matrix: Matrix3, result?: Matrix3): Matrix3;
  static inverse(matrix: Matrix3, result?: Matrix3): Matrix3;
  static equals(left?: Matrix3, right?: Matrix3): boolean;
}

Coordinate Systems

Geographic and projected coordinate system transformations.

/**
 * Geographic coordinates in longitude, latitude, height
 */
class Cartographic {
  constructor(longitude?: number, latitude?: number, height?: number);
  longitude: number;
  latitude: number;
  height: number;
  
  static fromDegrees(longitude: number, latitude: number, height?: number, result?: Cartographic): Cartographic;
  static fromRadians(longitude: number, latitude: number, height?: number, result?: Cartographic): Cartographic;
  static fromCartesian(cartesian: Cartesian3, ellipsoid?: Ellipsoid, result?: Cartographic): Cartographic;
  static clone(cartographic: Cartographic, result?: Cartographic): Cartographic;
  static equals(left?: Cartographic, right?: Cartographic): boolean;
  
  clone(result?: Cartographic): Cartographic;
  equals(right?: Cartographic): boolean;
  toString(): string;
}

/**
 * Reference ellipsoid for coordinate transformations
 */
class Ellipsoid {
  constructor(x?: number, y?: number, z?: number);
  readonly radii: Cartesian3;
  readonly radiiSquared: Cartesian3;
  readonly radiiToTheFourth: Cartesian3;
  readonly oneOverRadii: Cartesian3;
  readonly oneOverRadiiSquared: Cartesian3;
  readonly minimumRadius: number;
  readonly maximumRadius: number;
  static readonly WGS84: Ellipsoid;
  static readonly UNIT_SPHERE: Ellipsoid;
  
  cartographicToCartesian(cartographic: Cartographic, result?: Cartesian3): Cartesian3;
  cartographicArrayToCartesianArray(cartographics: Cartographic[], result?: Cartesian3[]): Cartesian3[];
  cartesianToCartographic(cartesian: Cartesian3, result?: Cartographic): Cartographic;
  cartesianArrayToCartographicArray(cartesians: Cartesian3[], result?: Cartographic[]): Cartographic[];
  scaleToGeodeticSurface(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
  scaleToGeocentricSurface(cartesian: Cartesian3, result?: Cartesian3): Cartesian3;
  transformPositionToScaledSpace(position: Cartesian3, result?: Cartesian3): Cartesian3;
  transformPositionFromScaledSpace(position: Cartesian3, result?: Cartesian3): Cartesian3;
  equals(right?: Ellipsoid): boolean;
}

Geometric Shapes and Bounding Volumes

Geometric primitives and bounding volume calculations.

/**
 * A bounding sphere defined by center point and radius
 */
class BoundingSphere {
  constructor(center?: Cartesian3, radius?: number);
  center: Cartesian3;
  radius: number;
  
  static fromPoints(positions: Cartesian3[], result?: BoundingSphere): BoundingSphere;
  static fromRectangle2D(rectangle: Rectangle, projection?: MapProjection, result?: BoundingSphere): BoundingSphere;
  static fromRectangle3D(rectangle: Rectangle, ellipsoid?: Ellipsoid, surfaceHeight?: number, result?: BoundingSphere): BoundingSphere;
  static fromBoundingSpheres(boundingSpheres: BoundingSphere[], result?: BoundingSphere): BoundingSphere;
  static fromOrientedBoundingBox(orientedBoundingBox: OrientedBoundingBox, result?: BoundingSphere): BoundingSphere;
  static fromTransformation(transformation: Matrix4, result?: BoundingSphere): BoundingSphere;
  static expand(sphere: BoundingSphere, point: Cartesian3, result?: BoundingSphere): BoundingSphere;
  static union(left: BoundingSphere, right: BoundingSphere, result?: BoundingSphere): BoundingSphere;
  static intersectPlane(sphere: BoundingSphere, plane: Plane): Intersect;
  static transform(sphere: BoundingSphere, transform: Matrix4, result?: BoundingSphere): BoundingSphere;
  static distanceSquaredTo(sphere: BoundingSphere, cartesian: Cartesian3): number;
  static equals(left?: BoundingSphere, right?: BoundingSphere): boolean;
  
  intersectPlane(plane: Plane): Intersect;
  distanceSquaredTo(cartesian: Cartesian3): number;
  computePlaneDistances(position: Cartesian3, direction: Cartesian3, result?: Interval): Interval;
  equals(right?: BoundingSphere): boolean;
  clone(result?: BoundingSphere): BoundingSphere;
}

/**
 * An axis-aligned bounding box
 */
class AxisAlignedBoundingBox {
  constructor(minimum?: Cartesian3, maximum?: Cartesian3, center?: Cartesian3);
  minimum: Cartesian3;
  maximum: Cartesian3;
  center: Cartesian3;
  
  static fromPoints(positions: Cartesian3[], result?: AxisAlignedBoundingBox): AxisAlignedBoundingBox;
  static clone(box: AxisAlignedBoundingBox, result?: AxisAlignedBoundingBox): AxisAlignedBoundingBox;
  static equals(left?: AxisAlignedBoundingBox, right?: AxisAlignedBoundingBox): boolean;
  static intersectPlane(box: AxisAlignedBoundingBox, plane: Plane): Intersect;
  
  clone(result?: AxisAlignedBoundingBox): AxisAlignedBoundingBox;
  intersectPlane(plane: Plane): Intersect;
  distanceSquaredTo(cartesian: Cartesian3): number;
  equals(right?: AxisAlignedBoundingBox): boolean;
}

/**
 * A 2D bounding rectangle
 */
class BoundingRectangle {
  constructor(x?: number, y?: number, width?: number, height?: number);
  x: number;
  y: number;
  width: number;
  height: number;
  
  static fromPoints(positions: Cartesian2[], result?: BoundingRectangle): BoundingRectangle;
  static fromRectangle(rectangle: Rectangle, projection?: MapProjection, result?: BoundingRectangle): BoundingRectangle;
  static clone(rectangle: BoundingRectangle, result?: BoundingRectangle): BoundingRectangle;
  static union(left: BoundingRectangle, right: BoundingRectangle, result?: BoundingRectangle): BoundingRectangle;
  static expand(rectangle: BoundingRectangle, point: Cartesian2, result?: BoundingRectangle): BoundingRectangle;
  static intersect(left: BoundingRectangle, right: BoundingRectangle): Intersect;
  static equals(left?: BoundingRectangle, right?: BoundingRectangle): boolean;
  
  clone(result?: BoundingRectangle): BoundingRectangle;
  intersect(right: BoundingRectangle): Intersect;
  equals(right?: BoundingRectangle): boolean;
}

Geometric Primitives

Basic geometric shapes and calculations.

/**
 * A mathematical plane defined by normal vector and distance
 */
class Plane {
  constructor(normal: Cartesian3, distance: number);
  normal: Cartesian3;
  distance: number;
  
  static fromPointNormal(point: Cartesian3, normal: Cartesian3, result?: Plane): Plane;
  static fromCartesian4(coefficients: Cartesian4, result?: Plane): Plane;
  static getPointDistance(plane: Plane, point: Cartesian3): number;
  static projectPointOntoPlane(plane: Plane, point: Cartesian3, result?: Cartesian3): Cartesian3;
  static transform(plane: Plane, transform: Matrix4, result?: Plane): Plane;
  static equals(left?: Plane, right?: Plane): boolean;
  
  getPointDistance(point: Cartesian3): number;
  equals(right?: Plane): boolean;
}

/**
 * A mathematical ray defined by origin and direction
 */
class Ray {
  constructor(origin?: Cartesian3, direction?: Cartesian3);
  origin: Cartesian3;
  direction: Cartesian3;
  
  static getPoint(ray: Ray, t: number, result?: Cartesian3): Cartesian3;
  
  getPoint(t: number, result?: Cartesian3): Cartesian3;
}

/**
 * Geographic rectangle defined by longitude/latitude bounds
 */
class Rectangle {
  constructor(west?: number, south?: number, east?: number, north?: number);
  west: number;
  south: number;
  east: number;
  north: number;
  
  static fromDegrees(west: number, south: number, east: number, north: number, result?: Rectangle): Rectangle;
  static fromRadians(west: number, south: number, east: number, north: number, result?: Rectangle): Rectangle;
  static fromCartographicArray(cartographics: Cartographic[], result?: Rectangle): Rectangle;
  static fromCartesianArray(cartesians: Cartesian3[], ellipsoid?: Ellipsoid, result?: Rectangle): Rectangle;
  static clone(rectangle: Rectangle, result?: Rectangle): Rectangle;
  static equals(left?: Rectangle, right?: Rectangle): boolean;
  static union(left: Rectangle, right: Rectangle, result?: Rectangle): Rectangle;
  static expand(rectangle: Rectangle, cartographic: Cartographic, result?: Rectangle): Rectangle;
  static contains(rectangle: Rectangle, cartographic: Cartographic): boolean;
  static subsample(rectangle: Rectangle, ellipsoid?: Ellipsoid, surfaceHeight?: number, result?: Cartesian3[]): Cartesian3[];
  static getCenter(rectangle: Rectangle, result?: Cartographic): Cartographic;
  static intersection(left: Rectangle, right: Rectangle, result?: Rectangle): Rectangle;
  static simpleIntersection(left: Rectangle, right: Rectangle, result?: Rectangle): Rectangle;
  static computeWidth(rectangle: Rectangle): number;
  static computeHeight(rectangle: Rectangle): number;
  
  clone(result?: Rectangle): Rectangle;
  equals(other?: Rectangle): boolean;
}

Mathematical Utilities

Core mathematical functions and constants.

/**
 * Mathematical utility functions and constants
 */
const Math: {
  readonly EPSILON1: number;
  readonly EPSILON2: number;
  readonly EPSILON3: number;
  readonly EPSILON4: number;
  readonly EPSILON5: number;
  readonly EPSILON6: number;
  readonly EPSILON7: number;
  readonly EPSILON8: number;
  readonly EPSILON9: number;
  readonly EPSILON10: number;
  readonly EPSILON11: number;
  readonly EPSILON12: number;
  readonly EPSILON13: number;
  readonly EPSILON14: number;
  readonly EPSILON15: number;
  readonly EPSILON16: number;
  readonly EPSILON17: number;
  readonly EPSILON18: number;
  readonly EPSILON19: number;
  readonly EPSILON20: number;
  readonly GRAVITATIONALPARAMETER: number;
  readonly SOLAR_RADIUS: number;
  readonly LUNAR_RADIUS: number;
  readonly SIXTY_FOUR_KILOBYTES: number;
  readonly PI: number;
  readonly ONE_OVER_PI: number;
  readonly PI_OVER_TWO: number;
  readonly PI_OVER_THREE: number;
  readonly PI_OVER_FOUR: number;
  readonly PI_OVER_SIX: number;
  readonly THREE_PI_OVER_TWO: number;
  readonly TWO_PI: number;
  readonly ONE_OVER_TWO_PI: number;
  readonly RADIANS_PER_DEGREE: number;
  readonly DEGREES_PER_RADIAN: number;
  readonly RADIANS_PER_ARCSECOND: number;
  
  sign(value: number): number;
  signNotZero(value: number): number;
  toSNorm(value: number, rangeMaximum?: number): number;
  fromSNorm(value: number, rangeMaximum?: number): number;
  normalize(value: number, rangeMinimum: number, rangeMaximum: number): number;
  sinh(value: number): number;
  cosh(value: number): number;
  lerp(p: number, q: number, time: number): number;
  toRadians(degrees: number): number;
  toDegrees(radians: number): number;
  convertLongitudeRange(angle: number): number;
  clampToLatitudeRange(angle: number): number;
  negativePiToPi(angle: number): number;
  zeroToTwoPi(angle: number): number;
  mod(m: number, n: number): number;
  equalsEpsilon(left: number, right: number, relativeEpsilon?: number, absoluteEpsilon?: number): boolean;
  factorial(n: number): number;
  incrementWrap(n?: number, maximumValue?: number, minimumValue?: number): number;
  isPowerOfTwo(n: number): boolean;
  nextPowerOfTwo(n: number): number;
  previousPowerOfTwo(n: number): number;
  clamp(value: number, min: number, max: number): number;
  setRandomNumberSeed(seed: number): void;
  nextRandomNumber(): number;
  acosClamped(value: number): number;
  asinClamped(value: number): number;
  chordLength(angle: number, radius: number): number;
  logBase(number: number, base: number): number;
  cbrt(number: number): number;
  log2(number: number): number;
};

Core Utilities

Essential utility functions used throughout CesiumJS for validation, object manipulation, and error handling.

/**
 * Tests if a value is defined (not undefined and not null)
 * @param value - The value to test
 * @returns true if value is defined, false otherwise
 */
function defined(value: any): boolean;

/**
 * Destroys an object by replacing all functions with error-throwing functions and removing properties
 * Useful for preventing memory leaks and catching use-after-destruction bugs
 * @param object - The object to destroy
 * @param message - Optional message to include in error when destroyed object is used
 * @returns undefined
 */
function destroyObject(object: object, message?: string): undefined;

/**
 * Clones an object, optionally performing deep cloning
 * @param object - The object to clone
 * @param deep - If true, all properties will be deep cloned recursively
 * @returns A clone of the object
 */
function clone(object: object, deep?: boolean): object;

/**
 * Merges two objects into a new combined object, optionally performing deep combining
 * @param object1 - First object to combine
 * @param object2 - Second object to combine (takes precedence on conflicts)
 * @param deep - If true, all properties will be deep combined recursively
 * @returns A new combined object
 */
function combine(object1?: object, object2?: object, deep?: boolean): object;

/**
 * Developer error exception for bugs in calling code
 */
class DeveloperError extends Error {
  constructor(message?: string);
  toString(): string;
  static throwInstantiationError(): void;
}

/**
 * Runtime error exception for runtime failures
 */
class RuntimeError extends Error {
  constructor(message?: string);
  toString(): string;
}

/**
 * Generic utility class for managing event listeners
 */
class Event<Listener extends (...args: any[]) => void = (...args: any[]) => void> {
  readonly numberOfListeners: number;
  addEventListener(listener: Listener, scope?: object): Event.RemoveCallback;
  removeEventListener(listener: Listener, scope?: object): boolean;
  raiseEvent(...args: Parameters<Listener>): void;
}

/**
 * Convenience class for managing multiple event listeners that can be removed together
 */
class EventHelper {
  add(event: Event, listener: Function, scope?: object): EventHelper.RemoveCallback;
  removeAll(): void;
}

/**
 * Handles loading and caching of external resources with retry logic and request scheduling
 */
class Resource {
  constructor(options: Resource.ConstructorOptions);
  readonly url: string;
  readonly queryParameters: any;
  readonly templateValues: any;
  readonly headers: any;
  readonly proxy: Proxy;
  readonly retryCallback: Resource.RetryCallback;
  readonly retryAttempts: number;
  readonly request: Request;
  
  static createIfNeeded(resource: Resource | string): Resource;
  getDerivedResource(options: object): Resource;
  setProxy(proxy: Proxy): Resource;
  setQueryParameters(params: any, useAsDefault?: boolean): Resource;
  appendQueryParameters(params: any): Resource;
  setTemplateValues(template: any, useAsDefault?: boolean): Resource;
  getUrlComponent(query?: boolean, proxy?: boolean): string;
  setRequestHeader(key: string, value: string): Resource;
  appendRequestHeader(key: string, value: string): Resource;
  
  fetchArrayBuffer(): Promise<ArrayBuffer>;
  fetchBlob(): Promise<Blob>;
  fetchImage(options?: Resource.FetchImageOptions): Promise<HTMLImageElement>;
  fetchText(): Promise<string>;
  fetchJson(): Promise<any>;
  fetchXML(): Promise<XMLDocument>;
  fetch(options?: RequestOptions): Promise<any>;
  
  delete(options?: RequestOptions): Promise<any>;
  head(options?: RequestOptions): Promise<any>;
  options(options?: RequestOptions): Promise<any>;
  post(data: any, options?: RequestOptions): Promise<any>;
  put(data: any, options?: RequestOptions): Promise<any>;
  patch(data: any, options?: RequestOptions): Promise<any>;
}

/**
 * Stores information for making a request, used by Resource for scheduling and prioritization
 */
class Request {
  constructor(options?: Request.Options);
  url?: string;
  requestFunction?: Request.RequestCallback;
  cancelFunction?: Request.CancelCallback;
  priorityFunction?: Request.PriorityCallback;
  priority: number;
  throttle: boolean;
  throttleByServer: boolean;
  type: RequestType;
  state: RequestState;
}

/**
 * Parameter validation functions for debugging (typically stripped in production builds)
 */
const Check: {
  defined(name: string, test: any): void;
  typeOf: {
    func(name: string, test: any): void;
    string(name: string, test: any): void;
    number(name: string, test: any): void;
    object(name: string, test: any): void;
    boolean(name: string, test: any): void;
  };
};

/**
 * Logs warnings that should only appear once per identifier
 * @param identifier - Unique identifier for the warning
 * @param message - Warning message to log
 */
function oneTimeWarning(identifier: string, message?: string): void;

Geometry Classes

Procedural geometry generation for 3D shapes and outlines.

/**
 * Base geometry interface
 */
interface Geometry {
  readonly attributes: GeometryAttributes;
  readonly indices?: Uint16Array | Uint32Array;
  readonly primitiveType: PrimitiveType;
  readonly boundingSphere?: BoundingSphere;
}

/**
 * Attributes for geometry vertices
 */
interface GeometryAttributes {
  position?: GeometryAttribute;
  normal?: GeometryAttribute;
  st?: GeometryAttribute;
  color?: GeometryAttribute;
  tangent?: GeometryAttribute;
  bitangent?: GeometryAttribute;
}

/**
 * Individual geometry attribute
 */
interface GeometryAttribute {
  componentDatatype: ComponentDatatype;
  componentsPerAttribute: number;
  normalize?: boolean;
  values: TypedArray;
}

/**
 * Box geometry for rectangular prisms
 */
class BoxGeometry {
  constructor(options: BoxGeometryOptions);
  static packedLength: number;
  
  static createGeometry(boxGeometry: BoxGeometry): Geometry;
  static pack(value: BoxGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: BoxGeometry): BoxGeometry;
}

interface BoxGeometryOptions {
  dimensions: Cartesian3;
  vertexFormat?: VertexFormat;
}

/**
 * Box outline geometry
 */
class BoxOutlineGeometry {
  constructor(options: BoxOutlineGeometryOptions);
  static packedLength: number;
  
  static createGeometry(boxGeometry: BoxOutlineGeometry): Geometry;
  static pack(value: BoxOutlineGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: BoxOutlineGeometry): BoxOutlineGeometry;
}

interface BoxOutlineGeometryOptions {
  dimensions: Cartesian3;
}

/**
 * Sphere geometry for 3D spheres
 */
class SphereGeometry {
  constructor(options?: SphereGeometryOptions);
  static packedLength: number;
  
  static createGeometry(sphereGeometry: SphereGeometry): Geometry;
  static pack(value: SphereGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: SphereGeometry): SphereGeometry;
}

interface SphereGeometryOptions {
  radius?: number;
  stackPartitions?: number;
  slicePartitions?: number;
  vertexFormat?: VertexFormat;
}

/**
 * Sphere outline geometry
 */
class SphereOutlineGeometry {
  constructor(options?: SphereOutlineGeometryOptions);
  static packedLength: number;
  
  static createGeometry(sphereGeometry: SphereOutlineGeometry): Geometry;
  static pack(value: SphereOutlineGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: SphereOutlineGeometry): SphereOutlineGeometry;
}

interface SphereOutlineGeometryOptions {
  radius?: number;
  stackPartitions?: number;
  slicePartitions?: number;
  subdivisions?: number;
}

/**
 * Circle geometry for flat circles
 */
class CircleGeometry {
  constructor(options: CircleGeometryOptions);
  static packedLength: number;
  
  static createGeometry(circleGeometry: CircleGeometry): Geometry;
  static pack(value: CircleGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: CircleGeometry): CircleGeometry;
}

interface CircleGeometryOptions {
  center: Cartesian3;
  radius: number;
  ellipsoid?: Ellipsoid;
  height?: number;
  granularity?: number;
  vertexFormat?: VertexFormat;
  extrudedHeight?: number;
  stRotation?: number;
}

/**
 * Circle outline geometry
 */
class CircleOutlineGeometry {
  constructor(options: CircleOutlineGeometryOptions);
  static packedLength: number;
  
  static createGeometry(circleGeometry: CircleOutlineGeometry): Geometry;
  static pack(value: CircleOutlineGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: CircleOutlineGeometry): CircleOutlineGeometry;
}

interface CircleOutlineGeometryOptions {
  center: Cartesian3;
  radius: number;
  ellipsoid?: Ellipsoid;
  height?: number;
  granularity?: number;
  numberOfVerticalLines?: number;
  extrudedHeight?: number;
}

/**
 * Cylinder geometry
 */
class CylinderGeometry {
  constructor(options: CylinderGeometryOptions);
  static packedLength: number;
  
  static createGeometry(cylinderGeometry: CylinderGeometry): Geometry;
  static pack(value: CylinderGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: CylinderGeometry): CylinderGeometry;
}

interface CylinderGeometryOptions {
  length: number;
  topRadius: number;
  bottomRadius: number;
  slices?: number;
  vertexFormat?: VertexFormat;
}

/**
 * Cylinder outline geometry
 */
class CylinderOutlineGeometry {
  constructor(options: CylinderOutlineGeometryOptions);
  static packedLength: number;
  
  static createGeometry(cylinderGeometry: CylinderOutlineGeometry): Geometry;
  static pack(value: CylinderOutlineGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: CylinderOutlineGeometry): CylinderOutlineGeometry;
}

interface CylinderOutlineGeometryOptions {
  length: number;
  topRadius: number;
  bottomRadius: number;
  slices?: number;
  numberOfVerticalLines?: number;
}

/**
 * Ellipse geometry for elliptical shapes
 */
class EllipseGeometry {
  constructor(options: EllipseGeometryOptions);
  static packedLength: number;
  
  static createGeometry(ellipseGeometry: EllipseGeometry): Geometry;
  static pack(value: EllipseGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: EllipseGeometry): EllipseGeometry;
}

interface EllipseGeometryOptions {
  center: Cartesian3;
  semiMajorAxis: number;
  semiMinorAxis: number;
  ellipsoid?: Ellipsoid;
  height?: number;
  extrudedHeight?: number;
  rotation?: number;
  stRotation?: number;
  granularity?: number;
  vertexFormat?: VertexFormat;
}

/**
 * Ellipse outline geometry
 */
class EllipseOutlineGeometry {
  constructor(options: EllipseOutlineGeometryOptions);
  static packedLength: number;
  
  static createGeometry(ellipseGeometry: EllipseOutlineGeometry): Geometry;
  static pack(value: EllipseOutlineGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: EllipseOutlineGeometry): EllipseOutlineGeometry;
}

interface EllipseOutlineGeometryOptions {
  center: Cartesian3;
  semiMajorAxis: number;
  semiMinorAxis: number;
  ellipsoid?: Ellipsoid;
  height?: number;
  extrudedHeight?: number;
  rotation?: number;
  granularity?: number;
  numberOfVerticalLines?: number;
}

/**
 * Polygon geometry for filled polygonal areas
 */
class PolygonGeometry {
  constructor(options: PolygonGeometryOptions);
  static packedLength: number;
  
  static createGeometry(polygonGeometry: PolygonGeometry): Geometry;
  static pack(value: PolygonGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: PolygonGeometry): PolygonGeometry;
}

interface PolygonGeometryOptions {
  polygonHierarchy: PolygonHierarchy;
  height?: number;
  extrudedHeight?: number;
  vertexFormat?: VertexFormat;
  stRotation?: number;
  ellipsoid?: Ellipsoid;
  granularity?: number;
  perPositionHeight?: boolean;
  closeTop?: boolean;
  closeBottom?: boolean;
  arcType?: ArcType;
}

/**
 * Polygon outline geometry
 */
class PolygonOutlineGeometry {
  constructor(options: PolygonOutlineGeometryOptions);
  static packedLength: number;
  
  static createGeometry(polygonGeometry: PolygonOutlineGeometry): Geometry;
  static pack(value: PolygonOutlineGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: PolygonOutlineGeometry): PolygonOutlineGeometry;
}

interface PolygonOutlineGeometryOptions {
  polygonHierarchy: PolygonHierarchy;
  height?: number;
  extrudedHeight?: number;
  ellipsoid?: Ellipsoid;
  granularity?: number;
  perPositionHeight?: boolean;
  arcType?: ArcType;
}

/**
 * Rectangle geometry for rectangular areas
 */
class RectangleGeometry {
  constructor(options: RectangleGeometryOptions);
  static packedLength: number;
  
  static createGeometry(rectangleGeometry: RectangleGeometry): Geometry;
  static pack(value: RectangleGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: RectangleGeometry): RectangleGeometry;
}

interface RectangleGeometryOptions {
  rectangle: Rectangle;
  vertexFormat?: VertexFormat;
  ellipsoid?: Ellipsoid;
  granularity?: number;
  height?: number;
  rotation?: number;
  stRotation?: number;
  extrudedHeight?: number;
}

/**
 * Rectangle outline geometry
 */
class RectangleOutlineGeometry {
  constructor(options: RectangleOutlineGeometryOptions);
  static packedLength: number;
  
  static createGeometry(rectangleGeometry: RectangleOutlineGeometry): Geometry;
  static pack(value: RectangleOutlineGeometry, array: number[], startingIndex?: number): number[];
  static unpack(array: number[], startingIndex?: number, result?: RectangleOutlineGeometry): RectangleOutlineGeometry;
}

interface RectangleOutlineGeometryOptions {
  rectangle: Rectangle;
  ellipsoid?: Ellipsoid;
  granularity?: number;
  height?: number;
  rotation?: number;
  extrudedHeight?: number;
}

Types

enum Intersect {
  OUTSIDE = 0,
  INTERSECTING = 1,
  INSIDE = 2
}

interface Interval {
  start: number;
  stop: number;
}

interface Packable {
  pack(value: any, array: number[], startingIndex?: number): number[];
  unpack(array: number[], startingIndex?: number, result?: any): any;
  readonly packedLength: number;
}

interface VertexFormat {
  position?: boolean;
  normal?: boolean;
  st?: boolean;
  bitangent?: boolean;
  tangent?: boolean;
  color?: boolean;
}

interface PolygonHierarchy {
  positions: Cartesian3[];
  holes?: PolygonHierarchy[];
}

enum PrimitiveType {
  POINTS = 0,
  LINES = 1,
  LINE_LOOP = 2,
  LINE_STRIP = 3,
  TRIANGLES = 4,
  TRIANGLE_STRIP = 5,
  TRIANGLE_FAN = 6
}

enum ComponentDatatype {
  BYTE = 5120,
  UNSIGNED_BYTE = 5121,
  SHORT = 5122,
  UNSIGNED_SHORT = 5123,
  INT = 5124,
  UNSIGNED_INT = 5125,
  FLOAT = 5126,
  DOUBLE = 5130
}

enum ArcType {
  NONE = 0,
  GEODESIC = 1,
  RHUMB = 2
}

type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;

// Core Utility Types
type Event.RemoveCallback = () => void;
type EventHelper.RemoveCallback = () => void;

interface Resource.ConstructorOptions {
  url: string;
  queryParameters?: any;
  templateValues?: any;
  headers?: any;
  proxy?: Proxy;
  retryCallback?: Resource.RetryCallback;
  retryAttempts?: number;
  request?: Request;
}

interface Resource.FetchImageOptions {
  preferImageBitmap?: boolean;
  preferBlob?: boolean;
  flipY?: boolean;
  skipColorSpaceConversion?: boolean;
}

type Resource.RetryCallback = (resource: Resource, error: Error) => boolean | Promise<boolean>;

interface Request.Options {
  url?: string;
  requestFunction?: Request.RequestCallback;
  cancelFunction?: Request.CancelCallback;
  priorityFunction?: Request.PriorityCallback;
  priority?: number;
  throttle?: boolean;
  throttleByServer?: boolean;
  type?: RequestType;
}

type Request.RequestCallback = () => Promise<any> | any;
type Request.CancelCallback = () => void;
type Request.PriorityCallback = () => number;

interface RequestOptions {
  headers?: any;
  method?: string;
  data?: any;
  responseType?: string;
}

enum RequestType {
  TERRAIN = 0,
  IMAGERY = 1,
  TILES3D = 2,
  OTHER = 3
}

enum RequestState {
  UNISSUED = 0,
  ISSUED = 1,
  RECEIVED = 2,
  CANCELLED = 3,
  FAILED = 4
}

abstract class Proxy {
  abstract getURL(resource: string): string;
}