public class Point
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected double[] |
coords
The double-array that holds the value of this point
|
protected int |
dim
The dimension of this point.
|
Constructor and Description |
---|
Point(double[] coords) |
Point(int dimensions) |
Point(Point p) |
Modifier and Type | Method and Description |
---|---|
Point |
add(Vector v)
Add the specified vector and return the result without modifying this point.
|
Point |
addThis(Vector v)
Add the specified vector to this point.
|
Point |
clone() |
static boolean |
collinear(Point p1,
Point p2,
Point p3) |
double |
distance()
Returns distance to the origo
|
double |
distance(Point p)
Returns distance to the point p
|
double |
distanceSquared()
Returns squared distance to the origo
|
double |
distanceSquared(Point p)
Returns squared distance to the point p
|
double |
distanceSquaredXY()
Returns the squared distance to the origo of this point projected onto xy plane
|
double |
distanceXY()
Returns the distance to the origo of this point projected onto xy plane
|
double |
dot(Point p) |
void |
fill(double v)
Set all coordinates to the value v
|
double |
get(int d)
Get the d'th coordinate.
|
static double |
getAngle(Point p1,
Point p2,
Point p3) |
double |
getCoord(int d)
Get the d'th coordinate.
|
double[] |
getCoords()
Get all coordinates in an array.
|
int |
getDimensions()
Return the dimensionality of this point.
|
static Point |
getMidpoint(Point p,
Point q)
Creates the midpoint of two points.
|
static Point |
getRandomPoint(int d,
double minCoord,
double maxCoord) |
Point |
multiplyThis(double s)
Scale this point by the specified value
|
double |
polarAngleCosXY()
Returns the cosinus of the polar angle of this point projected onto xy plane
|
double |
polarAngleSinXY()
Returns the sinus of the polar angle of this point projected onto xy plane
|
double |
polarAngleXY()
Returns polar angle of this point projected onto xy plane
|
void |
set(int d,
double v)
Set the d'th coordinate.
|
Point |
set(Point p)
Set the coordinates to be identical to those in the specified point.
|
void |
setCoord(int d,
double v)
Set the d'th coordinate.
|
Point |
setCoord(Point p)
Set the coordinates to be identical to those in the specified point.
|
void |
toConsole() |
void |
toConsole(int dec) |
java.lang.String |
toString() |
java.lang.String |
toString(int dec) |
Vector |
toVector() |
Vector |
vectorTo(Point p1) |
protected final double[] coords
protected final int dim
public Point(Point p)
public Point(double[] coords)
public Point(int dimensions)
public double get(int d)
public double getCoord(int d)
public double[] getCoords()
public int getDimensions()
public void set(int d, double v)
public void setCoord(int d, double v)
public void fill(double v)
public Point set(Point p)
p
and this
are not the same, then the largest possible number of
coordinates are copiedpublic Point setCoord(Point p)
p
and this
are not the same, then the largest possible number of
coordinates are copied.public Point add(Vector v)
public Point multiplyThis(double s)
public double distanceSquared(Point p)
public double distanceSquared()
public double distance(Point p)
public double dot(Point p)
public double distance()
public double distanceSquaredXY()
public double distanceXY()
public double polarAngleSinXY()
public double polarAngleCosXY()
public double polarAngleXY()
public static Point getRandomPoint(int d, double minCoord, double maxCoord)
public Vector toVector()
public Point clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int dec)
public void toConsole()
public void toConsole(int dec)