|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjpview.graphics.Vec3f
public class Vec3f
The Vec3f class provides a vector object for 3 dimensional locations or RGB pixel values. The class offers static methods for standard vector operations.
| Constructor Summary | |
|---|---|
Vec3f()
Creates a new instance of Vec3 |
|
Vec3f(float[] f)
Creates a new Vec3f object using the provided float [] as the underlying values. |
|
Vec3f(float x,
float y,
float z)
Creates an new Vec3f object using the provided float values |
|
| Method Summary | |
|---|---|
static Vec3f |
convertPixel(int pixel)
Converts a 32 bit pixel value with RGB in the lower 24 bits to a Vec3f object |
Vec3f |
cross(Vec3f v)
Returns the cross product of this Vec3f and the Vec3f provided to the method |
Vec3f |
diff(Vec3f v)
Returns the difference of two vectors. |
float |
dot(Vec3f vector)
Returns the dot product of this Vec3f and the Vec3f provided to the method |
boolean |
equals(Vec3f that)
Returns true if this vector is the same as the provided vector |
float |
len()
Returns the length of the Vec3f vector |
Vec3f |
normalize()
Normalizes the vector. |
void |
perturb()
Perturbs the normal slightly |
static Vec3f |
reflect(Vec3f normal,
Vec3f incedent)
Returns a vector representing the reflection of the provided incedent vector. |
Vec3f |
scale(float s)
Scales this vector by the provided float value |
Vec3f |
sum(Vec3f v)
Adds two Vec3f objects together |
float[] |
toFloat()
Returns the underlying float array for the Vec3f object. |
int |
toPixel()
Returns a representation of this vector as a colored pixel value, with RGB in the lower 24 bits. |
java.lang.String |
toString()
Returns a string representation of this vector. |
float |
x()
Returns the x component of the vector (x,y,z) |
void |
x(float f)
Sets the x component of the vector (x,y,z) to the provided value |
float |
y()
Returns the y component of the vector (x,y,z) |
void |
y(float f)
Sets the y component of the vector (x,y,z) to the provided value |
float |
z()
Returns the z component of the vector (x,y,z) |
void |
z(float f)
Sets the z component of the vector (x,y,z) to the provided value |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Vec3f()
public Vec3f(float[] f)
f - an array of 3 float values.
public Vec3f(float x,
float y,
float z)
x - first float valuey - second float valuez - third float value| Method Detail |
|---|
public static Vec3f convertPixel(int pixel)
pixel - the 32 bit pixel value
public float[] toFloat()
public float len()
public Vec3f normalize()
public float x()
public float y()
public float z()
public void x(float f)
f - the x component of the vector (x,y,z)public void y(float f)
f - the y component of the vector (x,y,z)public void z(float f)
f - the z component of the vector (x,y,z)public float dot(Vec3f vector)
vector - The Vec3f object representing the right-hand side of the dot product
public Vec3f cross(Vec3f v)
v - The Vec3f object representing the right-hand side of the cross product
public Vec3f scale(float s)
s - the amount by which each component of the vector is multiplied
public Vec3f sum(Vec3f v)
v - The vector to which this vector will be added
public Vec3f diff(Vec3f v)
v - The vector representing the right-hand side of the difference.
public java.lang.String toString()
toString in class java.lang.Object
public static Vec3f reflect(Vec3f normal,
Vec3f incedent)
normal - The normal vector for the particular poiont.incedent - The vector representing incedent light.
public boolean equals(Vec3f that)
that - The vector to be compared with this vector
public int toPixel()
public void perturb()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||