com.threerings.math
Class Vector4f

java.lang.Object
  extended by com.threerings.math.Vector4f
All Implemented Interfaces:
Encodable, Exportable, com.threerings.io.Streamable

public final class Vector4f
extends Object
implements Encodable, com.threerings.io.Streamable

A four element vector.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
com.threerings.io.Streamable.Closure
 
Field Summary
 float w
          The components of the vector.
 float x
          The components of the vector.
 float y
          The components of the vector.
 float z
          The components of the vector.
 
Constructor Summary
Vector4f()
          Creates a zero vector.
Vector4f(float[] values)
          Creates a vector from four components.
Vector4f(FloatBuffer buf)
          Creates a vector from a float buffer.
Vector4f(float x, float y, float z, float w)
          Creates a vector from four components.
Vector4f(Vector4f other)
          Copy constructor.
 
Method Summary
 void decodeFromStream(DataInputStream in)
          Initializes this object with data read from the specified stream.
 void decodeFromString(String string)
          Initializes this object with the contents of the specified string.
 void encodeToStream(DataOutputStream out)
          Encodes this object to the specified stream.
 String encodeToString()
          Returns a string representation of this object.
 boolean epsilonEquals(Vector4f other, float epsilon)
          Compares this vector to another with the provided epsilon.
 boolean equals(Object other)
           
 FloatBuffer get(FloatBuffer buf)
          Populates the supplied buffer with the contents of this vector.
 int hashCode()
           
 Vector4f set(float[] values)
          Sets all of the elements of the vector.
 Vector4f set(FloatBuffer buf)
          Sets all of the elements of the vector.
 Vector4f set(float x, float y, float z, float w)
          Sets all of the elements of the vector.
 Vector4f set(Vector4f other)
          Copies the elements of another vector.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public float x
The components of the vector.


y

public float y
The components of the vector.


z

public float z
The components of the vector.


w

public float w
The components of the vector.

Constructor Detail

Vector4f

public Vector4f(float x,
                float y,
                float z,
                float w)
Creates a vector from four components.


Vector4f

public Vector4f(float[] values)
Creates a vector from four components.


Vector4f

public Vector4f(FloatBuffer buf)
Creates a vector from a float buffer.


Vector4f

public Vector4f(Vector4f other)
Copy constructor.


Vector4f

public Vector4f()
Creates a zero vector.

Method Detail

set

public Vector4f set(Vector4f other)
Copies the elements of another vector.

Returns:
a reference to this vector, for chaining.

set

public Vector4f set(float[] values)
Sets all of the elements of the vector.

Returns:
a reference to this vector, for chaining.

set

public Vector4f set(FloatBuffer buf)
Sets all of the elements of the vector.

Returns:
a reference to this vector, for chaining.

set

public Vector4f set(float x,
                    float y,
                    float z,
                    float w)
Sets all of the elements of the vector.

Returns:
a reference to this vector, for chaining.

get

public FloatBuffer get(FloatBuffer buf)
Populates the supplied buffer with the contents of this vector.

Returns:
a reference to the buffer, for chaining.

epsilonEquals

public boolean epsilonEquals(Vector4f other,
                             float epsilon)
Compares this vector to another with the provided epsilon.


encodeToString

public String encodeToString()
Description copied from interface: Encodable
Returns a string representation of this object.

Specified by:
encodeToString in interface Encodable

decodeFromString

public void decodeFromString(String string)
                      throws Exception
Description copied from interface: Encodable
Initializes this object with the contents of the specified string.

Specified by:
decodeFromString in interface Encodable
Throws:
Exception

encodeToStream

public void encodeToStream(DataOutputStream out)
                    throws IOException
Description copied from interface: Encodable
Encodes this object to the specified stream.

Specified by:
encodeToStream in interface Encodable
Throws:
IOException

decodeFromStream

public void decodeFromStream(DataInputStream in)
                      throws IOException
Description copied from interface: Encodable
Initializes this object with data read from the specified stream.

Specified by:
decodeFromStream in interface Encodable
Throws:
IOException

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


Copyright © 2011. All Rights Reserved.