public class Point3D extends Object implements Serializable, Comparable<Point3D>
Modifier and Type | Field and Description |
---|---|
static char |
VALUE_SEPERATOR
The character use to seperate the X and Y value when making a to string representation or decoding a string representation.
|
Constructor and Description |
---|
Point3D()
Default construtor, sets X, Y and Z to 0.
|
Point3D(double x,
double y,
double z)
Constructor with doubles.
|
Point3D(int x,
int y,
int z)
Constructor with integers (int).
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Point3D o)
Compares the length of a Point3D
|
double |
distance(Point3D otherPoint)
The distance between two points.
|
boolean |
equals(Object obj)
Determines if this Point3D is equals with either another Point3D.
|
boolean |
equals(Object obj,
double precision)
Determines if this Point3D is equals with either another Point3D.
|
double |
getLength()
Getting the distance from (0,0,0) to this point.
|
Point3D |
getUnitVector()
In mathematics, a unit vector in a normed vector space is a vector (often a spatial vector) whose length is 1 (the unit length).
|
Double |
getX()
Gets the X value as a Double
|
int |
getXAsInt()
Gets the X value as an int using
Double.intValue() method. |
Double |
getY()
Gets the Y value as a Double
|
int |
getYAsInt()
Gets the Y value as an int using
Double.intValue() method. |
Double |
getZ()
Gets the Z value as a Double
|
int |
getZAsInt()
Gets the Z value as an int using
Double.intValue() method. |
int |
hashCode() |
Point3D |
scale(double factor)
Scale the values in this Point with factor an returns the result as a new Point.
|
String |
toString() |
Point3D |
translate(double dx,
double dy,
double dz)
Translates this point, at location (x,y,z),
by dx along the x axis,dy along the y axis and dz along the z axis so that it now represents the point (x+dx,y+dy,z+dz) . |
public static final char VALUE_SEPERATOR
public Point3D()
public Point3D(int x, int y, int z)
x
- the x int.y
- the y int.z
- the z int.public Point3D(double x, double y, double z)
x
- the x double.y
- the y double.z
- the x double.public int getXAsInt()
Double.intValue()
method.Double.intValue()
public int getYAsInt()
Double.intValue()
method.Double.intValue()
public int getZAsInt()
Double.intValue()
method.Double.intValue()
public double getLength()
public double distance(Point3D otherPoint) throws NullPointerException
otherPoint
- the other Point3DNullPointerException
- if the otherPoint is null
.public Point3D scale(double factor)
factor
- the factor the scale the values with.public Point3D translate(double dx, double dy, double dz)
(x+dx,y+dy,z+dz)
.dx
- the distance to move this point along the X axisdy
- the distance to move this point along the Y axisdz
- the distance to move this point along the Z axisnew Point3D(x+dx,y+dy,z+dz)
.public Point3D getUnitVector()
public boolean equals(Object obj)
equals
in class Object
{@inheritDoc}
public boolean equals(Object obj, double precision)
equals(Object, double)
,
{@inheritDoc}
public int compareTo(Point3D o)
compareTo
in interface Comparable<Point3D>