public class Vector3D extends Object
| Constructor and Description | 
|---|
Vector3D()
Empty constructor, with all coordinates initialized to zero. 
 | 
Vector3D(double x,
        double y,
        double z)
Initialization constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
almostEquals(Vector3D v,
            double eps)
Checks if this vector is close to the given vector, by checking each
 coordinate using the given threshold. 
 | 
static double | 
angle(Vector3D v1,
     Vector3D v2)
Computes the angle between two 3D vectors. 
 | 
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 two vectors, defined by: 
 | 
double | 
getNorm()
Computes the norm of the vector, given as the square root of the sum
 of squared coordinates. 
 | 
double | 
getX()
Returns the x coordinate of the vector. 
 | 
double | 
getY()
Returns the y coordinate of the vector. 
 | 
double | 
getZ()
Returns the z coordinate of the vector. 
 | 
Vector3D | 
minus(Vector3D v)
Returns the result of the subtraction of this vector with another vector. 
 | 
Vector3D | 
normalize()
Returns a normalized vector with same direction as this vector 
 | 
Vector3D | 
plus(Vector3D v)
Returns the result of the addition of this vector with another vector. 
 | 
Vector3D | 
times(double k)
Returns the result of the multiplication of this vector with a scalar value. 
 | 
public Vector3D()
public Vector3D(double x,
                double y,
                double z)
x - the x coordinatey - the y coordinatez - the z coordinatepublic static final Vector3D crossProduct(Vector3D v1, Vector3D v2)
v1 - the first vectorv2 - the second vectorpublic static final double dotProduct(Vector3D v1, Vector3D v2)
  x1 * x2 + y1 * y2 + z1 * z2
 
Dot product is zero if the vectors are orthogonal. It is positive if vectors are in the same direction, and negative if they are in opposite direction.
v1 - the first vectorv2 - the second vectorpublic static final double angle(Vector3D v1, Vector3D v2)
v1 - the first vectorv2 - the second vectorpublic double getX()
public double getY()
public double getZ()
public Vector3D plus(Vector3D v)
v - the vector to addpublic Vector3D minus(Vector3D v)
v - the vector to subtractpublic Vector3D times(double k)
k - the scalar coefficientpublic Vector3D normalize()
public double getNorm()
public boolean almostEquals(Vector3D v, double eps)
v - the vector to compare toeps - the absolute tolerance for comparing coodinatesCopyright © 2014–2023 INRA-IJPB Modeling and Digital Imaging lab. All rights reserved.