|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttracer.Vec3
Represents a 3-dimensional vector. Note that all the `operator' methods return a new Vec3 object.
Field Summary | |
float |
x
|
float |
y
|
float |
z
|
Constructor Summary | |
Vec3()
Default constructor. |
|
Vec3(float x,
float y,
float z)
Constructor from floats. |
|
Vec3(Vec3 that)
Copy constructor |
Method Summary | |
Vec3 |
add(Vec3 that)
Vector addition. |
Vec3 |
cross(Vec3 b)
Vector cross-product. |
float |
dot(Vec3 that)
Vector dot-product. |
float |
length()
Returns the length of this vector. |
float |
lengthSquared()
Return the square of the length of this vector. |
Vec3 |
minus(Vec3 that)
Vector subtraction. |
void |
normalize()
Normalizes this vector. |
void |
parse(Parser p)
Reads a vector in the form "<number, number, number>" from the Parser p. |
static Vec3 |
random(float length)
Returns a Vec3 of specified length with a random direction. |
Vec3 |
times(float f)
Multiplication by a scalar. |
Vec3 |
times(Vec3 that)
Component-wise multiply |
java.lang.String |
toString()
Returns a string representation of this vector, of the form "<number, number, number>" as can be parsed by the parse(Parser) method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public float x
public float y
public float z
Constructor Detail |
public Vec3(Vec3 that)
public Vec3(float x, float y, float z)
public Vec3()
Method Detail |
public static Vec3 random(float length)
public void parse(Parser p) throws java.io.IOException
java.io.IOException
toString
public Vec3 minus(Vec3 that)
public Vec3 add(Vec3 that)
public Vec3 times(float f)
public Vec3 times(Vec3 that)
public float length()
lengthSquared
public float lengthSquared()
length
public float dot(Vec3 that)
public Vec3 cross(Vec3 b)
public void normalize()
public java.lang.String toString()
parse
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |