pythagoras.d

## Class Vector4

• All Implemented Interfaces:
Serializable, IVector4

```public class Vector4
extends Object
implements IVector4, Serializable```
A four element vector.
Serialized Form
• ### Field Summary

Fields
Modifier and Type Field and Description
`double` `w`
The components of the vector.
`double` `x`
The components of the vector.
`double` `y`
The components of the vector.
`double` `z`
The components of the vector.
• ### Constructor Summary

Constructors
Constructor and Description
`Vector4()`
Creates a zero vector.
`Vector4(double[] values)`
Creates a vector from four components.
`Vector4(DoubleBuffer buf)`
Creates a vector from a double buffer.
```Vector4(double x, double y, double z, double w)```
Creates a vector from four components.
`Vector4(IVector4 other)`
Copy constructor.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Vector4` `abs()`
Absolute-values this vector.
`Vector4` `abs(Vector4 result)`
Absolute-values this vector, storing the result in the supplied object.
`Vector4` `absLocal()`
Absolute-values this vector in-place.
`boolean` ```epsilonEquals(IVector4 other, double epsilon)```
Compares this vector to another with the provided epsilon.
`boolean` `equals(Object other)`
`DoubleBuffer` `get(DoubleBuffer buf)`
Populates the supplied buffer with the contents of this vector.
`int` `hashCode()`
`Vector4` `mult(double v)`
Multiplies this vector by a scalar.
`Vector4` ```mult(double v, Vector4 result)```
Multiplies this vector by a scalar and places the result in the supplied object.
`Vector4` `mult(IMatrix4 matrix)`
Multiplies this vector by a matrix (V * M).
`Vector4` ```mult(IMatrix4 matrix, Vector4 result)```
Multiplies this vector by a matrix (V * M) and stores the result in the object provided.
`Vector4` `multLocal(double v)`
Multiplies this vector by a scalar and stores the result back in this vector.
`Vector4` `multLocal(IMatrix4 matrix)`
Multiplies this vector by a matrix (V * M) and stores the result back in this vector.
`Vector4` `negate()`
Negates this vector.
`Vector4` `negate(Vector4 result)`
Negates this vector, storing the result in the supplied object.
`Vector4` `negateLocal()`
Negates this vector in-place.
`Vector4` `set(double[] values)`
Sets all of the elements of the vector.
`Vector4` `set(DoubleBuffer buf)`
Sets all of the elements of the vector.
`Vector4` ```set(double x, double y, double z, double w)```
Sets all of the elements of the vector.
`Vector4` `set(IVector4 other)`
Copies the elements of another vector.
`String` `toString()`
`double` `w()`
Returns the w-component of this vector.
`double` `x()`
Returns the x-component of this vector.
`double` `y()`
Returns the y-component of this vector.
`double` `z()`
Returns the z-component of this vector.
• ### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### x

`public double x`
The components of the vector.
• #### y

`public double y`
The components of the vector.
• #### z

`public double z`
The components of the vector.
• #### w

`public double w`
The components of the vector.
• ### Constructor Detail

• #### Vector4

```public Vector4(double x,
double y,
double z,
double w)```
Creates a vector from four components.
• #### Vector4

`public Vector4(double[] values)`
Creates a vector from four components.
• #### Vector4

`public Vector4(DoubleBuffer buf)`
Creates a vector from a double buffer.
• #### Vector4

`public Vector4(IVector4 other)`
Copy constructor.
• #### Vector4

`public Vector4()`
Creates a zero vector.
• ### Method Detail

• #### set

`public Vector4 set(IVector4 other)`
Copies the elements of another vector.
Returns:
a reference to this vector, for chaining.
• #### set

`public Vector4 set(double[] values)`
Sets all of the elements of the vector.
Returns:
a reference to this vector, for chaining.
• #### set

`public Vector4 set(DoubleBuffer buf)`
Sets all of the elements of the vector.
Returns:
a reference to this vector, for chaining.
• #### set

```public Vector4 set(double x,
double y,
double z,
double w)```
Sets all of the elements of the vector.
Returns:
a reference to this vector, for chaining.
• #### negateLocal

`public Vector4 negateLocal()`
Negates this vector in-place.
Returns:
a reference to this vector, for chaining.
• #### absLocal

`public Vector4 absLocal()`
Absolute-values this vector in-place.
Returns:
a reference to this vector, for chaining.
• #### multLocal

`public Vector4 multLocal(double v)`
Multiplies this vector by a scalar and stores the result back in this vector.
Returns:
a reference to this vector, for chaining.
• #### multLocal

`public Vector4 multLocal(IMatrix4 matrix)`
Multiplies this vector by a matrix (V * M) and stores the result back in this vector.
Returns:
a reference to this vector, for chaining.
• #### x

`public double x()`
Description copied from interface: `IVector4`
Returns the x-component of this vector.
Specified by:
`x` in interface `IVector4`
• #### y

`public double y()`
Description copied from interface: `IVector4`
Returns the y-component of this vector.
Specified by:
`y` in interface `IVector4`
• #### z

`public double z()`
Description copied from interface: `IVector4`
Returns the z-component of this vector.
Specified by:
`z` in interface `IVector4`
• #### w

`public double w()`
Description copied from interface: `IVector4`
Returns the w-component of this vector.
Specified by:
`w` in interface `IVector4`
• #### get

`public DoubleBuffer get(DoubleBuffer buf)`
Description copied from interface: `IVector4`
Populates the supplied buffer with the contents of this vector.
Specified by:
`get` in interface `IVector4`
Returns:
a reference to the buffer, for chaining.
• #### epsilonEquals

```public boolean epsilonEquals(IVector4 other,
double epsilon)```
Description copied from interface: `IVector4`
Compares this vector to another with the provided epsilon.
Specified by:
`epsilonEquals` in interface `IVector4`
• #### negate

`public Vector4 negate()`
Description copied from interface: `IVector4`
Negates this vector.
Specified by:
`negate` in interface `IVector4`
Returns:
a new vector containing the result.
• #### negate

`public Vector4 negate(Vector4 result)`
Description copied from interface: `IVector4`
Negates this vector, storing the result in the supplied object.
Specified by:
`negate` in interface `IVector4`
Returns:
a reference to the result, for chaining.
• #### abs

`public Vector4 abs()`
Description copied from interface: `IVector4`
Absolute-values this vector.
Specified by:
`abs` in interface `IVector4`
Returns:
a new vector containing the result.
• #### abs

`public Vector4 abs(Vector4 result)`
Description copied from interface: `IVector4`
Absolute-values this vector, storing the result in the supplied object.
Specified by:
`abs` in interface `IVector4`
Returns:
a reference to the result, for chaining.
• #### mult

`public Vector4 mult(double v)`
Description copied from interface: `IVector4`
Multiplies this vector by a scalar.
Specified by:
`mult` in interface `IVector4`
Returns:
a new vector containing the result.
• #### mult

```public Vector4 mult(double v,
Vector4 result)```
Description copied from interface: `IVector4`
Multiplies this vector by a scalar and places the result in the supplied object.
Specified by:
`mult` in interface `IVector4`
Returns:
a reference to the result, for chaining.
• #### mult

`public Vector4 mult(IMatrix4 matrix)`
Description copied from interface: `IVector4`
Multiplies this vector by a matrix (V * M).
Specified by:
`mult` in interface `IVector4`
Returns:
a new vector containing the result.
• #### mult

```public Vector4 mult(IMatrix4 matrix,
Vector4 result)```
Description copied from interface: `IVector4`
Multiplies this vector by a matrix (V * M) and stores the result in the object provided.
Specified by:
`mult` in interface `IVector4`
Returns:
a reference to the result vector, for chaining.
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`
• #### hashCode

`public int hashCode()`
Overrides:
`hashCode` in class `Object`
• #### equals

`public boolean equals(Object other)`
Overrides:
`equals` in class `Object`