|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.numerics.Vec3D
public class Vec3D
A 3-element vector that is represented by double-precision floating point x,y,z coordinates.
Field Summary | |
---|---|
double |
x
|
double |
y
|
double |
z
|
Constructor Summary | |
---|---|
Vec3D()
Constructs and initializes it to (0,0,0). |
|
Vec3D(double[] v)
Constructs and initializes a Vector3d from the array of length 3. |
|
Vec3D(double x,
double y,
double z)
Constructs and initializes a Vector3d from the specified xyz coordinates. |
|
Vec3D(Vec3D v1)
Constructs and initializes a Vector3d from the specified Vector3d. |
Method Summary | |
---|---|
void |
add(Vec3D v1,
Vec3D v2)
Sets this vector to the vector addition of vectors v1 and v2. |
double |
angle(Vec3D v1)
Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0,PI]. |
void |
cross(Vec3D v1,
Vec3D v2)
Sets this vector to the vector cross product of vectors v1 and v2. |
double |
dot(Vec3D v1)
Returns the dot product of this vector and vector v1. |
double |
magnitude()
Returns the magnitude of this vector. |
double |
magnitudeSquared()
Returns the squared magnitude of this vector. |
void |
multiply(Vec3D v1,
double number)
Sets this vector to the multiplication of vector v1 and a scalar number |
void |
normalize()
Normalizes this vector in place. |
void |
subtract(Vec3D v1,
Vec3D v2)
Sets this vector to the vector subtraction of vectors v1 and v2. |
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 double z
Constructor Detail |
---|
public Vec3D(double x, double y, double z)
x
- the x coordinatey
- the y coordinatez
- the z coordinatepublic Vec3D(double[] v)
v
- the array of length 3 containing xyz in orderpublic Vec3D(Vec3D v1)
v1
- the Vector3d containing the initialization x y z datapublic Vec3D()
Method Detail |
---|
public final void subtract(Vec3D v1, Vec3D v2)
v1
- the first vectorv2
- the second vectorpublic final void add(Vec3D v1, Vec3D v2)
v1
- the first vectorv2
- the second vectorpublic void cross(Vec3D v1, Vec3D v2)
v1
- the first vectorv2
- the second vectorpublic void multiply(Vec3D v1, double number)
v1
- the vectornumber
- to multiply v1public final void normalize()
public final double dot(Vec3D v1)
v1
- the other vector
public final double magnitudeSquared()
public final double magnitude()
public final double angle(Vec3D v1)
v1
- the other vector
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |