Class TLcdRectifiedRationalProjection

java.lang.Object
com.luciad.projection.ALcdProjection
com.luciad.projection.TLcdRectifiedRationalProjection
All Implemented Interfaces:
ILcdProjection, ILcdRectifiedProjection, ILcdPropertyChangeSource, Serializable, Cloneable

public class TLcdRectifiedRationalProjection extends ALcdProjection
Rectified Rational projection.

Introduction

This ILcdRectifiedProjection uses a 2D rational function for mapping tie points between reference systems.

The rational function is of the form:
x'=Nx(x,y) / Dx(x,y),
y'=Ny(x,y) / Dy(x,y),

where Nx, Ny, Dx and Dy are polynomials of the form
N: ∑ ai=0..n; j=0..n xi yj.
D: ∑ bi=0..m; j=0..m xi yj, where b0,0=1.

Given the degrees of the two rationals and the sets of source/target tie points, the coefficients of the rationals are computed using the least-squares method.

The minimum number of pairs of tie point required for computing the coefficients is given by the formula:
(num + 1) * (num + 2) / 2 + (den + 1) * (den + 2) /2 - 1,
where num and den are the degrees of the numerator and denominator polynomials, respectively.

If fewer point pairs are available, the projection will gracefully fall-back to lower degrees, starting with the denominator (as long as the denominator degree is larger or equal than the numerator degree, it will be decreased first). There should be at least 3 pairs of tie points.

Example

Sample Code


 ILcdProjection projection =
     new TLcdRectifiedRationalProjection(2, 1);
 

Known limitations

  • The rational function becomes very unstable when the degree of the two rationals increases to more than 2 or 3.
  • Some 2D points may or may not be mappable, eg. if the value of the denominator becomes very close to 0.
Since:
8.1
See Also:
  • Field Details

    • fSourcePoints

      protected ILcdPoint[] fSourcePoints
      The array of tie points in the source (unrectified) reference.
    • fTargetPoints

      protected ILcdPoint[] fTargetPoints
      The array of tie points in the target (rectified) reference.
    • fBaseProjection

      protected ILcdProjection fBaseProjection
      An optional projection to be chained before a lonlat2world or after a world2lonlat transformation.
    • fWorldBounds

      protected ILcdBounds fWorldBounds
      The valid bounds of this projection in world coordinates.
    • fOrigin

      protected ILcdPoint fOrigin
      The point to be used as projection origin. If a base projection is defined, the origin of the base projection is used instead.
  • Constructor Details

    • TLcdRectifiedRationalProjection

      public TLcdRectifiedRationalProjection()
      Creates a new TLcdRectifiedRationalProjection that represents an identity mapping.
    • TLcdRectifiedRationalProjection

      public TLcdRectifiedRationalProjection(int aNumeratorDegree, int aDenominatorDegree)
      Creates a new TLcdRectifiedRationalProjection with the given maximum degrees for the numerator and denominator polynomials.
      Parameters:
      aNumeratorDegree - the maximum degree of the numerator polynomials.
      aDenominatorDegree - the maximum degree of the denominator polynomials.
    • TLcdRectifiedRationalProjection

      public TLcdRectifiedRationalProjection(int aNumeratorDegree, int aDenominatorDegree, ILcdPoint[] aSourcePoints, ILcdPoint[] aTargetPoints)
      Creates a new TLcdRectifiedRationalProjection based on the given source and target tie points, and maximum degrees of the rationals. Additionally, specifies a projection to be chained before a lonlat2world or after a world2lonlat transformation. Optionally, the bounds of the world model can also be specified. If null, the inBounds methods will return true or fall-back to the basic projection.
      Parameters:
      aNumeratorDegree - the maximum degree of the numerator polynomials.
      aDenominatorDegree - the maximum degree of the denominator polynomials.
      aSourcePoints - the unrectified tie points.
      aTargetPoints - the rectified tie points.
    • TLcdRectifiedRationalProjection

      public TLcdRectifiedRationalProjection(int aNumeratorDegree, int aDenominatorDegree, ILcdPoint[] aSourcePoints, ILcdPoint[] aTargetPoints, ILcdProjection aBaseProjection, ILcdBounds aWorldBounds)
      Creates a new TLcdRectifiedRationalProjection based on the given source and target tie points, and maximum degrees of the rationals. Additionally, specifies a projection to be chained before a lonlat2world or after a world2lonlat transformation. Optionally, the bounds of the world model can also be specified. If null, the inBounds methods will return true or fall-back to the basic projection.
      Parameters:
      aNumeratorDegree - the maximum degree of the numerator polynomials.
      aDenominatorDegree - the maximum degree of the denominator polynomials.
      aSourcePoints - the unrectified tie points.
      aTargetPoints - the rectified tie points.
      aBaseProjection - the optional projection to be chained.
      aWorldBounds - the optional bounds of the projection.
  • Method Details

    • getNumeratorDegree

      public int getNumeratorDegree()
      Returns the maximum degree of the numerator polynomials.
    • setNumeratorDegree

      public void setNumeratorDegree(int aNumeratorDegree)
      Sets the maximum degree of the numerator polynomials.
    • getDenominatorDegree

      public int getDenominatorDegree()
      Returns the maximum degree of the denominator polynomials.
    • setDenominatorDegree

      public void setDenominatorDegree(int aDenominatorDegree)
      Sets the maximum degree of the denominator polynomials.
    • isValid

      public boolean isValid()
      Returns whether the current projection settings are valid.
    • loadProperties

      public void loadProperties(String aPrefix, Properties aProperties)
      Description copied from interface: ILcdProjection
      The properties of an ILcdProjection determine the projection parameters that determine the plane, cylinder or cone on which the projection is done. The properties of an ILcdProjection are of course dependent on the projection. A common property for all ILcdprojection objects is the origin of the projection. Other, more specific, properties are standard parallels, azimuthal direction, perspective distance, ... .
      Specified by:
      loadProperties in interface ILcdProjection
      Parameters:
      aPrefix - prefix for property names.
      aProperties - Properties object containing the serialized projection.
    • writePropertiesSFCT

      public void writePropertiesSFCT(String aPrefix, Properties aPropertiesSFCT)
      Description copied from interface: ILcdProjection
      The properties of an ILcdProjection determine the projection parameters that determine the plane, cylinder or cone on which the projection is done. The properties of an ILcdProjection are of course dependent on the projection. A common property for all ILcdprojection objects is the origin of the projection. Other, more specific, properties are standard parallels, azimuthal direction, perspective distance, ... .
      Specified by:
      writePropertiesSFCT in interface ILcdProjection
      Parameters:
      aPrefix - prefix for property names.
      aPropertiesSFCT - Properties object in which to store the serialized projection properties as side effect.
    • clearMapCache

      protected void clearMapCache()
      Clears the information that might be cache for mapping between source points and target points.
    • mapPointForward

      protected void mapPointForward(ILcdPoint aSourcePoint, ILcd2DEditablePoint aTargetPointSFCT) throws TLcdOutOfBoundsException
      Applies the rational transformation to the source point, to obtain the target point.
      Throws:
      TLcdOutOfBoundsException
    • mapPointBackward

      protected void mapPointBackward(ILcdPoint aTargetPoint, ILcd2DEditablePoint aSourcePointSFCT) throws TLcdOutOfBoundsException
      Applies the inverse of the rational transformation to the target point, to obtain the source point.
      Throws:
      TLcdOutOfBoundsException
    • equals

      public boolean equals(Object aObject)
      Description copied from interface: ILcdProjection
      Checks if this ILcdProjection equals some other Object.
      Specified by:
      equals in interface ILcdProjection
      Parameters:
      aObject - Object to compare with.
      Returns:
      true if the Object is an instance of the same ILcdProjection class and having the same projection properties, false otherwise.
    • hashCode

      public int hashCode()
    • clone

      public Object clone()
      Description copied from interface: ILcdProjection
      Makes a deep clone of this ILcdProjection.
      Specified by:
      clone in interface ILcdProjection
      Returns:
      deep clone of this ILcdProjection.
    • setSourcePoints

      public void setSourcePoints(ILcdPoint[] aSourcePoints)
      Sets the tie points in the unrectified source coordinate system.
      Parameters:
      aSourcePoints - the unrectified tie points.
    • setTargetPoints

      public void setTargetPoints(ILcdPoint[] aTargetPoints)
      Sets the tie points in the rectified target coordinate system.
      Parameters:
      aTargetPoints - the rectified tie points.
    • setBaseProjection

      public void setBaseProjection(ILcdProjection aBaseProjection)
      Sets the projection to be chained before a lonlat2world or after a world2lonlat transformation.
      Parameters:
      aBaseProjection - the projection to be chained.
    • getWorldBounds

      public ILcdBounds getWorldBounds()
      Returns the bounds in world (reference) coordinates.
      Returns:
      the world bounds.
    • setWorldBounds

      public void setWorldBounds(ILcdBounds aWorldBounds)
      Sets the bounds in world (reference) coordinates.
      Parameters:
      aWorldBounds - the world bounds.
    • getTiePointCount

      public int getTiePointCount()
      Description copied from interface: ILcdRectifiedProjection
      Returns the number of tie point pairs.
      Specified by:
      getTiePointCount in interface ILcdRectifiedProjection
      Returns:
      the number of tie point pairs.
    • getSourcePoint

      public ILcdPoint getSourcePoint(int aIndex)
      Description copied from interface: ILcdRectifiedProjection
      Returns the specified tie point in the unrectified source coordinate system.
      Specified by:
      getSourcePoint in interface ILcdRectifiedProjection
      Parameters:
      aIndex - the index of the tie point.
      Returns:
      the unrectified tie points.
    • getTargetPoint

      public ILcdPoint getTargetPoint(int aIndex)
      Description copied from interface: ILcdRectifiedProjection
      Returns the specified tie point in the rectified target coordinate system.
      Specified by:
      getTargetPoint in interface ILcdRectifiedProjection
      Parameters:
      aIndex - the index of the tie point.
      Returns:
      the rectified tie points.
    • getBaseProjection

      public ILcdProjection getBaseProjection()
      Description copied from interface: ILcdRectifiedProjection
      Returns the optional internal projection. This projection is chained before a lonlat2world or after a world2lonlat transformation.
      Specified by:
      getBaseProjection in interface ILcdRectifiedProjection
      Returns:
      the projection to be chained.
    • isAllInBounds

      public boolean isAllInBounds()
      Description copied from interface: ILcdProjection
      If all geodetic coordinates (l ,j ) are projected (visible) by an ILcdProjection and all (x,y ) coordinates are bounded this is true. All ILcdProjection objects have bounded (x,y ) coordinates because the projection is cut off if necessary.
      Specified by:
      isAllInBounds in interface ILcdProjection
      Returns:
      true if all LonLatPoints are within the bounds of the projection, false otherwise.
    • isContinuous

      public boolean isContinuous()
      Description copied from interface: ILcdProjection
      An ILcdProjection is continuous if there are no interruptions in the world coordinates. Most projections are continuous.
      Specified by:
      isContinuous in interface ILcdProjection
      Returns:
      true if the projection is continuous, false otherwise.
    • getOrigin

      public ILcdPoint getOrigin()
      Description copied from interface: ILcdProjection
      Origin of the projection is the ILcd2DEditablePoint that corresponds with origin (0, 0) of the cartesian coordinate system of the projection.
      Specified by:
      getOrigin in interface ILcdProjection
      Returns:
      the origin of the projection.
    • lonlatheight2worldOnSphereSFCT

      public void lonlatheight2worldOnSphereSFCT(ILcdPoint aLLHP, double aRadius, ILcd2DEditablePoint aXYPointSFCT) throws TLcdOutOfBoundsException
      Description copied from interface: ILcdProjection
      Transforms an ILcd2DEditablePoint on a sphere into the cartesian coordinate system of the projection.
      Specified by:
      lonlatheight2worldOnSphereSFCT in interface ILcdProjection
      Parameters:
      aLLHP - point to be projected.
      aRadius - radius of the sphere (meters).
      aXYPointSFCT - projected point as side effect.
      Throws:
      TLcdOutOfBoundsException - If the ILcdPoint aLLHP is not within the valid area of the projection (visible area), then this exception is thrown.
    • lonlatheight2worldOnEllipsoidSFCT

      public void lonlatheight2worldOnEllipsoidSFCT(ILcdPoint aLLHP, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aXYPointSFCT) throws TLcdOutOfBoundsException
      Description copied from class: ALcdProjection
      Default implementation calls lonlatheight2worldOnEllipsoidSFCT with aEllipsoid.getAuxRadius() as sphere radius.
      Specified by:
      lonlatheight2worldOnEllipsoidSFCT in interface ILcdProjection
      Overrides:
      lonlatheight2worldOnEllipsoidSFCT in class ALcdProjection
      Parameters:
      aLLHP - point to be projected.
      aEllipsoid - ellipsoid on which the point is defined.
      aXYPointSFCT - projected point as side effect.
      Throws:
      TLcdOutOfBoundsException - If the ILcdPoint aLLHP is not within the valid area of the projection (visible area), then this exception is thrown.
    • world2lonlatOnSphereSFCT

      public void world2lonlatOnSphereSFCT(ILcdPoint aXYPoint, double aRadius, ILcd2DEditablePoint aLLPointSFCT) throws TLcdOutOfBoundsException
      Description copied from interface: ILcdProjection
      Transforms an ILcdPoint from the cartesian coordinate system of the projection into an ILcd2DEditablePoint onto a sphere.
      Specified by:
      world2lonlatOnSphereSFCT in interface ILcdProjection
      Parameters:
      aXYPoint - projected point for which the corresponding geodetic point is sought.
      aRadius - radius of the sphere (meters).
      aLLPointSFCT - resulting geodetic coordinate as side effect.
      Throws:
      TLcdOutOfBoundsException - If the ILcdPoint aXYPoint is not within the valid area of the projection (visible area), then this exception is thrown.
    • world2lonlatOnEllipsoidSFCT

      public void world2lonlatOnEllipsoidSFCT(ILcdPoint aXYPoint, ILcdEllipsoid aEllipsoid, ILcd2DEditablePoint aLLPointSFCT) throws TLcdOutOfBoundsException
      Description copied from class: ALcdProjection
      Default implementation calls world2lonlatOnSphereSFCT with aEllipsoid.getAuxRadius() as sphere radius.
      Specified by:
      world2lonlatOnEllipsoidSFCT in interface ILcdProjection
      Overrides:
      world2lonlatOnEllipsoidSFCT in class ALcdProjection
      Parameters:
      aXYPoint - projected point for which the corresponding geodetic point is sought.
      aEllipsoid - ellipsoid on which the geodetic coordinate is defined.
      aLLPointSFCT - resulting geodetic coordinate as side effect.
      Throws:
      TLcdOutOfBoundsException - If the ILcdPoint aXYPoint is not within the valid area of the projection (visible area), then this exception is thrown.
    • inLonLatBounds

      public boolean inLonLatBounds(ILcdPoint aLLHP)
      Description copied from interface: ILcdProjection
      Checks if an ILcdPoint is inside the valid area of geodetic coordinates of the projection. The valid area is determined by the LonLatPoints that are visible and for which the corresponding cartesian coordinate is within the boundaries.
      Specified by:
      inLonLatBounds in interface ILcdProjection
      Parameters:
      aLLHP - ILcdPoint to be checked upon.
      Returns:
      true if valid, false if invalid.
    • inWorldBoundsOnSphere

      public boolean inWorldBoundsOnSphere(ILcdPoint aXYPoint, double aRadius)
      Description copied from interface: ILcdProjection
      Checks if a ILcdPoint is inside the valid cartesian area of the projection. The valid cartesian area is determined naturally by the projection bounds or by an artificial introduced boundary limit because some cartesian points are at infinity. The shape of the valid cartesian area is in many cases rectangular or circular although it might be more complex.
      Specified by:
      inWorldBoundsOnSphere in interface ILcdProjection
      Parameters:
      aXYPoint - point to be checked upon.
      aRadius - radius of the sphere.
      Returns:
      true if valid, false if invalid.
    • inWorldBoundsOnEllipsoid

      public boolean inWorldBoundsOnEllipsoid(ILcdPoint aXYPoint, ILcdEllipsoid aEllipsoid)
      Description copied from class: ALcdProjection
      Default implementation calls inWorldBoundsOnSphere with aEllipsoid.getAuxRadius() as sphere radius.
      Specified by:
      inWorldBoundsOnEllipsoid in interface ILcdProjection
      Overrides:
      inWorldBoundsOnEllipsoid in class ALcdProjection
      Parameters:
      aXYPoint - point to be checked upon.
      aEllipsoid - ellipsoid on which the geodetic coordinate is defined.
      Returns:
      true if valid, false if invalid.
      See Also:
    • world2DEditableBoundsOnSphereSFCT

      public void world2DEditableBoundsOnSphereSFCT(double aRadius, ILcd2DEditableBounds aWorldBounds)
      Description copied from interface: ILcdProjection
      Sets the ILcd2DEditableBounds object to the bounds of the projection in world coordinates.
      Specified by:
      world2DEditableBoundsOnSphereSFCT in interface ILcdProjection
      Parameters:
      aRadius - radius of the sphere.
      aWorldBounds - the bounds of the projection in world coordinates as side effect.
    • world2DEditableBoundsOnEllipsoidSFCT

      public void world2DEditableBoundsOnEllipsoidSFCT(ILcdEllipsoid aEllipsoid, ILcd2DEditableBounds aWorldBounds)
      Description copied from class: ALcdProjection
      Default implementation calls world2lonlatOnSphereSFCT with aEllipsoid.getAuxRadius() as sphere radius.
      Specified by:
      world2DEditableBoundsOnEllipsoidSFCT in interface ILcdProjection
      Overrides:
      world2DEditableBoundsOnEllipsoidSFCT in class ALcdProjection
      Parameters:
      aEllipsoid - ellipsoid considered.
      aWorldBounds - the bounds of the projection in world coordinates as side effect.
    • boundaryLons

      public double[][] boundaryLons(double aLatitude)
      Description copied from class: ALcdProjection
      Default implementation. To be redefined for specific projections.
      Specified by:
      boundaryLons in interface ILcdProjection
      Overrides:
      boundaryLons in class ALcdProjection
      Parameters:
      aLatitude - latitude in decimal degrees and -90.0 <= aLat<= 90.0.
      Returns:
      the array of pairs of longitudes[0] and longitudes[1], where the closed interval longitudes[0] -> longitudes[1] is in visible area and -180.0 <= lon[i] <= 180.0.
    • boundaryLats

      public double[][] boundaryLats(double aLongitude)
      Description copied from class: ALcdProjection
      Default implementation. To be redefined for specific projections.
      Specified by:
      boundaryLats in interface ILcdProjection
      Overrides:
      boundaryLats in class ALcdProjection
      Parameters:
      aLongitude - longitude in decimal degrees -180.0 <= lon <= 180.0 .
      Returns:
      the array of pairs of latitudes lats[0] and lats[1], where the closed interval lats[0] -> lats[1] is in visible area and -90.0 <= lats[i] <= 90.0 .