|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Vec
Represents homogeneous coords point in 3D, plus algebra.
For CSU540 Computer Graphics class, Spring 2005 CCIS, Northeastern University
Consists of a single 4-element double vector, vec, and various static methods.
Method names ending with "Same" alter the vector argument.
Others return a copy.
Field Summary | |
double[] |
vec
The only (non-static) field, a 4-element array. |
Constructor Summary | |
Vec()
Creates 0.0 vector with homogeneous, vec[3], coord = 1.0. |
|
Vec(double x,
double y,
double z)
Creates vector with the three argument values and vec[3] = 1.0. |
Method Summary | |
static double |
innerProd(Vec v1,
Vec v2)
Inner product using the x, y, z components. |
static double |
length(Vec v)
Computes vector length. |
static void |
main(java.lang.String[] args)
Tests and prints results of all methods (all are static) |
static Vec |
normalize(Vec v)
Creates a normalized, unit length, copy of a Vec. |
static void |
normalizeSame(Vec v)
Normalizes (alters) a Vec to unit length. |
static Vec |
outerProd(Vec v1,
Vec v2)
Outer, or vector, product using the x, y, z components. |
java.lang.String |
toString()
Lists the x, y, and z elements of vec. |
static Vec |
vecDiff(Vec v1,
Vec v2)
Difference of two vectors, a static method. |
static Vec |
vecSum(Vec v1,
Vec v2)
Sum of two vectors, a static method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public double[] vec
Constructor Detail |
public Vec()
public Vec(double x, double y, double z)
Method Detail |
public static void main(java.lang.String[] args)
public java.lang.String toString()
public static double innerProd(Vec v1, Vec v2)
public static Vec outerProd(Vec v1, Vec v2)
| i j k | | x y z | | x' y' z'|where i, j, and k are the unit vectors along the three axes.
public static Vec vecSum(Vec v1, Vec v2)
public static Vec vecDiff(Vec v1, Vec v2)
public static double length(Vec v)
public static Vec normalize(Vec v)
public static void normalizeSame(Vec v)
v
- The vector to be scaled to unit length.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |