Package org.robwork.sdurw_math
Class Vector3Dd
- java.lang.Object
-
- org.robwork.sdurw_math.Vector3Dd
-
public class Vector3Dd 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 Vector3Dd()
Creates a 3D vector initialized with 0'sVector3Dd(double x, double y, double z)
Creates a 3D vectorVector3Dd(long cPtr, boolean cMemoryOwn)
Vector3Dd(Vector_d vec)
construct vector from std::vectorVector3Dd(Vector3Dd copy_vec)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EAAd
add(EAAd rhs)
Vector3Dd
add(Vector3Dd b)
Vector addition.Vector3Dd
addAssign(Vector3Dd v)
Vector addition.Vector3Dd
cross(Vector3Dd vec)
Calculate cross productvoid
delete()
Vector3Dd
devideAssign(double s)
Scalar division.Vector3Dd
divide(double s)
Scalar division.double
dot(Vector3Dd vec)
calculate the dot productEigenVector3d
e()
Returns Reference to Eigen VectorVector3Dd
elemAdd(double rhs)
Scalar addition.Vector3Dd
elemDivide(Vector3Dd rhs)
element wise division.Vector3Dd
elemMultiply(Vector3Dd rhs)
Elementweise multiplication.Vector3Dd
elemSubtract(double rhs)
Scalar subtraction.boolean
equals(EAAd rhs)
boolean
equals(Vector3Dd b)
Compare with b for equality.double
get(long i)
static long
getCPtr(Vector3Dd obj)
Vector3Dd
multiply(double rhs)
Scalar multiplication.VelocityScrew6Dd
multiply(VelocityScrew6Dd rhs)
Wrench6Dd
multiply(Wrench6Dd rhs)
Vector3Dd
multiplyAssign(double s)
Scalar multiplication.Vector3Dd
negate()
Unary minus.
negative versiondouble
norm1()
Returns the Manhatten norm (1-norm) of the vectordouble
norm2()
Returns the Euclidean norm (2-norm) of the vectorVector3Dd
normalize()
normalize vector to get length 1double
normInf()
Returns the infinte norm ( \inf-norm) of the vectorboolean
notEqual(EAAd rhs)
boolean
notEqual(Vector3Dd b)
Compare with b for inequality.void
set(long i, double d)
long
size()
The dimension of the vector (i.e.EAAd
subtract(EAAd rhs)
Vector3Dd
subtract(Vector3Dd b)
Vector subtraction.Vector3Dd
subtractAssign(Vector3Dd v)
Vector subtraction.java.lang.String
toString()
static Vector3Dd
x()
Get x vector (1,0,0)static Vector3Dd
y()
Get y vector (0,1,0)static Vector3Dd
z()
Get z vector (0,0,1)static Vector3Dd
zero()
Get zero vector.
-
-
-
Constructor Detail
-
Vector3Dd
public Vector3Dd(long cPtr, boolean cMemoryOwn)
-
Vector3Dd
public Vector3Dd()
Creates a 3D vector initialized with 0's
-
Vector3Dd
public Vector3Dd(double x, double y, double z)
Creates a 3D vector- Parameters:
x
- [in] xy
- [in] yz
- [in] z
-
Vector3Dd
public Vector3Dd(Vector3Dd copy_vec)
Copy constructor
-
Vector3Dd
public Vector3Dd(Vector_d vec)
construct vector from std::vector- Parameters:
vec
- [in] the vector to construct from
-
-
Method Detail
-
getCPtr
public static long getCPtr(Vector3Dd 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 Vector3Dd zero()
Get zero vector.- Returns:
- vector.
-
x
public static Vector3Dd x()
Get x vector (1,0,0)- Returns:
- vector.
-
y
public static Vector3Dd y()
Get y vector (0,1,0)- Returns:
- vector.
-
z
public static Vector3Dd z()
Get z vector (0,0,1)- Returns:
- vector.
-
elemDivide
public Vector3Dd elemDivide(Vector3Dd rhs)
element wise division.- Parameters:
rhs
- [in] the vector being devided with- Returns:
- the resulting Vector3D
-
elemMultiply
public Vector3Dd elemMultiply(Vector3Dd rhs)
Elementweise multiplication.- Parameters:
rhs
- [in] vector- Returns:
- the element wise product
-
negate
public Vector3Dd negate()
Unary minus.
negative version
-
divide
public Vector3Dd divide(double s)
Scalar division.- Parameters:
s
- [in] the scalar to devide with- Returns:
- result of devision
-
multiply
public Vector3Dd multiply(double rhs)
Scalar multiplication.- Parameters:
rhs
- [in] the scalar to multiply with- Returns:
- the product
-
elemSubtract
public Vector3Dd elemSubtract(double rhs)
Scalar subtraction.
-
elemAdd
public Vector3Dd elemAdd(double rhs)
Scalar addition.
-
norm2
public double norm2()
Returns the Euclidean norm (2-norm) of the vector- Returns:
- the norm
-
norm1
public double norm1()
Returns the Manhatten norm (1-norm) of the vector- Returns:
- the norm
-
normInf
public double normInf()
Returns the infinte norm ( \inf-norm) of the vector- Returns:
- the norm
-
cross
public Vector3Dd cross(Vector3Dd vec)
Calculate cross product- Parameters:
vec
- [in] the vector to cross with- Returns:
- the cross product
-
dot
public double dot(Vector3Dd vec)
calculate the dot product- Parameters:
vec
- [in] the vecor to be dotted- Returns:
- the dot product
-
normalize
public Vector3Dd normalize()
normalize vector to get length 1- Returns:
- the normalized Vector
-
e
public EigenVector3d e()
Returns Reference to Eigen Vector- Returns:
- reference to underling eigen
-
get
public double get(long i)
-
set
public void set(long i, double d)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
multiplyAssign
public Vector3Dd multiplyAssign(double s)
Scalar multiplication.
-
devideAssign
public Vector3Dd devideAssign(double s)
Scalar division.
-
equals
public boolean equals(Vector3Dd b)
Compare with b for equality.- Parameters:
b
- [in] other vector.- Returns:
- True if a equals b, false otherwise.
-
notEqual
public boolean notEqual(Vector3Dd 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(EAAd rhs)
-
notEqual
public boolean notEqual(EAAd rhs)
-
multiply
public VelocityScrew6Dd multiply(VelocityScrew6Dd rhs)
-
-