Package org.robwork.sdurw_math
Class Vector2Dd
- java.lang.Object
-
- org.robwork.sdurw_math.Vector2Dd
-
public class Vector2Dd extends java.lang.ObjectA 2D vector \mathbf{v}\in \mathbb{R}^2
\robabx{i}{j}{\mathbf{v}} = \left[ \begin{array}{c} v_x \\ v_y \end{array} \right]
In addition, Vector2D supports the cross product operator:
v3 = cross(v1, v2)
Usage example:
using namespace rw::math; Vector2D v1(1.0, 2.0); Vector2D v2(6.0, 7.0); Vector2D v3 = cross( v1, v2 ); Vector2D v4 = v2 - v1;
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector2Ddadd(Vector2Dd b)Vector addition.Vector2DdaddAssign(Vector2Dd v)Vector addition.doubleangle()returns the counter clock-wise angle between
this vector and the x-axis vector (1,0).voiddelete()Vector2DddevideAssign(double s)Scalar division.Vector2Dddivide(double s)Scalar division.EigenVector2de()Returns Eigen vector equivalent to *this.booleanequals(Vector2Dd b)Compares a and b for equality.doubleget(long i)static longgetCPtr(Vector2Dd obj)Vector2Ddmultiply(double s)Scalar multiplication.Vector2DdmultiplyAssign(double s)Scalar multiplication.Vector2Ddnegate()Unary minus.doublenorm1()Returns the Manhatten norm (1-norm) of the vectordoublenorm2()Returns the Euclidean norm (2-norm) of the vectordoublenormInf()Returns the infinte norm ( \inf-norm) of the vectorbooleannotEqual(Vector2Dd b)Compares a and b for inequality.voidset(long i, double d)longsize()The dimension of the vector (i.e.Vector2Ddsubtract(Vector2Dd b)Vector subtraction.Vector2DdsubtractAssign(Vector2Dd v)Vector subtraction.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Vector2Dd
public Vector2Dd(long cPtr, boolean cMemoryOwn)
-
Vector2Dd
public Vector2Dd()
Creates a 2D vector initialized with 0's
-
Vector2Dd
public Vector2Dd(double x, double y)Creates a 2D vector
- Parameters:
x- [in] x
y- [in] y
-
Vector2Dd
public Vector2Dd(Vector2Dd copy)
Copy Constructor
-
-
Method Detail
-
getCPtr
public static long getCPtr(Vector2Dd obj)
-
delete
public void delete()
-
e
public EigenVector2d e()
Returns Eigen vector equivalent to *this.
-
size
public long size()
The dimension of the vector (i.e. 2).
This method is provided to help support generic algorithms using
size() and operator[].
-
get
public double get(long i)
-
set
public void set(long i, double d)
-
divide
public Vector2Dd divide(double s)
Scalar division.
-
multiply
public Vector2Dd multiply(double s)
Scalar multiplication.
-
multiplyAssign
public Vector2Dd multiplyAssign(double s)
Scalar multiplication.
-
devideAssign
public Vector2Dd devideAssign(double s)
Scalar division.
-
negate
public Vector2Dd negate()
Unary minus.
-
equals
public boolean equals(Vector2Dd b)
Compares a and b for equality.- Parameters:
b- [in]- Returns:
- True if a equals b, false otherwise.
-
notEqual
public boolean notEqual(Vector2Dd b)
Compares a and b for inequality.- Parameters:
b- [in]- Returns:
- True if a and b are different, false otherwise.
-
angle
public double angle()
returns the counter clock-wise angle between
this vector and the x-axis vector (1,0). The angle
returned will be in the interval [-Pi,Pi]
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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
-
-