|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.geometricModel.math.Vector
public final class Vector
Immutable representation of a 3-element vector consisting of x,
y and z elements. The class Vector represents a
difference vector, which describes the displacement between two points. To
quote Murray, R. et al — A mathematical Introduction to Robotic
Manipulation, Section 3.1 the following propositions are hold:
Concerning transformations the following properties are enforced on vectors
ITransformation.applyTo(Vector) results in a (displacement) vector
represented in the new coordinate system. From numerical point of view the
rotational part of the transformation is applied to the three components of
the vector, but the translational part of the transformation will not be
applied to the vector
The Robotics API always assumes the translation vector to be given in [mm].
To create a new Vector object use the static factory method
of(double, double, double).
| Field Summary | |
|---|---|
static Vector |
UNIT_X
Immutable Vector instance representing the X unit vector. |
static Vector |
UNIT_Y
Immutable Vector instance representing the Y unit vector. |
static Vector |
UNIT_Z
Immutable Vector instance representing the Z unit vector. |
static Vector |
ZERO
Immutable Vector instance representing a zero vector. |
| Method Summary | |
|---|---|
Vector |
add(Vector other)
Adds the given vector to the values of this vector. |
double |
angleRad(Vector other)
Calculates the smallest angle between this and the other vector. |
Vector |
crossProduct(Vector other)
Returns the vector that is the cross product between this vector and the other vector. |
double |
dotProduct(Vector other)
Returns the dot (inner/scalar) product between this vector and the other vector. |
boolean |
equals(Object obj)
Compares the specified object for equality with this vector. |
double |
get(int index)
Gets a value of the vector at the specified index, where 0 denotes the x, 1 the y and 2 the z element of the vector. |
double |
getX()
Returns the x element of the vector. |
double |
getY()
Returns the y element of the vector. |
double |
getZ()
Returns the z element of the vector. |
int |
hashCode()
Returns the hash code for this vector. |
Vector |
invert()
Returns an inverted vector, i.e. a vector with element wise negated values. |
double |
length()
Returns the length of the vector. |
Vector |
multiply(double factor)
Returns a vector that has the values of this vector scaled by the given factor. |
Vector |
normalize()
Returns a vector that points in the same direction as this vector, scaled to unit length (1). |
static Vector |
of(double x,
double y,
double z)
Returns an immutable Vector instance constructed from its
cartesian X, Y and Z elements. |
Vector |
subtract(Vector other)
Subtracts the given vector from the values of this vector. |
double[] |
toArray()
Converts the Vector into an array with 3 values. |
String |
toString()
Returns a textual description of the vector. |
Vector |
withX(double value)
Returns a new instance (copy) of the vector, with the x element
replaced by the new value. |
Vector |
withY(double value)
Returns a new instance (copy) of the vector, with the y element
replaced by the new value. |
Vector |
withZ(double value)
Returns a new instance (copy) of the vector, 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 Vector ZERO
Vector instance representing a zero vector.
public static final Vector UNIT_X
Vector instance representing the X unit vector.
public static final Vector UNIT_Y
Vector instance representing the Y unit vector.
public static final Vector UNIT_Z
Vector instance representing the Z unit vector.
| Method Detail |
|---|
public static Vector of(double x,
double y,
double z)
Vector instance constructed from its
cartesian X, Y and Z elements.
x - the cartesian X element of the vectory - the cartesian Y element of the vectorz - the cartesian Z element of the vector
Vector instancepublic double getX()
x element of the vector.
x element of the vector.getY(),
getZ(),
get(int)public double getY()
y element of the vector.
y element of the vector.getX(),
getZ(),
get(int)public double getZ()
z element of the vector.
z element of the vector.getX(),
getY(),
get(int)public double get(int index)
x, 1 the y and 2 the z element of the vector.
index - The index of the element, must be between 0 and 2.
IndexOutOfBoundsException - illegal indexgetX(),
getY(),
getZ()public Vector withX(double value)
x element
replaced by the new value.
value - The x element of the vector.
public Vector withY(double value)
y element
replaced by the new value.
value - The y element of the vector.
public Vector withZ(double value)
z element
replaced by the new value.
value - The z element of the vector.
public Vector invert()
public double length()
public Vector normalize()
public double dotProduct(Vector other)
other - another vector.
public Vector crossProduct(Vector other)
other - another vector.
public double angleRad(Vector other)
other - a vector
ArithmeticException - if this or the other vector has a approximate zero lengthpublic Vector multiply(double factor)
factor - The factor with which this vector should be multiplied.
ArithmeticException - factor is infinite or NaNpublic Vector add(Vector other)
other - The vector which will be added to the values of this vector.
public Vector subtract(Vector other)
other - The vector which will be subtracted from the values of this
vector.
public String toString()
"[1.23, 300.00, -20.20]"
toString in class Objectpublic double[] toArray()
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectobj - Object to be compared with this vector.
true if the object is equal to this vector.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||