public class

Point2D

extends Object
java.lang.Object
   ↳ com.commsignia.v2x.utils.vectors.Point2D

Class Overview

Represents a point in 2D space

Summary

Constants
int EARTH_RADIUS
Public Constructors
Point2D(double x, double y)
Create a new point instance using the x and y parameter as coordinates
Public Methods
Point2D add(Vector2D vector2D)
Translate the point by the given vector
boolean equals(Object o)
double getX()
Get the X coordinate
double getY()
Get the Y coordinate
int hashCode()
double haversineDistance(Point2D other)
Calculate the haversine distance between this point and the specified point
Vector2D minus(Point2D other)
Substract this point from another.
String toString()
Return a friendly representation of this Point2D object.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int EARTH_RADIUS

Constant Value: 6371000 (0x006136b8)

Public Constructors

public Point2D (double x, double y)

Create a new point instance using the x and y parameter as coordinates

Parameters
x X coordinate
y Y coordinate

Public Methods

public Point2D add (Vector2D vector2D)

Translate the point by the given vector

Parameters
vector2D vector to use
Returns
  • new point instance translated by the specified vector

public boolean equals (Object o)

public double getX ()

Get the X coordinate

Returns
  • double value for the X coordinate

public double getY ()

Get the Y coordinate

Returns
  • double value for the Y coordinate

public int hashCode ()

public double haversineDistance (Point2D other)

Calculate the haversine distance between this point and the specified point

Parameters
other the other point
Returns
  • distance in meters

public Vector2D minus (Point2D other)

Substract this point from another. Essentially creates a vector from this point to the other point

Parameters
other other point
Returns
  • vector point from this point to the other

public String toString ()

Return a friendly representation of this Point2D object.

Returns
  • string representation