Class CartesianCoordinate

  • All Implemented Interfaces:
    android.os.Parcelable

    public class CartesianCoordinate
    extends Object
    implements android.os.Parcelable
    A structure that contains cartesian coordinate. Instances are immutable.

    See CoordinateConverter to convert between Coordinate and CartesianCoordinate's building coordinate.

    • Constructor Detail

      • CartesianCoordinate

        public CartesianCoordinate​(double x,
                                   double y)
    • Method Detail

      • getX

        public double getX()
        Returns value of coordinate at x-axis
        Returns:
        double. Default is 0
      • getY

        public double getY()
        Returns value of coordinate at y-axis
        Returns:
        double. Default is 0
      • distanceTo

        public double distanceTo​(CartesianCoordinate cartesianCoordinate)
                          throws IllegalArgumentException
        Calculates the distance (in meters) between this cartesian coordinate and another
        Parameters:
        cartesianCoordinate - the other cartesian coordinate. Can't be null
        Returns:
        distance in meters. Never a negative value
        Throws:
        IllegalArgumentException - if cartesianCoordinate is null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • describeContents

        public int describeContents()
        Specified by:
        describeContents in interface android.os.Parcelable
      • writeToParcel

        public void writeToParcel​(android.os.Parcel dest,
                                  int flags)
        Specified by:
        writeToParcel in interface android.os.Parcelable