Class CartesianToPolar

All Implemented Interfaces:
Serializable, Parameterized, LenientComparable, org.opengis.referencing.operation.MathTransform

final class CartesianToPolar extends CoordinateSystemTransform implements Serializable
Conversions from two-dimensional Cartesian coordinates to polar coordinates. This conversion assumes that there is no datum change.

See PolarToCartesian for explanation on axes convention. Axis order shall match the order defined by Normalizer in org.apache.sis.referencing.cs package.

Note: We do not provide explicit CartesianToCylindrical implementation. Instead, the cylindrical case is implemented by the polar case with a PassThroughTransform for the height. This allows Apache SIS to use the optimization implemented by PassThroughTransform when for example a concatenated transform is dropping the z axis.
Since:
0.7
Version:
0.7
  • Field Details

  • Constructor Details

    • CartesianToPolar

      private CartesianToPolar()
      Creates the singleton instance. Output coordinates are in radians.
  • Method Details

    • readResolve

      private Object readResolve() throws ObjectStreamException
      Returns the singleton instance on deserialization.
      Throws:
      ObjectStreamException
    • inverse

      public org.opengis.referencing.operation.MathTransform inverse()
      Returns the inverse of this transform.
      Specified by:
      inverse in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      inverse in class AbstractMathTransform
    • transform

      public org.opengis.referencing.operation.Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate)
      Converts a single coordinate and optionally computes the derivative.
      Specified by:
      transform in class AbstractMathTransform
      Parameters:
      srcPts - the array containing the source coordinates (cannot be null).
      srcOff - the offset to the point to be transformed in the source array.
      dstPts - the array into which the transformed coordinates is returned. May be the same than srcPts. May be null if only the derivative matrix is desired.
      dstOff - the offset to the location of the transformed point that is stored in the destination array.
      derivate - true for computing the derivative, or false if not needed.
      Returns:
      the matrix of the transform derivative at the given source position, or null if the derivate argument is false.
      See Also:
    • transform

      public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Converts an array of coordinates. This method performs the same conversion than transform(double[], int, double[], int, boolean), but the formulas are repeated here for performance reasons.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class AbstractMathTransform
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned. May be the same than srcPts.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.