Options
All
  • Public
  • Public/Protected
  • All
Menu

A camera transforms points from the 'world' reference (often the map's reference) to the view (pixel coordinates). In layman terms: just like with television, the camera's position, orientation (and other parameters like the projection) determines what is shown on screen.

Note that the Camera API is a low-level API. For simple map navigation use cases, it's recommended to use the higher-level API. The MapNavigator API works in both 2D and 3D, on all map references. If you use the low-level Camera API, keep in mind that the same camera manipulation implementation might not work for other types of camera's (OrthographicCamera vs PerspectiveCamera) or other (types of) map references (projected vs. geocentric).

This is a base class shared by both PerspectiveCamera and OrthographicCamera. It describes the position, orientation and viewport of the camera, as well as provide functions to transform between 3D 'world' and 'view' (pixel) points.

The camera's position, orientation and viewport are described by the following parameters:

  • The eye point: the 3D position that the camera is looking from, in world coordinates.
  • The forward vector: the 3D direction the camera is looking in, in world coordinates. The combination of the forward and up vector determines the orientation of the camera. in world space.
  • The up vector: the 3D direction that indicates the 'up' direction of the camera, in world coordinates. The combination of the forward and up vector determines the orientation of the camera, in world space.
  • The near plane distance: the distance from the eye to the near clipping plane. Points that fall outside of the near/far interval, are clipped. Note that the near plane distance can be negative.
  • The far plane distance: the distance from the eye to the far clipping plane. Points that fall outside of the near/far interval, are clipped.
  • The width in pixels of the camera's viewport.
  • The height in pixels of the camera's viewport.
  • The worldReference: the coordinate reference in which the camera is positioned and oriented.

In practice, you only work with PerspectiveCamera and OrthographicCamera. Besides the camera position, orientation and viewport, these subclasses also define a projection (orthographic vs. perspective).

see

OrthographicCamera

see

PerspectiveCamera

Hierarchy

Overview

Accessors

aspectRatio

  • get aspectRatio(): number
  • The aspect ratio of the view port (width / height).

    Returns number

eye

  • The 3D position that the camera is looking from, in world coordinates.

    Returns Vector3

eyePoint

  • The 3D position that the camera is looking from, in world coordinates. This one is a shape instead of a Vector3, so it can easily be transformed to other references.

    Returns Point

far

  • get far(): number
  • The world distance from the eye to the far clipping plane. Points that fall outside of the near/far interval, are clipped. By default, this gets updated automatically on a 3D Map, to keep the earth's surface visible. See WebGLMap.adjustDepthRange for more information.

    Returns number

forward

  • The 3D direction the camera is looking in, in world coordinates. The combination of the forward and up vector determines the orientation of the camera. in world space.

    Returns Vector3

height

  • get height(): number
  • The height, in pixels, of the camera's viewport.

    Returns number

near

  • get near(): number
  • The world distance from the eye to the near clipping plane. Points that fall outside of the near/far interval, are clipped. By default, this gets updated automatically on a 3D Map, to keep the earth's surface visible. See WebGLMap.adjustDepthRange for more information. Note that the near plane distance can be negative.

    Returns number

up

  • The 3D direction that indicates the 'up' direction of the camera, in world coordinates. The combination of the forward and up vector determines the orientation of the camera, in world space.

    Returns Vector3

width

  • get width(): number
  • The width, in pixels, of the camera's viewport.

    Returns number

worldReference

  • The coordinate reference in which the camera is positioned and oriented.

    Returns CoordinateReference

Methods

toView

  • Transforms a Vector3 from world to view

    Parameters

    • worldVec: Vector3

      The world point to transform to view space (pixels).

    • Optional vectorSFCT: Vector3

      An optional 'out' parameter. If this is defined, it's x,y and z properties will be assigned to the result of the transformation. If it's not defined, a new Vector3 with the result is constructed and returned. Use this out parameter if you need to transform many points at once, and want to avoid creating many objects.

    Returns Vector3

    The transformed point, in view space (pixels)

toViewPoint

  • Transforms a Point from world to view

    Parameters

    • point: Point

      The point to transform to view space (pixels). If this point is not defined in this camera's worldReference, it will first be transformed to the worldReference.

    • Optional outPointSFCT: Point

      An optional 'out' parameter. If this is defined, that point will be moved to the result of the transformation. If it's not defined, a new Point with the result is constructed and returned. Use this out parameter if you need to transform many points at once, and want to avoid creating many Point instances.

    Returns Point

    The transformed point, in view space (pixels).

toWorld

  • Transforms a Vector3 to world.

    Parameters

    • viewVec: Vector3

      The view point (pixels) to transform to world space.

    • Optional vectorSFCT: Vector3

      An optional 'out' parameter. If this is defined, it's x,y and z properties will be assigned to the result of the transformation. If it's not defined, a new Vector3 with the result is constructed and returned. Use this out parameter if you need to transform many points at once, and want to avoid creating many objects.

    Returns Vector3

    The transformed point, in world space.

toWorldPoint

  • Transforms a Point to world.

    Parameters

    • viewPoint: Point

      The point to transform to view space (pixels). A 'view' point has 'null' as its reference.

    • Optional outPointSFCT: Point

      An optional 'out' parameter. If this is defined, that point will be moved to the result of the transformation. If it is defined, and has a reference other than worldReference, it will be transformed to that reference. If it's not defined, a new Point with the result is constructed and returned. Use this out parameter if you need to transform many points at once, and want to avoid creating many Point instances.

    Returns Point

    The transformed point, in view space (pixels).

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method