org.eclipse.gef.geometry.projective

## Class Vector3D

- java.lang.Object
- - org.eclipse.gef.geometry.projective.Vector3D

    public final class Vector3D
    extends java.lang.Object

The Vector3D class implements a three dimensional vector (components x, y, z) with its standard operations: addition and multiplication (scalar, dot-product, cross-product). It is used to represent planar lines and planar points which are represented by three dimensional planes and three dimensional lines through the origin, respectively.

### Field Summary

Fields
`double` `x` the x-coordinate of this `Vector3D`.
`double` `y` the y-coordinate of this `Vector3D`.
`double` `z` the homogeneous coordinate of this `Vector3D`.

### Constructor Summary

Constructors
Constructor and Description
`Vector3D(double px, double py, double pz)` Constructs a new `Vector3D` object with the given component values.
`Vector3D(Point p)` Constructs a new `Vector3D` from the given `Point`, setting z to 1.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(java.lang.Object other)`
`Vector3D` `getAdded(Vector3D other)` Returns a new `Vector3D` object with its components set to the sum of the individual x, y and z components of this `Vector3D` and the given other `Vector3D`.
`Vector3D` `getCopy()` Returns a copy of this `Vector3D`.
`Vector3D` `getCrossProduct(Vector3D other)` Returns a new `Vector3D` object that is the cross product of this and the given other `Vector3D`.
`double` `getDotProduct(Vector3D other)` Returns the dot-product of this and the given other `Vector3D`.
`Vector3D` `getRatio(Vector3D other, double t)` Returns a new `Vector3D` object with its components set to the given ratio between this `Vector3D` and the given other `Vector3D`.
`Vector3D` `getScaled(double f)` Returns a new `Vector3D` object with its components set to the x, y and z components of this `Vector3D` scaled by the given factor.
`Vector3D` `getSubtracted(Vector3D other)` Returns a new `Vector3D` object with its components set to the difference of the individual x, y and z components of this `Vector3D` and the given other `Vector3D`.
`int` `hashCode()`
`Point` `toPoint()` Returns a new `Point` object that is represented by this `Vector3D`.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### x

    public double x

the x-coordinate of this `Vector3D`.

#### y

    public double y

the y-coordinate of this `Vector3D`.

#### z

    public double z

the homogeneous coordinate of this `Vector3D`.

### Constructor Detail

#### Vector3D

    public Vector3D(double px,
                    double py,
                    double pz)

Constructs a new `Vector3D` object with the given component values.

Parameters:
  `px` - The x-coordinate of the new `Vector3D`.
  `py` - The y-coordinate of the new `Vector3D`.
  `pz` - The z-coordinate of the new `Vector3D`.

#### Vector3D

    public Vector3D(Point p)

Constructs a new `Vector3D` from the given `Point`, setting z to 1.

Parameters:
  `p` - The `Point` which determines the new `Vector3D`'s x- and y-coordinate.

### Method Detail

#### equals

    public boolean equals(java.lang.Object other)

Overrides:
  `equals` in class `java.lang.Object`

#### getAdded

    public Vector3D getAdded(Vector3D other)

Returns a new `Vector3D` object with its components set to the sum of the individual x, y and z components of this `Vector3D` and the given other `Vector3D`.

Parameters:
  `other` - The `Vector3D` which is added to this `Vector3D`.
Returns:
  a new `Vector3D` object representing the sum of this `Vector3D` and the given other `Vector3D`

#### getCopy

    public Vector3D getCopy()

Returns a copy of this `Vector3D`.

Returns:
  a copy of this `Vector3D`

#### getCrossProduct

    public Vector3D getCrossProduct(Vector3D other)

Returns a new `Vector3D` object that is the cross product of this and the given other `Vector3D`.

Parameters:
  `other` - The `Vector3D` to which the cross product is computed.
Returns:
  a new `Vector3D` object that is the cross product of this and the given other `Vector3D`

#### getDotProduct

    public double getDotProduct(Vector3D other)

Returns the dot-product of this and the given other `Vector3D`.

Parameters:
  `other` - The `Vector3D` to which the dot product is computed.
Returns:
  the dot-product of this and the given other `Vector3D`

#### getRatio

    public Vector3D getRatio(Vector3D other,
                             double t)

Returns a new `Vector3D` object with its components set to the given ratio between this `Vector3D` and the given other `Vector3D`.

Parameters:
  `other` - The other `Vector3D`.
  `t` - The ratio.
Returns:
  a new `Vector3D` object with its components set to the given ratio between this `Vector3D` and the given other `Vector3D`

#### getScaled

    public Vector3D getScaled(double f)

Returns a new `Vector3D` object with its components set to the x, y and z components of this `Vector3D` scaled by the given factor.

Parameters:
  `f` - The scaling factor.
Returns:
  a new `Vector3D` object with its components set to the x, y and z components of this `Vector3D` scaled by the given factor

#### getSubtracted

    public Vector3D getSubtracted(Vector3D other)

Returns a new `Vector3D` object with its components set to the difference of the individual x, y and z components of this `Vector3D` and the given other `Vector3D`.

Parameters:
  `other` - The `Vector3D` which is subtracted from this `Vector3D`.
Returns:
  a new `Vector3D` object representing the difference of this `Vector3D` and the given other `Vector3D`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### toPoint

    public Point toPoint()

Returns a new `Point` object that is represented by this `Vector3D`.

Returns:
  a new `Point` object that is represented by this `Vector3D`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`