Options
All
  • Public
  • Public/Protected
  • All
Menu

A camera that uses an orthographic (aka. parallel) projection.

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).

A camera transforms points from the 'world' reference (often the map's reference) to the view (pixel coordinates).

Besides the position, orientation and viewport properties that it inherits from Camera, the orthographic camera defines its projection using the following properties:

  • worldWidth: the size of the viewport along the X (horizontal) direction, in world units.
  • worldHeight: the size of the viewport along the Y (vertical) direction, in world units.

Note that camera's in LuciadRIA are immutable. You can manipulate the map's camera by using copyAndSet or by converting from/to a Look2D.

Currently, the OrthographicCamera can only be used in combination with projected (grid) or cartesian map references (aka '2D' views). For now, you can not use this camera if the map has a geocentric (3D) reference.

For projected (grid) or cartesian references, the camera should be positioned along the positive Z axis, facing the negative Z direction. This way, the camera is positioned facing the XY-plane, where the map is rendered in.

To manipulate an orthographic camera on a projected (grid) or cartesian reference, we recommend using look2D. This allows you to reason about the camera in 2D space, instead of a 3D space. It also allows you to easily rotate and zoom the camera around any arbitrary view / world point.

Map navigation constraints configured on MapNavigator are not enforced when this camera is updated on the map. Constraints are only respected when using the MapNavigator.

// low-level manipulation of orthographicCamera: zoom by a factor of 2
map.camera = map.camera.copyAndSet({worldWidth: map.camera.worldWidth / 2, worldHeight: map.camera.worldHeight / 2});

// look2D() example: put the world's origin at pixel 200,200, and rotate the camera by 10 degrees (keeping the same scale)
var look2D = map.camera.asLook2D();
look2D.viewOrigin = {x: 200, y: 200, z: 0};
look2D.worldOrigin = {x: 0, y: 0, z: 0};
// look2D.scaleX and look2D.scaleY remain the same
look2D.rotation = look2D.rotation + 10;
map.camera = map.camera.look2D(look2D);

Hierarchy

Overview

Constructors

constructor

  • Creates a new OrthographicCamera

    Parameters

    • eye: Vector3

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

    • forward: Vector3

      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.

    • up: Vector3

      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.

    • near: number

      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.

    • far: number

      The distance from the eye to the far clipping plane. Points that fall outside of the near/far interval, are clipped.

    • width: number

      The width, in pixels, of the camera's viewport.

    • height: number

      The height, in pixels, of the camera's viewport.

    • worldWidth: number

      The size of the viewport along the X (horizontal) direction, in world units.

    • worldHeight: number

      The size of the viewport along the Y (vertical) direction, in world units.

    • worldReference: CoordinateReference

      The reference in which eye, forward, up, near, far are defined (as well as the world units referred to in scaleX and scaleY).

    Returns OrthographicCamera

Accessors

aspectRatio

  • get aspectRatio(): 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.

    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. 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

worldHeight

  • get worldHeight(): number
  • The size of the viewport along the Y (vertical) direction, in world units.

    Returns number

worldReference

worldWidth

  • get worldWidth(): number
  • The size of the viewport along the X (horizontal) direction, in world units.

    Returns number

Methods

asLook2D

  • Returns a look2d object that matches this camera's position and orientation. This look2D object makes it easier to work with '2D' cameras (Orthographic camera's with a projected (grid) or cartesian reference). Once retrieved, this look2D can be manipulated and then set on the map again using look2D

             <p>Note that this will only work if this camera's <a href="_ria_view_camera_orthographiccamera_d_.orthographiccamera.html#worldreference">worldReference</a> is a projected (grid) or cartesian reference.</p>
    see

    look2D

    see

    Look2D

    // rotate the map 45 degrees
    var look2D = map.camera.asLook2D();
    look2D.rotation += 45;
    map.camera = map.camera.look2D(look2D);

    Returns Look2D

    A Look2D object that matches this camera's position and orientation.

copy

copyAndSet

  • Copies this camera, and overrides parameters on the copy.

    Parameters

    Returns OrthographicCamera

    A copy of the current camera, with the parameters defined in the options overridden.

equals

  • (other: any): boolean
  • Checks if two cameras are equal.

    Parameters

    • other: any

      The other object to check equality for

    Returns boolean

    True if other is an OrthographicCamera instance with the same state as this one.

look2D

  • Returns a new OrthographicCamera, which is positioned and oriented as described by the look2d object. This look2D object makes it easier to work with '2D' cameras (Orthographic camera's with a projected (grid) or cartesian reference). You can construct a look2D object manually, or retrieve it from an existing camera using asLook2D.

             <p>Note that this will only work if this camera's <a href="_ria_view_camera_orthographiccamera_d_.orthographiccamera.html#worldreference">worldReference</a> is a projected (grid) or cartesian reference.</p>
    
             <p>For convenience, if worldOrigin is a <a href="_ria_shape_point_d_.point.html">Point</a>, LuciadRIA will attempt to transform it to the {#worldReference}.</p>
    see

    asLook2D

    see

    Look2D

    // put lon-lat point [12,5] at the center of the view
    map.camera.look2D({
      viewOrigin: {x: map.camera.width / 2, y: map.camera.height / 2, z: 0},
      worldOrigin: createPoint(ReferenceProvider.getReference("CRS:84"), [12, 5]),
      scaleX: map.camera.width / map.camera.worldWidth,
      scaleY: map.camera.height / map.camera.worldHeight,
      rotation: 0
    });

    Parameters

    • look2D: Look2D

      a Look2D object

    Returns OrthographicCamera

    A new camera instance that matches the position described by the Look2D object.

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