com.kuka.roboticsAPI.geometricModel.math
Class Point

java.lang.Object
  extended by com.kuka.roboticsAPI.geometricModel.math.Point
All Implemented Interfaces:
Serializable

public final class Point
extends Object
implements Serializable

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:

  1. Sum and difference of vectors are vectors
  2. The sum of a vector and a point is a point
  3. The difference between two points is a vector
  4. The sum of two points is meaningless

The Robotics API always expects instances of this class to be given in [mm].

See Also:
Serialized Form

Field Summary
static Point ORIGIN
          Immutable Point instance representing the origin of a coordinate system.
 
Method Summary
 Point add(Vector 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 Point of(double x, double y, double z)
          Returns an immutable Point instance constructed from its cartesian X, Y and Z coordinates.
static Point of(Vector vector)
          Returns an immutable Point instance from a vector that points from the origin to the new point.
 Vector subtract(Point other)
          Subtracts the given point from this point, resulting in the connecting vector pointing from the other point to this point.
 String toString()
          Returns a textual description of the point.
 Vector toVector()
          Returns this point as a vector, which is the vector pointing from the origin to this point.
 Point withX(double value)
          Returns a new instance (copy) of the point, with the x element replaced by the new value.
 Point withY(double value)
          Returns a new instance (copy) of the point, with the y element replaced by the new value.
 Point 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

ORIGIN

public static final Point ORIGIN
Immutable Point instance representing the origin of a coordinate system.

Method Detail

of

public static Point of(double x,
                       double y,
                       double z)
Returns an immutable Point instance constructed from its cartesian X, Y and Z coordinates.

Parameters:
x - the cartesian X coordinate of the point
y - the cartesian Y coordinate of the point
z - the cartesian Z coordinate of the point
Returns:
an immutable Point instance

of

public static Point of(Vector vector)
Returns an immutable Point instance from a vector that points from the origin to the new point.

Parameters:
vector - the vector from origin to the point
Returns:
an immutable Point instance
Throws:
IllegalArgumentException - if vector is null

toVector

public Vector toVector()
Returns this point as a vector, which is the vector pointing from the origin to this point.

Returns:
a vector instance.

get

public 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.

Parameters:
index - The index of the coordinate, must be between 0 and 2.
Returns:
The coordinate at the specified index.
Throws:
IndexOutOfBoundsException - illegal index
See Also:
getX(), getY(), getZ()

getX

public double getX()
Returns the x coordinate of the point.

Returns:
The x coordinate of the point.
See Also:
getY(), getZ(), get(int)

getY

public double getY()
Returns the y coordinate of the point.

Returns:
The y coordinate of the point.
See Also:
getX(), getZ(), get(int)

getZ

public double getZ()
Returns the z coordinate of the point.

Returns:
The z coordinate of the point.
See Also:
getX(), getY(), get(int)

withX

public Point withX(double value)
Returns a new instance (copy) of the point, with the x element replaced by the new value.

Parameters:
value - The x element of the point.
Returns:
a new instance of the class

withY

public Point withY(double value)
Returns a new instance (copy) of the point, with the y element replaced by the new value.

Parameters:
value - The y element of the point.
Returns:
a new instance of the class

withZ

public Point withZ(double value)
Returns a new instance (copy) of the point, with the z element replaced by the new value.

Parameters:
value - The z element of the point.
Returns:
a new instance of the class

add

public Point add(Vector other)
Adds the given vector to this point, resulting in a new point.

Parameters:
other - The vector which will be added to this point.
Returns:
The resulting point.

subtract

public Vector subtract(Point other)
Subtracts the given point from this point, resulting in the connecting vector pointing from the other point to this point.

Parameters:
other - The point which will be subtracted from this point.
Returns:
The resulting connecting vector.

toString

public String toString()
Returns a textual description of the point. The representation is subject to change. The following string can be regarded as typical:

"[1.23, 300.00, -20.20]"

Overrides:
toString in class Object
Returns:
a brief description of the point

hashCode

public int hashCode()
Returns the hash code for this point. The hash code is computed by a combination of all the data elements defined by this interface.

Overrides:
hashCode in class Object
Returns:
hash code for this point.

equals

public boolean equals(Object obj)
Compares the specified object for equality with this point. Points are equal if all data elements returned by this interface are equal.

Overrides:
equals in class Object
Parameters:
obj - Object to be compared with this point.
Returns:
true if the object is equal to this point.


Copyright © 2019. All rights reserved.