org.openscience.cdk.math

## Class Vector

• ```public class Vector
extends Object```
This class handles vectors.
Belongs to CDK module:
qm
• ### Field Summary

Fields
Modifier and Type Field and Description
`static Vector` `EX`
Unary vector in 3 dimensional space
`static Vector` `EY`
Unary vector in 3 dimensional space
`static Vector` `EZ`
Unary vector in 3 dimensional space
`static Vector` `NULLVECTOR`
Null vector in 3 dimensional space
`int` `size`
The size of this vector
`double[]` `vector`
The content of this vector
• ### Constructor Summary

Constructors
Constructor and Description
`Vector(double[] array)`
Constructs a vector with the content of a array
`Vector(int size)`
Constructs a Vector with "size" elements
`Vector(javax.vecmath.Tuple3d t)`
Constructs a Vector with a Tuple3d, Vector3d or Point3d
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Vector` `add(Vector b)`
`Vector` `cross(Vector b)`
Cross product, only well definited in R^3
`double` `dot(Vector b)`
Multiplikation from two vectors
`Vector` `duplicate()`
Copy a vector
`int` `getSize()`
Returns the size of this vector
`double` `length()`
Return the length from this vector
`Vector` `mul(double b)`
Multiplikation from a vectors with an double
`Vector` `negate()`
Negates this vector
`Vector` `normalize()`
Normalize this vector
`Vector` `sub(Vector b)`
Subtraktion from two vectors
`String` `toString()`
Return a vector as a string
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### NULLVECTOR

`public static final Vector NULLVECTOR`
Null vector in 3 dimensional space
• #### EX

`public static final Vector EX`
Unary vector in 3 dimensional space
• #### EY

`public static final Vector EY`
Unary vector in 3 dimensional space
• #### EZ

`public static final Vector EZ`
Unary vector in 3 dimensional space
• #### vector

`public double[] vector`
The content of this vector
• #### size

`public int size`
The size of this vector
• ### Constructor Detail

• #### Vector

`public Vector(int size)`
Constructs a Vector with "size" elements
• #### Vector

`public Vector(double[] array)`
Constructs a vector with the content of a array
• #### Vector

`public Vector(javax.vecmath.Tuple3d t)`
Constructs a Vector with a Tuple3d, Vector3d or Point3d
• ### Method Detail

• #### getSize

`public int getSize()`
Returns the size of this vector

`public Vector add(Vector b)`
• #### sub

`public Vector sub(Vector b)`
Subtraktion from two vectors
• #### mul

`public Vector mul(double b)`
Multiplikation from a vectors with an double
• #### dot

`public double dot(Vector b)`
Multiplikation from two vectors
• #### cross

`public Vector cross(Vector b)`
Cross product, only well definited in R^3
• #### length

`public double length()`
Return the length from this vector
• #### normalize

`public Vector normalize()`
Normalize this vector
• #### negate

`public Vector negate()`
Negates this vector
• #### duplicate

`public Vector duplicate()`
Copy a vector
• #### toString

`public String toString()`
Return a vector as a string
Overrides:
`toString` in class `Object`