Package org.robwork.sdurw_math
Class Vector3Df
- java.lang.Object
-
- org.robwork.sdurw_math.Vector3Df
-
public class Vector3Df extends java.lang.Object
A 3D vector \mathbf{v}\in \mathbb{R}^3
\robabx{i}{j}{\mathbf{v}} = \left[ \begin{array}{c} v_x \\ v_y \\ v_z \end{array} \right]
Usage example:
const Vector3D<> v1(1.0, 2.0, 3.0); const Vector3D<> v2(6.0, 7.0, 8.0); const Vector3D<> v3 = cross(v1, v2); const double d = dot(v1, v2); const Vector3D<> v4 = v2 - v1;
-
-
Constructor Summary
Constructors Constructor Description Vector3Df()
Creates a 3D vector initialized with 0'sVector3Df(float x, float y, float z)
Creates a 3D vectorVector3Df(long cPtr, boolean cMemoryOwn)
Vector3Df(vector_f vec)
construct vector from std::vectorVector3Df(Vector3Df copy_vec)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EAAf
add(EAAf rhs)
Vector3Df
add(Vector3Df b)
Vector addition.Vector3Df
addAssign(Vector3Df v)
Vector addition.Vector3Df
cross(Vector3Df vec)
Calculate cross productvoid
delete()
Vector3Df
devideAssign(float s)
Scalar division.Vector3Df
divide(float s)
Scalar division.float
dot(Vector3Df vec)
calculate the dot productEigenVector3f
e()
Returns Reference to Eigen VectorVector3Df
elemAdd(float rhs)
Scalar addition.Vector3Df
elemDivide(Vector3Df rhs)
element wise division.Vector3Df
elemMultiply(Vector3Df rhs)
Elementweise multiplication.Vector3Df
elemSubtract(float rhs)
Scalar subtraction.boolean
equals(EAAf rhs)
boolean
equals(Vector3Df b)
Compare with b for equality.float
get(long i)
static long
getCPtr(Vector3Df obj)
Vector3Df
multiply(float rhs)
Scalar multiplication.VelocityScrew6Df
multiply(VelocityScrew6Df rhs)
Wrench6Df
multiply(Wrench6Df rhs)
Vector3Df
multiplyAssign(float s)
Scalar multiplication.Vector3Df
negate()
Unary minus.
negative versionfloat
norm1()
Returns the Manhatten norm (1-norm) of the vectorfloat
norm2()
Returns the Euclidean norm (2-norm) of the vectorVector3Df
normalize()
normalize vector to get length 1float
normInf()
Returns the infinte norm ( \inf-norm) of the vectorboolean
notEqual(EAAf rhs)
boolean
notEqual(Vector3Df b)
Compare with b for inequality.void
set(long i, float d)
long
size()
The dimension of the vector (i.e.EAAf
subtract(EAAf rhs)
Vector3Df
subtract(Vector3Df b)
Vector subtraction.Vector3Df
subtractAssign(Vector3Df v)
Vector subtraction.java.lang.String
toString()
static Vector3Df
x()
Get x vector (1,0,0)static Vector3Df
y()
Get y vector (0,1,0)static Vector3Df
z()
Get z vector (0,0,1)static Vector3Df
zero()
Get zero vector.
-
-
-
Constructor Detail
-
Vector3Df
public Vector3Df(long cPtr, boolean cMemoryOwn)
-
Vector3Df
public Vector3Df()
Creates a 3D vector initialized with 0's
-
Vector3Df
public Vector3Df(float x, float y, float z)
Creates a 3D vector- Parameters:
x
- [in] xy
- [in] yz
- [in] z
-
Vector3Df
public Vector3Df(Vector3Df copy_vec)
Copy constructor- Parameters:
copy_vec
- [in] vector to copy
-
Vector3Df
public Vector3Df(vector_f vec)
construct vector from std::vector- Parameters:
vec
- [in] the vector to construct from
-
-
Method Detail
-
getCPtr
public static long getCPtr(Vector3Df obj)
-
delete
public void delete()
-
size
public long size()
The dimension of the vector (i.e. 3).
This method is provided to help support generic algorithms using
size() and operator[].- Returns:
- the size
-
zero
public static Vector3Df zero()
Get zero vector.- Returns:
- vector.
-
x
public static Vector3Df x()
Get x vector (1,0,0)- Returns:
- vector.
-
y
public static Vector3Df y()
Get y vector (0,1,0)- Returns:
- vector.
-
z
public static Vector3Df z()
Get z vector (0,0,1)- Returns:
- vector.
-
elemDivide
public Vector3Df elemDivide(Vector3Df rhs)
element wise division.- Parameters:
rhs
- [in] the vector being devided with- Returns:
- the resulting Vector3D
-
elemMultiply
public Vector3Df elemMultiply(Vector3Df rhs)
Elementweise multiplication.- Parameters:
rhs
- [in] vector- Returns:
- the element wise product
-
negate
public Vector3Df negate()
Unary minus.
negative version
-
divide
public Vector3Df divide(float s)
Scalar division.- Parameters:
s
- [in] the scalar to devide with- Returns:
- result of devision
-
multiply
public Vector3Df multiply(float rhs)
Scalar multiplication.- Parameters:
rhs
- [in] the scalar to multiply with- Returns:
- the product
-
elemSubtract
public Vector3Df elemSubtract(float rhs)
Scalar subtraction.
-
elemAdd
public Vector3Df elemAdd(float rhs)
Scalar addition.
-
norm2
public float norm2()
Returns the Euclidean norm (2-norm) of the vector- Returns:
- the norm
-
norm1
public float norm1()
Returns the Manhatten norm (1-norm) of the vector- Returns:
- the norm
-
normInf
public float normInf()
Returns the infinte norm ( \inf-norm) of the vector- Returns:
- the norm
-
cross
public Vector3Df cross(Vector3Df vec)
Calculate cross product- Parameters:
vec
- [in] the vector to cross with- Returns:
- the cross product
-
dot
public float dot(Vector3Df vec)
calculate the dot product- Parameters:
vec
- [in] the vecor to be dotted- Returns:
- the dot product
-
normalize
public Vector3Df normalize()
normalize vector to get length 1- Returns:
- the normalized Vector
-
e
public EigenVector3f e()
Returns Reference to Eigen Vector- Returns:
- reference to underling eigen
-
get
public float get(long i)
-
set
public void set(long i, float d)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
multiplyAssign
public Vector3Df multiplyAssign(float s)
Scalar multiplication.
-
devideAssign
public Vector3Df devideAssign(float s)
Scalar division.
-
equals
public boolean equals(Vector3Df b)
Compare with b for equality.- Parameters:
b
- [in] other vector.- Returns:
- True if a equals b, false otherwise.
-
notEqual
public boolean notEqual(Vector3Df b)
Compare with b for inequality.- Parameters:
b
- [in] other vector.- Returns:
- True if a and b are different, false otherwise.
-
equals
public boolean equals(EAAf rhs)
-
notEqual
public boolean notEqual(EAAf rhs)
-
multiply
public VelocityScrew6Df multiply(VelocityScrew6Df rhs)
-
-