LuciadCPillar C# 2024.0.04
Luciad.Cameras.Camera Class Reference

A camera transforms points from the map reference to view coordinates (device independent pixel coordinates). More...

Inheritance diagram for Luciad.Cameras.Camera:
Luciad.Cameras.OrthographicCamera Luciad.Cameras.PerspectiveCamera

Classes

struct  Look
 Structure describing the position and orientation of the camera. More...
 
struct  Look2D
 Structure describing the position of the camera for an orthographic top-down view. More...
 
struct  LookAt
 Structure to orient a camera based on a specific target point. More...
 
struct  LookFrom
 Structure describing the position and orientation of the camera. More...
 

Public Member Functions

void Dispose ()
 
virtual Luciad.Cartesian.Coordinate MapToView (Luciad.Cartesian.Coordinate mapPoint)
 Transforms a point in map coordinates to view coordinates. More...
 
virtual Luciad.Cartesian.Coordinate ViewToMap (Luciad.Cartesian.Coordinate viewPoint)
 Transforms a view point to map coordinates. More...
 

Properties

Luciad.Cartesian.Coordinate Eye [get]
 The current location of the camera in map coordinates. More...
 
double Far [get]
 The distance from the eye to the far clipping plane. More...
 
Luciad.Cartesian.Coordinate Forward [get]
 The (normalized) direction corresponding to the forward direction of the view. More...
 
double Height [get]
 The height in device independent pixels of the viewport of this camera. More...
 
double Near [get]
 The distance from the eye to the near clipping plane. More...
 
Luciad.Cartesian.Coordinate Up [get]
 The (normalized) direction corresponding to the upward direction of the view. More...
 
double Width [get]
 The width in device independent pixels of the viewport of this camera. More...
 

Detailed Description

A camera transforms points from the map reference to view coordinates (device independent pixel coordinates).

In layman's 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 cameras (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 map and view (device independent pixel coordinates on the camera's viewport) 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 map coordinates
  • The forward vector: the 3D direction the camera is looking in, in map coordinates. The combination of the forward and up vector determines the orientation of the camera, in map space.
  • The up vector: the 3D direction that indicates the up direction of the camera, in map coordinates. The combination of the forward and up vector determines the orientation of the camera, in map 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.
  • 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 device independent pixels of the camera's viewport. This is the same as the Map width.
  • The height in device independent pixels of the camera's viewport. This is the same as the Map height.

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

Unlike Map.ViewMapTransformation, the coordinate conversion methods do not take into account the content on the screen. The camera's methods are nothing more than low-level mathematical functions. In most cases, it is advised to convert coordinate from view to map and vice versa using Map.ViewMapTransformation.

See also related article.

Since
2021.1
See also
OrthographicCamera
PerspectiveCamera

Member Function Documentation

◆ Dispose()

void Luciad.Cameras.Camera.Dispose ( )
inline

◆ MapToView()

virtual Luciad.Cartesian.Coordinate Luciad.Cameras.Camera.MapToView ( Luciad.Cartesian.Coordinate  mapPoint)
inlinevirtual

Transforms a point in map coordinates to view coordinates.

For perspective cameras, the resulting view coordinate will contain a z-coordinate. This allows to transform the resulting view point back to the original point.

Note
This method does not take into account the visibility of a map location. It will, for example, convert the point regardless of whether it is clipped away or not by the rendering pipeline. For most use cases, it is preferred to use the ViewMapTransformation to convert a location in map coordinates to view coordinates.
Parameters
mapPointA point, defined in the reference of the Map.
Returns
a point in view coordinates, in device independent pixels. (0, 0) is defined in the top-left corner of the screen.

◆ ViewToMap()

virtual Luciad.Cartesian.Coordinate Luciad.Cameras.Camera.ViewToMap ( Luciad.Cartesian.Coordinate  viewPoint)
inlinevirtual

Transforms a view point to map coordinates.

When the camera is a perspective camera, the z-value of the view point is used to determine the depth of the Map point:

  • -∞ => the point is located on the eye point of the camera
  • ]-∞, 0[ => the point is located between the camera eye point and the near plane
  • [0, 1] => the point is between the near plane and the far plane
  • ]1, far/(far-near)] => the point is located beyond the far plane.
  • ]far/(far-near), +∞[ => the point is located behind the camera.
Note
This method does not take terrain or earth geometry into account. For most use cases, it is preferred to use the ViewMapTransformation to convert a view location to a map point on the terrain or a visible surface.
Parameters
viewPointA view point, in device independent pixels. (0, 0) is defined in the top-left corner of the screen.
Returns
a point defined in the reference of the map reference.

Property Documentation

◆ Eye

Luciad.Cartesian.Coordinate Luciad.Cameras.Camera.Eye
get

The current location of the camera in map coordinates.

[get]

Returns the current location of the camera in map coordinates.

◆ Far

double Luciad.Cameras.Camera.Far
get

The distance from the eye to the far clipping plane.

[get]

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

◆ Forward

Luciad.Cartesian.Coordinate Luciad.Cameras.Camera.Forward
get

The (normalized) direction corresponding to the forward direction of the view.

[get]

Returns the (normalized) direction corresponding to the forward direction of the view. It is defined in the map reference.

◆ Height

double Luciad.Cameras.Camera.Height
get

The height in device independent pixels of the viewport of this camera.

[get]

Returns the height in device independent pixels of the viewport of this camera.

◆ Near

double Luciad.Cameras.Camera.Near
get

The distance from the eye to the near clipping plane.

[get]

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

◆ Up

Luciad.Cartesian.Coordinate Luciad.Cameras.Camera.Up
get

The (normalized) direction corresponding to the upward direction of the view.

[get]

Returns the (normalized) direction corresponding to the upward direction of the view. It is defined in the map reference.

◆ Width

double Luciad.Cameras.Camera.Width
get

The width in device independent pixels of the viewport of this camera.

[get]

Returns the width in device independent pixels of the viewport of this camera.