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.
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 semimajor
and semiminor 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 upperleft corner of the view, with yvalues 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 nonlinear in case of georeferenced 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.
Figure 1, “Coordinate systems and the relation between them” shows one 2D world reference (TLcdGridReference
) and one 3D world reference
(TLcdGeocentricReference
). TLcdGeodetic2Grid
and TLcdGrid2Grid
are examples of dedicated modelworld transformations.
LuciadLightspeed reference systems
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 georeferenced data, that is data tied to an earthbased reference system. All earthbased
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:

ILcdGeodeticReference
: a reference system for longitudelatitudeheight values based on anILcdGeodeticDatum
.Figure 2.ILcdGeodeticReference

ILcdGeocentricReference
: a 3D Cartesian coordinate system attached to the center of the earth.Figure 3.ILcdGeocentricReference

ILcdTopocentricReference
: a 3D Cartesian coordinate system located at some lonlatheight point P0: the Yaxis intersects the polar axis, the XYplane is parallel to the tangential plane through P, with the Xaxis pointing to the east, and the Zaxis is perpendicular to the XYplane (thus it also intersects the polar axis).Figure 4.ILcdTopocentricReference

ILcdGridReference
: specifies a grid coordinateILcdGeoReference
, which is defined by anILcdGeodeticDatum
, anILcdProjection
, a scale, a rotation, a unit of measure and a false origin (given by a false Easting and a false Northing).
Table 1, “Specializations of ILcdGeoReference
” crossreferences 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 



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
shows the implementation of TLcdRD1918DutchGridReference
as an extension of TLcdGridReference
.
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, "WGS1984");
ILcdEllipsoid ellipsoid =
new TLcdDMA1987bEllipsoidFactory().createEllipsoid(
TLcdDMA1987bEllipsoidFactory.BESSEL_1841);
ILcdGeodeticDatum geodeticDatum =
new TLcdGeodeticDatum(565.040,
49.91,
465.84,
1.9848E06,
1.7439E06,
9.0587E06,
1.0  4.0772E06,
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:

ILcdModelXYWorldTransformation
: specifies the transformations between model coordinates and 2D world coordinates. Implementations are given byTLcdGeocentric2Grid
,TLcdGeodetic2Grid
,TLcdGrid2Grid
, andTLcdTopocentric2Grid
. These transformations are all dedicated to a particular combination of a model reference and a world reference. The first part of the class name refers to the model reference, the second part to the world reference. 
ILcdModelXYZWorldTransformation
: specifies the transformations between model coordinates and 3D world coordinates. The interface is implemented byTLcdGeodetic2Geocentric
andTLcdGrid2Geocentric
. 
ILcdXYWorldXYWorldTransformation
: specifies the transformation between one world reference and another world reference. The interface is implemented byTLcdMapWorldMapWorldTransformation
. 
ILcdGXYViewXYWorldTransformation
: specifies the transformations between world coordinates and view coordinates in a GXY view. The interface is implemented byTLcdGXYViewXYWorldTransformation
. 
ILcdGXYViewModelTransformation
: combines anILcdModelXYWorldTransformation
and anILcdGXYViewXYWorldTransformation
into a single transformation for a GXY view.TLcdGXYViewModelTransformation
implements this interface. 
ILcdModelModelTransformation
: specifies the transformation between one model reference and another model reference. The interface is implemented byTLcdGeoReference2GeoReference
. 
ALspViewXYZWorldTransformation
: defines a transformation between world coordinates and view coordinates for a Lightspeed view. This class is extended to subclassesTLspViewXYZWorldTransformation2D
andTLspViewXYZWorldTransformation3D
.
There are two groups of transformation methods of these interfaces:

methods that transform points:
ILcdPoint
orjava.awt.Point
objects. 
methods that transform bounding boxes:
ILcdBounds
orjava.awt.Rectangle
objects.
For example, the interface ILcdModelXYWorldTransformation
has the methods:

modelPoint2worldSFCT

worldPoint2modelSFCT

modelBounds2worldSFCT

worldBounds2modelSFCT