|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Vector3D
A class to represent a vector or a point in 3D system
Field Summary | |
double[] |
v
double v[3] purpose : store the values of the coordinates |
Constructor Summary | |
Vector3D()
Default constructor purpose : initialize the vector to (0.0, 0.0, 0.0) |
|
Vector3D(double x,
double y,
double z)
Constructor purpose : initialize the vector to (x, y, z) |
|
Vector3D(Vector3D x)
Copy constructor purpose : initialize the vector to the input Vector3D x) |
Method Summary | |
static Vector3D |
cross(Vector3D a,
Vector3D b)
purpose : cross product |
static double |
dot(Vector3D a,
Vector3D b)
purpose : dot product |
double |
length()
purpose : length of the vector |
static Vector3D |
minus(Vector3D a,
Vector3D b)
purpose : subtract one vector by another vector |
static Vector3D |
multi(int factor,
Vector3D a)
purpose : multiply a number with a vector |
double |
normalize()
purpose : normalizing the vector |
static Vector3D |
plus(Vector3D a,
Vector3D b)
purpose add two vectors together |
void |
round(int decPlace)
purpose : round off the coordinates of the vector to some decimal places |
java.lang.String |
toString()
purpose : convert the vector to String |
static Vector3D |
transformPoint(Matrix m,
Vector3D p)
purpose : multiply a matrix with a vector |
static Vector3D |
transformPointQ(Matrix m,
Vector3D p)
purpose : multiply a matrix with a vector, assume last row of the matrix is 0,0,0,1 |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public double[] v
Constructor Detail |
public Vector3D()
public Vector3D(double x, double y, double z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic Vector3D(Vector3D x)
Method Detail |
public static Vector3D plus(Vector3D a, Vector3D b)
a
- first Vector3Db
- second Vector3Dpublic static Vector3D minus(Vector3D a, Vector3D b)
a
- first Vector3Db
- second Vector3Dpublic static Vector3D multi(int factor, Vector3D a)
factor
- integera
- Vector3Dpublic static double dot(Vector3D a, Vector3D b)
a
- first Vector3Db
- second Vector3Dpublic static Vector3D cross(Vector3D a, Vector3D b)
a
- first Vector3Db
- second Vector3Dpublic double length()
public double normalize()
public static Vector3D transformPointQ(Matrix m, Vector3D p)
m
- Matrixp
- Vector3Dpublic static Vector3D transformPoint(Matrix m, Vector3D p)
m
- Matrixp
- Vector3Dpublic java.lang.String toString()
public void round(int decPlace)
decPlace
- number of decimal places
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |