|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.math.geometry.Point3D
public final class Point3D
Immutable representation of a 3-dimensional point. To quote Murray, R. et al — A mathematical Introduction to Robotic Manipulation, Section 3.1 the following propositions are hold:
The Robotics API always expects instances of this class to be given in [mm].
| Field Summary | |
|---|---|
static Point3D |
ORIGIN
Immutable Point3D instance representing the origin of a coordinate system. |
| Method Summary | |
|---|---|
Point3D |
add(Vector3D other)
Adds the given vector to this point, resulting in a new point. |
boolean |
equals(Object obj)
Compares the specified object for equality with this point. |
double |
get(int index)
Gets a coordinate of the point at the specified index, where 0 denotes the x, 1 the y and 2 the
z coordinate. |
double |
getX()
Returns the x coordinate of the point. |
double |
getY()
Returns the y coordinate of the point. |
double |
getZ()
Returns the z coordinate of the point. |
int |
hashCode()
Returns the hash code for this point. |
static Point3D |
of(double x,
double y,
double z)
Returns an immutable Point3D instance constructed from its cartesian X, Y and Z coordinates. |
static Point3D |
of(Vector3D vector)
Returns an immutable Point3D instance from a vector that points from the origin to the new point. |
Vector3D |
subtract(Point3D other)
Subtracts the given point from this point, resulting in the connecting vector pointing from the other point to this point. |
String |
toString()
Returns the point value formatted as a column vector in a way compatible with popular scientific numerical computing applications. |
String |
toString(NumberFormat fmt)
Returns the point value formatted as a column vector in a way similar to popular scientific numerical computing applications. |
Vector3D |
toVector()
Returns this point as a vector, which is the vector pointing from the origin to this point. |
Point3D |
withX(double value)
Returns a new instance (copy) of the point, with the x element replaced by the new value. |
Point3D |
withY(double value)
Returns a new instance (copy) of the point, with the y element replaced by the new value. |
Point3D |
withZ(double value)
Returns a new instance (copy) of the point, with the z element replaced by the new value. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Point3D ORIGIN
Point3D instance representing the origin of a coordinate system.
| Method Detail |
|---|
public static Point3D of(double x,
double y,
double z)
Point3D instance constructed from its cartesian X, Y and Z coordinates.
x - the cartesian X coordinate of the pointy - the cartesian Y coordinate of the pointz - the cartesian Z coordinate of the point
Point3D instancepublic static Point3D of(Vector3D vector)
Point3D instance from a vector that points from the origin to the new point.
vector - the vector from origin to the point
Point3D instance
IllegalArgumentException - if vector is nullpublic Vector3D toVector()
public double get(int index)
x, 1 the y and 2 the
z coordinate.
index - The index of the coordinate, must be between 0 and 2.
IndexOutOfBoundsException - illegal indexgetX(),
getY(),
getZ()public double getX()
x coordinate of the point.
x coordinate of the point.getY(),
getZ(),
get(int)public double getY()
y coordinate of the point.
y coordinate of the point.getX(),
getZ(),
get(int)public double getZ()
z coordinate of the point.
z coordinate of the point.getX(),
getY(),
get(int)public Point3D withX(double value)
x element replaced by the new value.
value - The x element of the point.
public Point3D withY(double value)
y element replaced by the new value.
value - The y element of the point.
public Point3D withZ(double value)
z element replaced by the new value.
value - The z element of the point.
public Point3D add(Vector3D other)
other - The vector which will be added to this point.
public Vector3D subtract(Point3D other)
other - The point which will be subtracted from this point.
public String toString()
Double.toString(double).
The following string can be regarded as typical:
[1.234; 300.0; -20.2]
toString in class Objectpublic String toString(NumberFormat fmt)
NumberFormat.format(double) method of the
given formatter.
Example: The following code snippet, used on a given Point3D point
NumberFormat fmt = NumberFormat.getNumberInstance(Locale.US); fmt.setMinimumFractionDigits(1); fmt.setMaximumFractionDigits(3); System.out.println(point.toString(fmt));might give the following output:
[-1.234; 1.414; 20.0]
fmt - the NumberFormat used to format the number values
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectobj - Object to be compared with this point.
true if the object is equal to this point.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||