public class Vector3D extends Object
Immutable.
| Modifier and Type | Field and Description |
|---|---|
protected double |
x |
protected double |
y |
protected double |
z |
| Constructor and Description |
|---|
Vector3D()
Constructs a new Vector3D initialized with x=1, y=0 and z=0.
|
Vector3D(double x,
double y,
double z)
Base constructor, using coordinates in each direction.
|
Vector3D(Point3D point)
Construct a new vector between origin and a 3D point.
|
Vector3D(Point3D point1,
Point3D point2)
construct a new vector between two points, the vector is leading from the 'point1' to 'point2'.
|
Vector3D(javax.vecmath.Vector3d vector) |
| Modifier and Type | Method and Description |
|---|---|
javax.vecmath.Vector3d |
asVector3d() |
static Vector3D |
crossProduct(Vector3D v1,
Vector3D v2)
Computes the cross product of the two vectors.
|
static double |
dotProduct(Vector3D v1,
Vector3D v2)
Computes the dot product of the two vectors, defined by :
x1*x2 + y1*y2 + z1*z2
Dot product is zero if the vectors defined by the 2 vectors are
orthogonal. |
boolean |
equals(Object obj) |
double |
getLength()
Alias for
getNorm(). |
double |
getNorm()
Computes the norm of the vector
|
Vector3D |
getNormalizedVector()
Returns the vector with same direction as this one, but with norm equal
to 1.
|
double |
getNormSq()
Computes the square of the norm of the vector.
|
Vector3D |
getOpposite()
Returns the opposite vector v2 of this, such that the sum of this and v2
equals the null vector.
|
double |
getX() |
double |
getY() |
double |
getZ() |
static boolean |
isColinear(Vector3D v1,
Vector3D v2)
test if the two vectors are colinear
|
static boolean |
isOrthogonal(Vector3D v1,
Vector3D v2)
test if the two vectors are orthogonal
|
Vector3D |
minus(Vector3D v)
Return the subtraction of current vector with vector given as parameter.
|
void |
normalize()
Deprecated.
Point3D shall be immutable
|
Vector3D |
plus(Vector3D v)
Return the sum of current vector with vector given as parameter.
|
void |
setVector(double x,
double y,
double z)
Deprecated.
Point3D shall be immutable
|
void |
setX(double x)
Deprecated.
Point3D shall be immutable
|
void |
setY(double y)
Deprecated.
Point3D shall be immutable
|
void |
setZ(double z)
Deprecated.
Point3D shall be immutable
|
Vector3D |
times(double k)
Multiplies this vector by a constant.
|
String |
toString() |
Vector3D |
transform(AffineTransform3D trans)
Transform the vector, by using only the first 4 parameters of the
transform.
|
public Vector3D()
public Vector3D(double x,
double y,
double z)
public Vector3D(javax.vecmath.Vector3d vector)
public Vector3D(Point3D point)
public static final double dotProduct(Vector3D v1, Vector3D v2)
x1*x2 + y1*y2 + z1*z2
Dot product is zero if the vectors defined by the 2 vectors are orthogonal. It is positive if vectors are in the same direction, and negative if they are in opposite direction.
public static final Vector3D crossProduct(Vector3D v1, Vector3D v2)
public static final boolean isColinear(Vector3D v1, Vector3D v2)
public static final boolean isOrthogonal(Vector3D v1, Vector3D v2)
public double getX()
@Deprecated public void setX(double x)
public double getY()
@Deprecated public void setY(double y)
public double getZ()
@Deprecated public void setZ(double z)
@Deprecated public void setVector(double x, double y, double z)
public Vector3D plus(Vector3D v)
public Vector3D minus(Vector3D v)
public Vector3D times(double k)
public Vector3D getOpposite()
this.public double getNorm()
public double getLength()
getNorm().public double getNormSq()
@Deprecated public void normalize()
public Vector3D getNormalizedVector()
public Vector3D transform(AffineTransform3D trans)
trans - an affine transformpublic javax.vecmath.Vector3d asVector3d()
Copyright © 2018 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All rights reserved.