## Class Vector2Df

• java.lang.Object
• org.robwork.sdurw_math.Vector2Df

• public class Vector2Df
extends java.lang.Object
A 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; 
• ### Constructor Summary

Constructors
Constructor Description
Vector2Df()
Creates a 2D vector initialized with 0's
Vector2Df​(float x, float y)
Creates a 2D vector

Vector2Df​(long cPtr, boolean cMemoryOwn)
Vector2Df​(Vector2Df copy)
Copy Constructor
• ### Method Summary

All Methods
Modifier and Type Method Description
Vector2Df add​(Vector2Df b)
Vector2Df addAssign​(Vector2Df v)
double angle()
returns the counter clock-wise angle between
this vector and the x-axis vector (1,0).
void delete()
Vector2Df devideAssign​(float s)
Scalar division.
Vector2Df divide​(float s)
Scalar division.
EigenVector2f e()
Returns Eigen vector equivalent to *this.
boolean equals​(Vector2Df b)
Compares a and b for equality.
float get​(long i)
static long getCPtr​(Vector2Df obj)
Vector2Df multiply​(float s)
Scalar multiplication.
Vector2Df multiplyAssign​(float s)
Scalar multiplication.
Vector2Df negate()
Unary minus.
float norm1()
Returns the Manhatten norm (1-norm) of the vector
float norm2()
Returns the Euclidean norm (2-norm) of the vector
float normInf()
Returns the infinte norm ( \inf-norm) of the vector
boolean notEqual​(Vector2Df b)
Compares a and b for inequality.
void set​(long i, float d)
long size()
The dimension of the vector (i.e.
Vector2Df subtract​(Vector2Df b)
Vector subtraction.
Vector2Df subtractAssign​(Vector2Df v)
Vector subtraction.
java.lang.String toString()
• ### Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ### Constructor Detail

• #### Vector2Df

public Vector2Df​(long cPtr,
boolean cMemoryOwn)
• #### Vector2Df

public Vector2Df()
Creates a 2D vector initialized with 0's
• #### Vector2Df

public Vector2Df​(float x,
float y)
Creates a 2D vector

Parameters:
x - [in] x

y - [in] y
• #### Vector2Df

public Vector2Df​(Vector2Df copy)
Copy Constructor
• ### Method Detail

• #### getCPtr

public static long getCPtr​(Vector2Df obj)
• #### delete

public void delete()
• #### e

public EigenVector2f 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 float get​(long i)
• #### set

public void set​(long i,
float d)
• #### divide

public Vector2Df divide​(float s)
Scalar division.
• #### multiply

public Vector2Df multiply​(float s)
Scalar multiplication.
• #### subtract

public Vector2Df subtract​(Vector2Df b)
Vector subtraction.

public Vector2Df add​(Vector2Df b)
• #### multiplyAssign

public Vector2Df multiplyAssign​(float s)
Scalar multiplication.
• #### devideAssign

public Vector2Df devideAssign​(float s)
Scalar division.

public Vector2Df addAssign​(Vector2Df v)
• #### subtractAssign

public Vector2Df subtractAssign​(Vector2Df v)
Vector subtraction.
• #### negate

public Vector2Df negate()
Unary minus.
• #### equals

public boolean equals​(Vector2Df b)
Compares a and b for equality.
Parameters:
b - [in]
Returns:
True if a equals b, false otherwise.
• #### notEqual

public boolean notEqual​(Vector2Df 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:
toString in class java.lang.Object
• #### 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