Package dev.nm.geometry
Class Point
- java.lang.Object
-
- dev.nm.geometry.Point
-
public class Point extends Object
Represent a n-dimensional point.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
dimension()
Get the dimension of the coordinate space.double
distance(Point pt)
Compute the Euclidean distance between this point and the given point.ImmutableVector
getCoordinates()
Get the coordinates of the point.
-
-
-
Constructor Detail
-
Point
public Point(double... coordinates)
Create a point with given coordinates.- Parameters:
coordinates
- the coordinates of the point
-
Point
public Point(Vector coordinates)
Create a point with given coordinates.- Parameters:
coordinates
- the coordinates of the point
-
-
Method Detail
-
getCoordinates
public ImmutableVector getCoordinates()
Get the coordinates of the point.- Returns:
- the coordinates
-
dimension
public int dimension()
Get the dimension of the coordinate space.- Returns:
- the dimension of the coordinate space
-
distance
public double distance(Point pt)
Compute the Euclidean distance between this point and the given point.- Parameters:
pt
- another point- Returns:
- the distance
-
-