This article describes the three different coordinate systems that are used within LuciadLightspeed, and the transformations that exist between them. Model, world, and view coordinate systems explains the three different coordinate systems and their interrelation. LuciadLightspeed reference systems gives an overview of the different reference systems that are implemented within LuciadLightspeed to define a coordinate system, and Defining your own reference system explains how you can define your own reference system. Finally, the transformations between the different coordinate systems are treated in Transformations between coordinate systems.

## Model, world, and view coordinate systems

As described in Model, world, and view coordinates, LuciadLightspeed uses three different coordinate systems to define the location of domain objects on the level of model, world, and view. Figure 1, “Coordinate systems and the relation between them” shows these systems and the relations between them.

Figure 1. Coordinate systems and the relation between them

Model coordinates are defined within a coordinate system determined by the model reference of the type `ILcdModelReference`. All the domain objects of an `ILcdModel` share this same coordinate system. In the case of geographical data, the `ILcdModelReference` is often an implementation of `ILcdGeoReference`. If so, the unit of measure for the linear coordinates of a model geometry is determined by the `ILcdGeodeticDatum` of the `ILcdGeoReference`.

In particular, the linear unit of measure is given by the unit of measure that is used to express the values of the semi-major and semi-minor axis of the `ILcdEllipsoid` property of the `ILcdGeodeticDatum` (see Geodesy). Angular units, giving longitude and latitude values, are normally expressed in decimal degrees. The left side of Figure 1, “Coordinate systems and the relation between them” shows several types of `ILcdModel` (drawn as a rectangle), each having its own model reference (labeled in italics). In one `ILcdModel` the domain objects are expressed in a geodetic coordinate system, in another `ILcdModel` they are expressed in a grid system, and so on.

World coordinates are defined within a coordinate system determined by the world reference associated with an `ILcdGXYView` or a `ILspView`. This coordinate system is by definition Cartesian. It can either be a 2D coordinate system, if the world reference is of type `ILcdXYWorldReference`, or a 3D coordinate system, if it is of type `ILcdXYZWorldReference`. The most commonly used `ILcdXYWorldReference` for mapping is the `TLcdGridReference`. It is defined by the combination of an `ILcdGeodeticDatum` and an `ILcdProjection` that transforms positions on the `ILcdEllipsoid` of the `ILcdGeodeticDatum` to planar Cartesian coordinates, a scale, a rotation, and a false origin. The `ILcdGeodeticDatum` determines the unit of measure for the Cartesian world coordinates. For more information on projections, see Projections.

View coordinates are the 2D screen coordinates (or pixel coordinates). The origin is the upper-left corner of the view, with y-values increasing downwards, and the coordinate values are integer pixel values.

Both the world and the view coordinate system are associated with an `ILcdGXYView`. The world level is an intermediate level between the model and the view, which is used internally in the `ILcdGXYView`, mainly for performance reasons.

When a domain object is displayed in a view, model coordinates have to be transformed into view coordinates. Conversely, when objects are being edited in a view, the view coordinates have to be transformed into the correct model coordinates. LuciadLightspeed performs such transformations always in two steps:

• Transformation between the model and the world coordinates. These transformations are typically non-linear in case of geo-referenced model data. This means that they are expensive with respect to computing time. Dedicated transformations are used for each particular combination of a model reference and a world reference.

• Transformation between the world and the view coordinates. This transformation is linear, and therefore inexpensive with respect to computing time. It corresponds to an affine transformation in the most general case. Only translation, rotation, and scaling are needed.

LuciadLightspeed provides a number of model and world reference systems. They are defined in the package `reference`. Implementations in that package implement one or more of the model and/or world references.

LuciadLightspeed is intended to work with geo-referenced data, that is data tied to an earth-based reference system. All earth-based reference systems within LuciadLightspeed extend the interface `ILcdGeoReference`. As a common property they have an `ILcdGeodeticDatum` (see What is a geodetic datum?).

Specific reference interfaces extending `ILcdGeoReference` are:

Table 1, “Specializations of `ILcdGeoReference`” cross-references the specific reference interfaces in the LuciadLightspeed API with the interface they extend. An interface in the left column extends an interface in the top row if and only if the corresponding cell is marked.

 extends `ILcdGeodeticReference` `ILcdGeocentricReference` `ILcdTopocentricReference` `ILcdGeoReference` `ILcdModelReference` `ILcdXYWorldReference` ```ILcdXYZWorld Reference``` Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes

Each of the specific reference interfaces has a default implementation (which has the same name as the interface, except that it starts with `TLcd` instead of `ILcd`).

In addition to the default implementations, LuciadLightspeed offers implementations useful for particular data. These are implementations in which the parameters of the `TLcdGridReference` are set:

## Defining your own reference system

Program: Implementing a specific `ILcdGeoReference`
``````double scale = 0.9999079;
double falseEasting = 155000.0;
double falseNorthing = 463000.0;

double originLat = 52.0 + 9.0 / 60.0 + 22.178 / 3600.0;
double originLon = 5.0 + 23.0 / 60.0 + 15.5 / 3600.0;
TLcdDutchStereographic projection =
new TLcdDutchStereographic(originLon, originLat);
double uom = 1.0;
double rotation = 0.0;

// Geodetic datum not defined in the factory
ILcdEllipsoid wgs84Ellipsoid =
new TLcdDMA1987bEllipsoidFactory().createEllipsoid(
TLcdDMA1987bEllipsoidFactory.WGS_1984);

ILcdGeodeticDatum refDatum =
new TLcdGeodeticDatum(wgs84Ellipsoid, "WGS-1984");

ILcdEllipsoid ellipsoid =
new TLcdDMA1987bEllipsoidFactory().createEllipsoid(
TLcdDMA1987bEllipsoidFactory.BESSEL_1841);

ILcdGeodeticDatum geodeticDatum =
new TLcdGeodeticDatum(565.040,
49.91,
465.84,
1.9848E-06,
-1.7439E-06,
9.0587E-06,
1.0 - 4.0772E-06,
ellipsoid,
refDatum,
"BESSEL_AMERSFOORT");
TLcdGridReference customReference =
new TLcdGridReference(geodeticDatum, projection, falseEasting, falseNorthing, scale, uom, rotation);``````

LuciadLightspeed also provides a factory, `TLcdModelReferenceFactory`, to create instances of implementations of the interface `ILcdGeoReference`. This class lets you create an instance of `ILcdGeoReference` based on properties.

## Transformations between coordinate systems

Domain objects are represented in different coordinate systems. As explained in Model, world, and view coordinates, transformations between model, world, and view coordinates are required to display data coherently and to edit data correctly.

LuciadLightspeed defines a number of interfaces and abstract classes for transformations between coordinate systems. You can find them in `transformation`, `view.gxy` and `view.lightspeed.camera`. All interfaces provide both forward and backward transformations:

There are two groups of transformation methods of these interfaces:

For example, the interface `ILcdModelXYWorldTransformation` has the methods:

• `modelPoint2worldSFCT`

• `worldPoint2modelSFCT`

• `modelBounds2worldSFCT`

• `worldBounds2modelSFCT`

Additionally LuciadLightspeed provides the following interfaces and support classes to perform transformations: