Scripting API

Home Scripting API Index Class Overview

nlvm.math3d

Class Vector4f


public final class Vector4f
extends Object

Represents a vector of 4 floats

Field Summary

float w
float x
float y
float z


Constructor Summary

Vector4f()
    Default constructor initializing all components to zero
Vector4f(float x, float y, float z, float w)
    Constructs a vector using 4 floats
Vector4f(Vector3f vec, float w)
    Constructs a copy of vec (for x, y, z) and w
Vector4f(Vector4f vec)
    Constructs a copy of vec


Method Summary

void add(float scalar)
  Add a scalar to all components of this
void add(Vector4f vec)
  Add a vector to this
void div(float scalar)
  Divides a scalar from all components of this
void div(Vector4f vec)
  Divides a vector from this (component wise division)
float dot(Vector4f b)
  Computes the 4d dot product of this and a second vector
Vector4f dup()
  Creates a copy
bool equals(Object obj)
void lerp(float t, Vector4f a, Vector4f b)
  Sets this to a linear interpolation between a and b
void mul(float scalar)
  Multiplies a scalar to all components of this
void mul(Vector4f vec)
  Multiplies a vector to this (component wise multiplication)
void set(float scalar)
  Sets all components of the vector with a scalar
void set(float x, float y, float z, float w)
  Initializes using 4 floats
void set(Vector3f vec, float w)
  Initializes as a copy of vec (for x, y, z) and w
void set(Vector4f vec)
  Initializes as a copy of vec
void setZero()
  Set all components to zero
void sub(float scalar)
  Subtract a scalar from all components of this
void sub(Vector4f vec)
  Subtract a vector from this
String toString()


Field Detail


w

public float w


x

public float x


y

public float y


z

public float z


Constructor Detail


Vector4f

public Vector4f()

Default constructor initializing all components to zero


Vector4f

public Vector4f(float x, float y, float z, float w)

Constructs a vector using 4 floats


Vector4f

public Vector4f(Vector3f vec, float w)

Constructs a copy of vec (for x, y, z) and w

Since:
    2.6.2.0


Vector4f

public Vector4f(Vector4f vec)

Constructs a copy of vec


Method Detail


add

public final void add(float scalar)

Add a scalar to all components of this

Since:
    2.6.2.0


add

public final void add(Vector4f vec)

Add a vector to this

Since:
    2.6.2.0


div

public final void div(float scalar)

Divides a scalar from all components of this

Since:
    2.6.2.0


div

public final void div(Vector4f vec)

Divides a vector from this (component wise division)

Since:
    2.6.2.0


dot

public final float dot(Vector4f b)

Computes the 4d dot product of this and a second vector

Pseudo code: result = this.x*b.x + this.y*b.y + this.z*b.z + this.w*b.w

Parameters:

b - second vector

Returns:
    dot product of this and b

Since:
    2.6.2.0


dup

public final Vector4f dup()

Creates a copy


equals

public bool equals(Object obj)


lerp

public final void lerp(float t, Vector4f a, Vector4f b)

Sets this to a linear interpolation between a and b

Pseudo code: this = (1-t) * a + t * b. All parameters including this might be the same reference.

Parameters:

a - first vector
b - second vector

Since:
    2.6.2.0


mul

public final void mul(float scalar)

Multiplies a scalar to all components of this

Since:
    2.6.2.0


mul

public final void mul(Vector4f vec)

Multiplies a vector to this (component wise multiplication)

Since:
    2.6.2.0


set

public final void set(float scalar)

Sets all components of the vector with a scalar

x, y, z, w will be set to scalar

Since:
    2.6.2.0


set

public final void set(float x, float y, float z, float w)

Initializes using 4 floats


set

public final void set(Vector3f vec, float w)

Initializes as a copy of vec (for x, y, z) and w

Since:
    2.6.2.0


set

public final void set(Vector4f vec)

Initializes as a copy of vec


setZero

public final void setZero()

Set all components to zero


sub

public final void sub(float scalar)

Subtract a scalar from all components of this

Since:
    2.6.2.0


sub

public final void sub(Vector4f vec)

Subtract a vector from this

Since:
    2.6.2.0


toString

public String toString()