public class PointND extends java.lang.Object implements java.io.Serializable, Transformable
Constructor and Description |
---|
PointND(double... point)
Creates a new point of a given array or list of double values.
|
PointND(PointND point)
Copy constructor
|
PointND(SimpleVector knotVector)
Creates a new point of the specified dimension
|
Modifier and Type | Method and Description |
---|---|
void |
applyTransform(Transform t)
Applies the Transform t to the object.
|
PointND |
clone() |
boolean |
equals(java.lang.Object o) |
double |
euclideanDistance(PointND two)
computes the Euclidean distance between the current point
![]() ![]() |
double |
get(int i)
Method to retrieve coordinate entries
|
SimpleVector |
getAbstractVector()
Returns the internal abstract vector to enable computations via the numerics library.
Changes to the vector will affect the point |
double[] |
getCoordinates()
Returns a copy of the point as double array.
|
int |
getDimension()
Returns the dimension of the point
|
void |
set(int i,
double d)
Methods to set individual entries of the coordinates
|
void |
setCoordinates(SimpleVector coordinates) |
java.lang.String |
toString() |
void |
updateIfHigher(PointND p)
Updates the vector at entries which are higher in p.
|
void |
updateIfLower(PointND p)
Updates the vector at entries which are higher in p.
|
public PointND(SimpleVector knotVector)
knotVector
- the dimensionpublic PointND(PointND point)
point
- public PointND(double... point)
PointND p = new PointND(1.5, 2.5); ArbitrayrPoint p2 = new PointND(new double [] {1.5, 2.5});will create two 2D points at the same location.
point
- public void setCoordinates(SimpleVector coordinates)
coordinates
- the coordinates to setpublic PointND clone()
clone
in class java.lang.Object
public double[] getCoordinates()
public double get(int i)
i
- the index of the coordinate [0, dim[public void set(int i, double d)
i
- the index of the coordinate [0, dim[d
- the value of the coordinatepublic SimpleVector getAbstractVector()
public int getDimension()
public double euclideanDistance(PointND two)
two
- the other pointpublic java.lang.String toString()
toString
in class java.lang.Object
public void updateIfHigher(PointND p)
ArrayListlist = ... PointND max = new PointND(-Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); for (PointND p : list){ max.updateIfHigher(p); }
p
- the other pointpublic void updateIfLower(PointND p)
ArrayListlist = ... PointND min = new PointND(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE); for (PointND p : list){ min.updateIfLower(p); }
p
- the other pointpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void applyTransform(Transform t)
Transformable
applyTransform
in interface Transformable
t
- the transform to apply to the object.