

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object core.math.Vec
an ndimensional vector = < n, (x0, x1, ..., xn1) >. This class stores and operates on an arbitrarydimension vector. Methods that begin with a capital letter modify "this", while methods that begin with a lowercase letter create a new Vec to store the result.
Field Summary  
int 
dim
dim = n, the dimension of this vector 
static double 
tolerance
tolerance is the percomponent zerovalue maximum 
double[] 
x
x[] stores the components of this vector 
Constructor Summary  
Vec(int dim)
Constructs a zerovector of "dim"dimension 

Vec(Vec v)
Constructs a new vector that is a copy of vector "v" 
Method Summary  
Vec 
add(Vec v)
Returns: a new Vec that is the sum of "this" and "v" Requires: "this" and "v" have the same dimension 
Vec 
Add(Vec v)
Adds "v" to "this" Returns: resulting "this" Requires: "this" and "v" have the same dimension 
Vec 
addscaled(Vec v,
double s)
Returns: a new Vec that is the sum of "this" and "s*v" Requires: "this" and "v" have the same dimension 
Vec 
AddScaled(Vec v,
double s)
Adds "s*v" to "this" Returns: resulting "this" Requires: "this" and "v" have the same dimension 
private void 
assertDim(Vec v)
Used internally to verify that "v" has the same dimension as "this" 
Vec 
copy()
Returns a copy of "this" 
double 
dot(Vec v)
Returns: the dot product of "this" and "v" Requires: "this" and "v" have the same dimension 
boolean 
equals(Vec v)
Returns: true if "this" and "v" are equal, false otherwise Requires: "this" and "v" have the same dimension 
boolean 
isZero()
Returns: true if "this" is the zerovector, false otherwise 
double 
len()
Returns: the magnitude of "this" 
double 
len2()
Returns: the magnitude squared of "this" 
double 
len3()
Returns: the magnitude cubed of "this" 
Vec 
neg()
Returns: a new Vec that is the opposite of "this" 
Vec 
Neg()
Negates "this" Returns: resulting "this" 
Vec 
newVec()
Returns a new zerovector of the same dimension as "this" 
Vec 
para(Vec d)
Returns: a new Vec that is the component of "this" parallel to "d" Requires: "d" is not zero 
Vec 
Para(Vec d)
Isolates the component of "this" parallel to "d" Returns: resulting "this" Requires: "d" is not zero 
Vec 
paraunit(Vec d)
Returns: a new Vec that is the component of "this" parallel to "d" Requires: "d" has unit magnitude 
Vec 
ParaUnit(Vec d)
Isolates the component of "this" parallel to "d" Returns: resulting "this" Requires: "d" has unit magnitude 
Vec 
perp(Vec d)
Returns: a new Vec that is the component of "this" perpendicular to "d" Requires: "d" is not zero 
Vec 
Perp(Vec d)
Isolates the component of "this" perpendicular to "d" Returns: resulting "this" Requires: "d" is not zero 
Vec 
perpunit(Vec d)
Returns: a new Vec that is the component of "this" perpendicular to "d" Requires: "d" has unit magnitude 
Vec 
PerpUnit(Vec d)
Isolates the component of "this" perpendicular to "d" Returns: resulting "this" Requires: "d" has unit magnitude 
Vec 
scale(double s)
Returns: a new Vec that is "s*this" 
Vec 
Scale(double s)
Scales "this" by "s" Returns: resulting "this" 
Vec 
scale(Vec v)
Returns: a new Vec that is "this" with its components scaled by "v" Requires: "this" and "v" have the same dimension 
Vec 
Scale(Vec v)
Scales each component of "this" by the corresponding component of "v" Returns: resulting "this" Requires: "this" and "v" have the same dimension 
Vec 
Set(Vec v)
Sets the value of "this" to that of "v" Returns: resulting "this" Requres: "this" and "v" have the same dimension 
Vec 
SetZero()
Sets "this" to be the zerovector with the same dimension as "this" Returns: resulting "this" 
Vec 
sub(Vec v)
Returns: a new Vec that is the difference between "this" and "v" Requires: "this" and "v" have the same dimension 
Vec 
Sub(Vec v)
Subtracts "v" from "this" Returns: resulting "this" Requres: "this" and "v" have the same dimension 
Vec2 
toVec2()
Returns: a new Vec2 that is equal to "this" Requires: "this" is 2dimensional 
Vec3 
toVec3()
Returns: a new Vec3 that is equal to "this" Requires: "this" is 3dimensional 
Vec 
unit()
Returns: a new Vec that is "this" scaled to unit magnitude Requires: "this" is not zero 
Vec 
Unit()
Rescales "this" to be of unit magnitude Returns: resulting "this" Requires: "this" is not zero 
Methods inherited from class java.lang.Object 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 
public int dim
public double[] x
public static double tolerance
Constructor Detail 
public Vec(int dim)
public Vec(Vec v)
Method Detail 
public Vec newVec()
public Vec copy()
private void assertDim(Vec v)
public Vec Set(Vec v)
public Vec SetZero()
public boolean isZero()
public boolean equals(Vec v)
public Vec Add(Vec v)
public Vec add(Vec v)
public Vec AddScaled(Vec v, double s)
public Vec addscaled(Vec v, double s)
public Vec Sub(Vec v)
public Vec sub(Vec v)
public Vec Neg()
public Vec neg()
public double dot(Vec v)
public double len()
public double len2()
public double len3()
public Vec Scale(double s)
public Vec scale(double s)
public Vec Scale(Vec v)
public Vec scale(Vec v)
public Vec Unit()
public Vec unit()
public Vec Para(Vec d)
public Vec para(Vec d)
public Vec ParaUnit(Vec d)
public Vec paraunit(Vec d)
public Vec Perp(Vec d)
public Vec perp(Vec d)
public Vec PerpUnit(Vec d)
public Vec perpunit(Vec d)
public Vec2 toVec2()
public Vec3 toVec3()


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 