Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.cult3d.math
Class Vector3

    java.lang.Object
      |
      +--com.cult3d.math.Vector3

public class Vector3
extends java.lang.Object

A 3 element Vector with x, y and z coordinates.

Since:
  Cult3D 4.2

Constructor Summary
`Vector3()` Constructs and initializes a new vector.
`Vector3(float[] array)` Constructs a new vector and initializes it from the array parameter.
`Vector3(float x, float y, float z)` Constructs a new vector and initializes it to the specified values.
`Vector3(Vector3 v)` Constructs a new vector and initializes it from the vector parameter.

Method Summary
`void` | `add(Vector3 v)` Sets this vector to the sum of itself and the vector parameter.
`void` | `add(Vector3 v1, Vector3 v2)` Sets this vector to the sum of the two vector parameters.
`float` | `angle(Vector3 v)` Returns the angle in radians between this vector and the parameter.
`void` | `cross(Vector3 v)` Sets this vector to the cross product of itself and the parameter.
`void` | `cross(Vector3 v1, Vector3 v2)` Sets this vector to the cross product of vectors v1 and v2.
`void` | `div(float f)` Divides this vector with the parameter.
`void` | `div(Vector3 v, float f)` Sets this vector to the v parameter divided with the f parameter
`float` | `dot(Vector3 v)` Computes the dot product of itself and the parameter.
`float` | `dot(Vector3 v1, Vector3 v2)` Computes the dot product of vectors v1 and v2.
`boolean` | `equals(java.lang.Object obj)` Returns true if the Object obj is of type Vector3 and all of the coordinates of obj are equal to the corresponding coordinates in this Vector3.
`java.lang.String` | `getInfo()` This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.
`float` | `getX()` Gets this vectors x coordinate.
`float` | `getY()` Gets this vectors y coordinate.
`float` | `getZ()` Gets this vectors z coordinate.
`float` | `length()` Returns the length of this vector.
`void` | `mult(float f)` Multiplies this vector with the parameter.
`void` | `mult(Vector3 v, float f)` Sets this vector to the v parameter multiplied with the f parameter
`void` | `normalize()` Sets this vector to its normal.
`void` | `normalize(Vector3 v)` Sets this vector to the parameters normal.
`void` | `setVector(float[] array)` Sets this vector to the values in the array parameter.
`void` | `setVector(float x, float y, float z)` Sets this vector to the parameter values.
`void` | `setVector(Vector3 v)` Sets this vector to the same values as the parameter.
`void` | `setX(float x)` Sets this vector's x coordinate.
`void` | `setY(float y)` Sets this vectors y coordinate.
`void` | `setZ(float z)` Sets this vectors z coordinate.
`void` | `sub(Vector3 v)` Sets this vector to the difference of itself and the vector parameter.
`void` | `sub(Vector3 v1, Vector3 v2)` Sets this vector to the difference of the two vector parameters.
`java.lang.String` | `toString()` Returns a string representation of the values of this object.

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Vector3

    public Vector3()

  Constructs and initializes a new vector.
  Since:
    Cult3D 4.2

### Vector3

    public Vector3(float x,
                   float y,
                   float z)

  Constructs a new vector and initializes it to the specified values.
  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate
    `z` - the z coordinate
  Since:
    Cult3D 4.2

### Vector3

    public Vector3(float[] array)

  Constructs a new vector and initializes it from the array parameter.
  Parameters:
    `array` - array of length 3
  Since:
    Cult3D 4.2

### Vector3

    public Vector3(Vector3 v)

  Constructs a new vector and initializes it from the vector parameter.
  Parameters:
    `v` - the source vector
  Since:
    Cult3D 4.2

Method Detail

### setVector

    public void setVector(float x,
                          float y,
                          float z)

  Sets this vector to the parameter values.
  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate
    `z` - the z coordinate
  Since:
    Cult3D 4.2

### setVector

    public void setVector(float[] array)

  Sets this vector to the values in the array parameter.
  Parameters:
    `array` - array of length 3
  Since:
    Cult3D 4.2

### setVector

    public void setVector(Vector3 v)

  Sets this vector to the same values as the parameter.
  Parameters:
    `v` - the source vector
  Since:
    Cult3D 4.2

### setX

    public void setX(float x)

  Sets this vector's x coordinate.
  Parameters:
    `x` - the x coordinate
  Since:
    Cult3D 4.2

### setY

    public void setY(float y)

  Sets this vectors y coordinate.
  Parameters:
    `y` - the y coordinate
  Since:
    Cult3D 4.2

### setZ

    public void setZ(float z)

  Sets this vectors z coordinate.
  Parameters:
    `z` - the z coordinate
  Since:
    Cult3D 4.2

### getX

    public float getX()

  Gets this vectors x coordinate.
  Returns:
    the x coordinate
  Since:
    Cult3D 4.2

### getY

    public float getY()

  Gets this vectors y coordinate.
  Returns:
    the y coordinate
  Since:
    Cult3D 4.2

### getZ

    public float getZ()

  Gets this vectors z coordinate.
  Returns:
    the z coordinate
  Since:
    Cult3D 4.2

### add

    public void add(Vector3 v)

  Sets this vector to the sum of itself and the vector parameter.
  Parameters:
    `v` - the vector to add
  Since:
    Cult3D 4.2

### add

    public void add(Vector3 v1,
                    Vector3 v2)

  Sets this vector to the sum of the two vector parameters.
  Parameters:
    `v1` - the first vector to add
    `v2` - the second vector to add
  Since:
    Cult3D 4.2

### sub

    public void sub(Vector3 v)

  Sets this vector to the difference of itself and the vector parameter.
  Parameters:
    `v` - the vector to subtract
  Since:
    Cult3D 4.2

### sub

    public void sub(Vector3 v1,
                    Vector3 v2)

  Sets this vector to the difference of the two vector parameters.
  Parameters:
    `v1` - the first vector
    `v2` - the second vector
  Since:
    Cult3D 4.2

### div

    public void div(float f)

  Divides this vector with the parameter.
  Parameters:
    `f` - value to divide with.
  Since:
    Cult3D 4.2

### div

    public void div(Vector3 v,
                    float f)

  Sets this vector to the v parameter divided with the f parameter
  Parameters:
    `v` - the vector to divide
    `f` - value to divide with.
  Since:
    Cult3D 4.2

### mult

    public void mult(float f)

  Multiplies this vector with the parameter.
  Parameters:
    `f` - value to multiplie with.
  Since:
    Cult3D 4.2

### mult

    public void mult(Vector3 v,
                     float f)

  Sets this vector to the v parameter multiplied with the f parameter
  Parameters:
    `v` - the vector to multiplie
    `f` - value to multiplie with.
  Since:
    Cult3D 4.2

### cross

    public void cross(Vector3 v)

  Sets this vector to the cross product of itself and the parameter.
  Parameters:
    `v` - the vector
  Since:
    Cult3D 4.2

### cross

    public void cross(Vector3 v1,
                      Vector3 v2)

  Sets this vector to the cross product of vectors v1 and v2.
  Parameters:
    `v1` - the first vector
    `v2` - the second vector
  Since:
    Cult3D 4.2

### dot

    public float dot(Vector3 v)

  Computes the dot product of itself and the parameter.
  Parameters:
    `v` - the vector
  Returns:
    the dot product
  Since:
    Cult3D 4.2

### dot

    public float dot(Vector3 v1,
                     Vector3 v2)

  Computes the dot product of vectors v1 and v2.
  Parameters:
    `v1` - the first vector
    `v2` - the second vector
  Returns:
    the dot product
  Since:
    Cult3D 4.2

### length

    public final float length()

  Returns the length of this vector.
  Returns:
    the length of this vector
  Since:
    Cult3D 4.2

### normalize

    public final void normalize()

  Sets this vector to its normal.
  Since:
    Cult3D 4.2

### normalize

    public final void normalize(Vector3 v)

  Sets this vector to the parameters normal.
  Parameters:
    `v` - the vector to normalize.
  Since:
    Cult3D 4.2

### angle

    public final float angle(Vector3 v)

  Returns the angle in radians between this vector and the parameter.
  Parameters:
    `v` - the other vector.
  Returns:
    the angle in radians.
  Since:
    Cult3D 4.2

### equals

    public boolean equals(java.lang.Object obj)

  Returns true if the Object obj is of type Vector3 and all of the coordinates of obj are equal to the corresponding coordinates in this Vector3.
  Overrides:
    equals in class java.lang.Object
  Returns:
    returns true if the parameter and this object are equal, false otherwise.
  Since:
    Cult3D 4.2

### getInfo

    public java.lang.String getInfo()

  This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.

  Returns:
    A string representing this object.
  Since:
    Cult3D 5.3

### toString

    public java.lang.String toString()

  Returns a string representation of the values of this object.

  The string contains the name of this class and the current x,y,z values of this vector.

  This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations and versions of Cult3D.

  Overrides:
    toString in class java.lang.Object
  Returns:
    A string representing this object.

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD