fsmvis.engine
Class Vect
java.lang.Object
|
+--fsmvis.engine.Coordinate
|
+--fsmvis.engine.Vect
- public class Vect
- extends Coordinate
- See Also:
- Serialized Form
Constructor Summary |
Vect()
constructor: empty |
Vect(Coordinate c)
constructor: instantiates the class with an existing coordinate, treats
The values of the coordinate as if they were vectors |
Vect(Coordinate c1,
Coordinate c2)
constructor: Takes two Coordinate objects as parameters and constructs
a vector from this |
Vect(double x,
double y,
double z,
double w)
constructor: takes four values to use as vector values |
Method Summary |
double |
dotProduct(Vect v)
calculates the dot product between this vector and the vector passed
as an arg |
double |
getLength()
Returns the length of this vector, makes use of the Coordinate class to
see how many dimensions are currently being used, then only uses these
dimensions to calc the length |
Vect |
normalizeVector()
Makes a new normalized version of this vector. |
void |
scale(double factor)
Scales this vector by multiplying by a factor |
Methods inherited from class fsmvis.engine.Coordinate |
add,
equals,
get,
getActiveDimensions,
getW,
getX,
getY,
getZ,
set,
set,
set,
setActiveDimensions,
setW,
setX,
setY,
setZ,
sub,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Vect
public Vect()
- constructor: empty
Vect
public Vect(double x,
double y,
double z,
double w)
- constructor: takes four values to use as vector values
- Parameters:
x
- the x component of vectory
- the y component of vectorz
- the z component of vectorw
- the w component of vector
Vect
public Vect(Coordinate c1,
Coordinate c2)
- constructor: Takes two Coordinate objects as parameters and constructs
a vector from this
- Parameters:
c1
- The first coordinate in the vectorc2
- The second coordinate in the vector
Vect
public Vect(Coordinate c)
- constructor: instantiates the class with an existing coordinate, treats
The values of the coordinate as if they were vectors
- Parameters:
c
- The coord to use for instantiating
getLength
public double getLength()
- Returns the length of this vector, makes use of the Coordinate class to
see how many dimensions are currently being used, then only uses these
dimensions to calc the length
- Returns:
- The length
normalizeVector
public Vect normalizeVector()
- Makes a new normalized version of this vector. That is a unit vector
with length 1. does this by dividing each coord by 1/getLength()
- Returns:
- The normalized vector
dotProduct
public double dotProduct(Vect v)
- calculates the dot product between this vector and the vector passed
as an arg
- Parameters:
v
- The vector to be dot prodded with this vector- Returns:
- The result of the dot product
scale
public void scale(double factor)
- Scales this vector by multiplying by a factor
- Parameters:
factor
- The factor to multiply by