|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore.math.Vec2
A 2-dimensional vector = < (x, y) >. This class stores and operates on a 2-dimensional vector. Methods that begin with a capital letter modify "this", while methods that begin with a lowercase letter create a new Vec2 to store the result.
Field Summary | |
static Vec2[] |
Cartesian
do not modify Cartesian an array of the cartesian axes |
static Vec2 |
Invalid
do not modify Invalid = an invalid Vec |
static double |
tolerance
do not modify tolerance the per-component zero-value maximum |
double |
x
x and y are the components of this vector |
static Vec2 |
Xhat
do not modify Xhat = the unit x-axis |
double |
y
x and y are the components of this vector |
static Vec2 |
Yhat
do not modify Yhat = the unit y-axis |
static Vec2 |
Zero
do not modify Zero = the zero vector |
Constructor Summary | |
Vec2()
Constructs a new Vec2 = (0, 0) |
|
Vec2(double x,
double y)
Constructs a new Vec2 = (x, y) |
|
Vec2(Vec v)
Constructs a new Vec2 = "v" Requires: "v" has dimension 2 |
|
Vec2(Vec2 v)
Constructs a new Vec2 = "v" |
Method Summary | |
Vec2 |
add(double x,
double y)
Returns: a new Vec2 that is the sum of "this" and (x, y) |
Vec2 |
Add(double x,
double y)
Adds (x, y) to "this" Returns: resulting "this" |
Vec2 |
add(Vec2 v)
Returns: a new Vec2 that is the sum of "this" and "v" |
Vec2 |
Add(Vec2 v)
Adds "v" to "this" Returns: resulting "this" |
Vec2 |
addscaled(double x,
double y,
double s)
Returns: a new Vec2 that is the sum of "this" and "s * (x, y)" |
Vec2 |
AddScaled(double x,
double y,
double s)
Adds "s * (x, y)" to "this" Returns: resulting "this" |
Vec2 |
addscaled(Vec2 v,
double s)
Returns: a new Vec2 that is the sum of "this" and "s*v" |
Vec2 |
AddScaled(Vec2 v,
double s)
Adds "s*v" to "this" Returns: resulting "this" |
Vec2 |
copy()
Returns a copy of "this" |
double |
cross(Vec2 b)
Returns: the magnitude of cross product of "this" and "b" |
double |
dot(double x,
double y)
Returns: the dot product of "this" and (x, y) |
double |
dot(Vec2 v)
Returns: the dot product of "this" and "v" |
boolean |
equals(Vec2 v)
Returns: true if "this" equals "v", false otherwise |
Vec2 |
getNew()
Returns a new Vec2 = (0, 0) |
boolean |
isZero()
Returns: true if "this" is zero, 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" |
Vec2 |
mul(Mat2 m)
Returns: a new Vec2 that is "m*this" |
Vec2 |
Mul(Mat2 m)
Multiplies "this" to the left by "m" Returns: resulting "this" |
Vec2 |
neg()
Returns: a new Vec2 that is the opposite of "this" |
Vec2 |
Neg()
Negates "this" Returns: resulting "this" |
Vec2 |
para(Vec2 d)
Returns: a new Vec2 that is the component of "this" parallel to "d" Requires: "d" is not zero |
Vec2 |
Para(Vec2 d)
Isolates the component of "this" parallel to "d" Returns: resulting "this" Requires: "d" is not zero |
Vec2 |
paraunit(Vec2 d)
Returns: a new Vec2 that is the component of "this" parallel to "d" Requires: "d" has unit magnitude |
Vec2 |
ParaUnit(Vec2 d)
Isolates the component of "this" parallel to "d" Returns: resulting "this" Requires: "d" has unit magnitude |
Vec2 |
perp(Vec2 d)
Returns: a new Vec2 that is the component of "this" perpendicular to "d" Requires: "d" is not zero |
Vec2 |
Perp(Vec2 d)
Isolates the component of "this" perpendicular to "d" Returns: resulting "this" Requires: "d" is not zero |
Vec2 |
perpunit(Vec2 d)
Returns: a new Vec2 that is the component of "this" perpendicular to "d" Requires: "d" has unit magnitude |
Vec2 |
PerpUnit(Vec2 d)
Isolates the component of "this" perpendicular to "d" Returns: resulting "this" Requires: "d" has unit magnitude |
Vec2 |
rmul(Mat2 m)
Returns: a new Vec2 that is "this*m" |
Vec2 |
RMul(Mat2 m)
Multiplies "this" to the right by "m" Returns: resulting "this" |
Vec2 |
scale(double s)
Returns: a new Vec2 that is "s*this" |
Vec2 |
Scale(double s)
Scales "this" by "s" Returns: resulting "this" |
Vec2 |
scale(Vec2 v)
Returns: a new Vec2 that is "this" with its components scaled by "v" |
Vec2 |
Scale(Vec2 v)
Scales each component of "this" by the corresponding component of "v" Returns: resulting "this" |
Vec2 |
Set(double x,
double y)
Sets "this" to (x, y) Returns: resulting "this" |
Vec2 |
Set(Vec v)
Sets "this" to "v" Returns: resulting "this" Requires: "v" has dimension 2 |
Vec2 |
Set(Vec2 v)
Sets the value of "this" to that of "v" Returns: resulting "this" |
Vec2 |
SetZero()
Sets "this" to zero Returns: resulting "this" |
Vec2 |
sub(double x,
double y)
Returns: a new Vec2 that is the difference between "this" and (x, y) |
Vec2 |
Sub(double x,
double y)
Subtracts (x, y) from "this" Returns: resulting "this" |
Vec2 |
sub(Vec2 v)
Returns: a new Vec2 that is the difference between "this" and "v" |
Vec2 |
Sub(Vec2 v)
Subtracts "v" from "this" Returns: resulting "this" |
Vec |
toVec()
Returns: a new Vec that is < 2, "this" > |
javax.vecmath.Vector2d |
toVector2d()
Returns: a new Vector2d that equals "this" |
javax.vecmath.Vector2f |
toVector2f()
Returns: a new Vector2f that equals "this" |
Vec2 |
unit()
Returns: a new Vec2 that is "this" scaled to unit magnitude Requires: "this" is not zero |
Vec2 |
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 double x
public double y
public static Vec2 Zero
public static Vec2 Xhat
public static Vec2 Yhat
public static Vec2[] Cartesian
public static Vec2 Invalid
public static double tolerance
Constructor Detail |
public Vec2()
public Vec2(Vec2 v)
public Vec2(double x, double y)
public Vec2(Vec v)
Method Detail |
public Vec2 getNew()
public Vec2 copy()
public Vec2 Set(Vec2 v)
public Vec2 Set(double x, double y)
public Vec2 Set(Vec v)
public Vec2 SetZero()
public boolean isZero()
public boolean equals(Vec2 v)
public Vec2 Add(Vec2 v)
public Vec2 Add(double x, double y)
public Vec2 add(Vec2 v)
public Vec2 add(double x, double y)
public Vec2 AddScaled(Vec2 v, double s)
public Vec2 AddScaled(double x, double y, double s)
public Vec2 addscaled(Vec2 v, double s)
public Vec2 addscaled(double x, double y, double s)
public Vec2 Sub(Vec2 v)
public Vec2 Sub(double x, double y)
public Vec2 sub(Vec2 v)
public Vec2 sub(double x, double y)
public Vec2 Neg()
public Vec2 neg()
public double dot(Vec2 v)
public double dot(double x, double y)
public double len()
public double len2()
public double len3()
public Vec2 Scale(double s)
public Vec2 scale(double s)
public Vec2 Scale(Vec2 v)
public Vec2 scale(Vec2 v)
public Vec2 Unit()
public Vec2 unit()
public double cross(Vec2 b)
public Vec2 Para(Vec2 d)
public Vec2 para(Vec2 d)
public Vec2 ParaUnit(Vec2 d)
public Vec2 paraunit(Vec2 d)
public Vec2 Perp(Vec2 d)
public Vec2 perp(Vec2 d)
public Vec2 PerpUnit(Vec2 d)
public Vec2 perpunit(Vec2 d)
public Vec2 Mul(Mat2 m)
public Vec2 mul(Mat2 m)
public Vec2 RMul(Mat2 m)
public Vec2 rmul(Mat2 m)
public Vec toVec()
public javax.vecmath.Vector2d toVector2d()
public javax.vecmath.Vector2f toVector2f()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |