: Class Vector
Class Tree Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: INNER | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD Class Vector
java.lang.Object
|
+--Vector
public class Vector extends java.lang.Object Vector stores and manipulates xyz triples representing 3 space vectors. Field Summary double X Holds the X component double Y Holds the Y component double Z Holds the Z component Constructor Summary Vector() Create a new vector and set it to zero Vector(double x, double y, double z) Create a new vector with the given x,y and z values Vector(Point p) Create a new vector by converting a Point object Vector(Vector v) Create a new vector by copying an existing vector Method Summary void add(Vector v) Add the given vector to this vector static Vector add(Vector v1, Vector v2) Static function to sum two vector and write it to a given destination vector. static void add(Vector vd, Vector v1, Vector v2) Static function to sum two vectors and write it to a given destination vector. void copy(Vector v) Copy an existing vector to this vector void cross(Vector v) Cross product the given vector with this vector static Vector cross(Vector v1, Vector v2) Static cross product methods that creates a new vector with the cross product of the two given vectors. static void cross(Vector vd, Vector v1, Vector v2) Static cross product methods that write the cross product of the two given vectors to the given desination vector. double dot(Vector v) Dot product the given vector with this vector static double dot(Vector v1, Vector v2) Static method that returns the dot product of the two given * vectors. void negate() Negate this vector static Vector negate(Vector v) Static negate method that creates a new vector from a given vector. double norm() Find the length of this vector void normalise() Normalise this vector Vector normalised() Create a new vector as the normalisation of this vector void print(SceneWriter os) Print a human readable version of the vector definition to the given destination void read(SceneReader is) Read the vector from the given source void scale(double s) Scale this vector by the given factor static Vector scale(Vector v, double s) Static scale method that creates a new vector from a given vector and scale factor. static void scale(Vector vd, Vector v, double s) Static scale method that writes a scaled vector based upon the given vector and scale factor. void set(double x, double y, double z) Set this vector to the given x,y and z values double squarednorm() Find the squared length of this vector static Vector subtract(Point p1, Point p2) Static function to create a new vector as the difference between two points. void subtract(Vector v) Subtract the given vector from this vector static void subtract(Vector v, Point p1, Point p2) Static function to find the difference between two points and write it to a given destination vector. static Vector subtract(Vector v1, Vector v2) Static function to create a new vector as the difference between two vectors. static void subtract(Vector vd, Vector v1, Vector v2) Static function to find the difference between two vectors and write it to a given destination vector. void write(SceneWriter os) Write the vector to the given destination Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait Field Detail X
public double X Holds the X component Y
public double Y Holds the Y component Z
public double Z Holds the Z component Constructor Detail Vector
public Vector() Create a new vector and set it to zero Vector
public Vector(double x,
double y,
double z) Create a new vector with the given x,y and z values Parameters: x - the x value y - the y value z - the z value Vector
public Vector(Vector v) Create a new vector by copying an existing vector Parameters: v - the vector to copy Vector
public Vector(Point p) Create a new vector by converting a Point object Parameters: p - the point to copy Method Detail set
public void set(double x,
double y,
double z) Set this vector to the given x,y and z values Parameters: x - the x value y - the y value z - the z value copy
public void copy(Vector v) Copy an existing vector to this vector Parameters: v - the vector to copy squarednorm
public double squarednorm() Find the squared length of this vector Returns: the squared length norm
public double norm() Find the length of this vector Returns: the length normalise
public void normalise() Normalise this vector normalised
public Vector normalised() Create a new vector as the normalisation of this vector Returns: the new vector with the normalised version subtract
public static Vector subtract(Point p1,
Point p2) Static function to create a new vector as the difference between two points. Parameters: p1 - the first point p2 - the second point Returns: the new difference vector subtract
public static void subtract(Vector v,
Point p1,
Point p2) Static function to find the difference between two points and write it to a given destination vector. Parameters: v - the destination vector p1 - the first point p2 - the second point Returns: the new difference vector subtract
public void subtract(Vector v) Subtract the given vector from this vector Parameters: v - the vector to subtract subtract
public static Vector subtract(Vector v1,
Vector v2) Static function to create a new vector as the difference between two vectors. Parameters: v1 - the first vector v2 - the second vector Returns: the new difference vector subtract
public static void subtract(Vector vd,
Vector v1,
Vector v2) Static function to find the difference between two vectors and write it to a given destination vector. Parameters: vd - the destination vector v1 - the first vector v2 - the second vector add
public void add(Vector v) Add the given vector to this vector Parameters: v - the vector to add add
public static Vector add(Vector v1,
Vector v2) Static function to sum two vector and write it to a given destination vector. Parameters: v1 - the first vector v2 - the second vector Returns: the new vector add
public static void add(Vector vd,
Vector v1,
Vector v2) Static function to sum two vectors and write it to a given destination vector. Parameters: vd - the destination vector v1 - the first vector v2 - the second vector cross
public void cross(Vector v) Cross product the given vector with this vector Parameters: v - the vector to cross with cross
public static Vector cross(Vector v1,
Vector v2) Static cross product methods that creates a new vector with the cross product of the two given vectors. Parameters: v1 - the first vector to cross with v2 - the second vector to cross with Returns: a new vector containing the cross product cross
public static void cross(Vector vd,
Vector v1,
Vector v2) Static cross product methods that write the cross product of the two given vectors to the given desination vector. Parameters: vd - the vector to store the cross product in v1 - the first vector to cross with v2 - the second vector to cross with dot
public double dot(Vector v) Dot product the given vector with this vector Parameters: v - the vector to dot product with Returns: the dot product dot
public static double dot(Vector v1,
Vector v2) Static method that returns the dot product of the two given * vectors. Parameters: v1 - the first vector of the dot product v2 - the second vector of the dot product Returns: the dot product scale
public void scale(double s) Scale this vector by the given factor Parameters: s - the scale factor scale
public static Vector scale(Vector v,
double s) Static scale method that creates a new vector from a given vector and scale factor. Parameters: v - the vector to scale s - the scale factor Returns: a scaled vector scale
public static void scale(Vector vd,
Vector v,
double s) Static scale method that writes a scaled vector based upon the given vector and scale factor. Parameters: vd - the destination vector v - the vector to scale s - the scale factor negate
public void negate() Negate this vector negate
public static Vector negate(Vector v) Static negate method that creates a new vector from a given vector. Parameters: v - the vector to negate Returns: a negated vector read
public void read(SceneReader is)
throws java.io.IOException,
java.lang.NumberFormatException Read the vector from the given source Parameters: is - the source to read from Throws: java.io.IOException - if the light can not be read java.io.NumberFormatException - if there a number format error is encountered write
public void write(SceneWriter os)
throws java.io.IOException Write the vector to the given destination Parameters: os - the destination to write to Throws: java.io.IOException - if the write fails. print
public void print(SceneWriter os)
throws java.io.IOException Print a human readable version of the vector definition to the given destination Parameters: os - the destination to write to Throws: java.io.IOException - if the write fails. Class Tree Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: INNER | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD