public class Vector extends Vector
Modifier and Type | Class and Description |
---|---|
static class |
Vector.ImmutableVector3d
A wrapper class for
Vector3d which makes the vector immutable. |
Modifier and Type | Field and Description |
---|---|
static Vector |
X
An immutable vector pointing in the (1,0,0)-direction.
|
static Vector |
Y
An immutable vector pointing in the (0,1,0)-direction.
|
static Vector |
Z
An immutable vector pointing in the (0,0,1)-direction.
|
Constructor and Description |
---|
Vector(double[] coords)
Construct a vector using the double-array as coordinates.
|
Vector(double x,
double y,
double z)
Construct a vector with the specified coordinates.
|
Vector(Point p)
Construct a vector pointing from origo to p.
|
Vector(Point p1,
Point p2)
Constructs a vector between two points p1 and p2 - added by pawel 12-11-2011
|
Vector(Vector v)
Construct a vector that is a clone of v.
|
Vector(Vector v)
Construct a vector that is a clone of v.
|
Modifier and Type | Method and Description |
---|---|
Vector |
add(Point p)
Add p to this vector and return the result (without changing this object).
|
Vector |
add(Vector v)
Add v to this vector and return the result (without changing this object).
|
Vector |
addThis(Point p)
Add p to this vector and return the result (changing this object).
|
Vector |
addThis(Vector v)
Add v to this vector and return the result (changing this object).
|
double |
angle(Vector v)
Get the angle between this vector and v.
|
Vector |
clone()
Create a clone of this vector.
|
Vector |
cross(Vector v)
Get the cross-product of this vector and v (without changing this object).
|
Vector |
crossThis(Vector v)
Get the cross-product of this vector and v and store the result in this vector (changes this object).
|
Vector |
divide(double s)
Divide this vector by s and return the result (without changing this object).
|
Vector |
divideThis(double s)
Divide this vector by s and return the result (changing this object).
|
double |
dot(Point p)
Get the dot-product of this vector and position vector to point p.
|
double |
dot(Vector v)
Get the dot-product of this vector and v.
|
static double |
getAngle(Vector u,
Vector v)
Get the angle between vector u and v.
|
static double |
getCosDihedralAngle(Vector u,
Vector v,
Vector w) |
static double |
getDihedralAngle(Vector b1,
Vector b2,
Vector b3)
Get the dihedral angle between 3 non-colinear vectors b1, b2, b3.
|
Vector |
getOrthogonal()
Get a vector (one of many possible) orthogonal (i.e., having arbitrary length) to vector v.
|
Vector |
getOrthonormal()
Get a vector (one of many possible) orthonormal to vector v (v is assumed to be unit a vector).
|
boolean |
isParallel(Vector v) |
boolean |
isSteinerAngle(Vector v) |
static void |
main(java.lang.String[] args) |
Vector |
multiply(double s)
Multiply this vector by s and return the result (without changing this object).
|
Vector |
multiply(Vector v) |
Vector |
multiplyThis(double s)
Multiply this vector by s and return the result (changing this object).
|
Vector |
normalize()
Normalize this vector and return the result (without changing this object).
|
Vector |
normalizeFast() |
Vector |
normalizeThis()
Normalize this vector and return the result (changing this object).
|
Vector |
normalizeThisFast() |
Vector |
rotateIn(Vector v,
double angle)
Perform a right-handed rotation of v around this vector.
|
void |
rotation(Vector v,
double alpha)
rotates (clockwise) the vector around the line through the origo with the direction unit vector v.
|
Vector |
scaleToLength(double length)
Scale this vector to a certain length (returns new object and does not change this object).
|
Vector |
scaleToLengthThis(double length)
Scale this vector to a certain length (changes this object).
|
void |
set(Vector v)
Set all coordinates of this vector equal to those of v
|
void |
setX(double x)
Set the first coordinate
|
void |
setY(double y)
Set the second coordinate
|
void |
setZ(double z)
Set the third coordinate
|
Vector |
subtract(Vector v)
Subtract v from this vector and return the result (without changing this object).
|
Vector |
subtractThis(Vector v)
Subract v from this vector and return the result (changing this object).
|
void |
toConsole()
Writes this vector to
System.out . |
void |
toConsole(int dec)
Writes this vector to
System.out with dec decimals precision. |
Point |
toPoint()
Convert this vector to a point.
|
java.lang.String |
toString()
Returns a string-representation of this vector formatted with two decimals precision.
|
java.lang.String |
toString(int dec)
Returns a string-representation of this vector formatted with
dec decimals precision. |
double |
x()
Get the first coordinate.
|
double |
y()
Get the second coordinate.
|
double |
z()
Get the third coordinate.
|
add, addThis, angle, dot, equals, equals, get, getCoord, getDimensions, getLengthSquared, isZeroVector, length, outerProduct, randomVector, set, setCoord, setCoords, subtract, subtractThis
public static Vector X
public static Vector Y
public static Vector Z
public Vector(double x, double y, double z)
public Vector(Point p)
public Vector(Point p1, Point p2)
public Vector(Vector v)
public Vector(Vector v)
public Vector(double[] coords)
public double x()
public double y()
public double z()
public void setX(double x)
public void setY(double y)
public void setZ(double z)
public void set(Vector v)
public double dot(Vector v)
public double dot(Point p)
public double angle(Vector v)
public Vector add(Vector v)
public Vector addThis(Vector v)
public Vector add(Point p)
public Vector addThis(Point p)
public Vector subtract(Vector v)
public Vector subtractThis(Vector v)
public Vector multiply(double s)
public Vector multiplyThis(double s)
multiplyThis
in class Vector
public Vector divide(double s)
public Vector divideThis(double s)
divideThis
in class Vector
public Vector normalize()
public Vector normalizeThis()
normalizeThis
in class Vector
public Vector normalizeFast()
public Vector normalizeThisFast()
public Vector scaleToLength(double length)
scaleToLength
in class Vector
public Vector scaleToLengthThis(double length)
scaleToLengthThis
in class Vector
public Vector cross(Vector v)
public Vector crossThis(Vector v)
public void rotation(Vector v, double alpha)
public Vector rotateIn(Vector v, double angle)
public java.lang.String toString()
public java.lang.String toString(int dec)
dec
decimals precision.public void toConsole()
System.out
.public void toConsole(int dec)
System.out
with dec
decimals precision.public static double getDihedralAngle(Vector b1, Vector b2, Vector b3)
public Vector getOrthonormal()
public Vector getOrthogonal()
public boolean isParallel(Vector v)
public boolean isSteinerAngle(Vector v)
public static void main(java.lang.String[] args)