Interface Vector3d
- All Known Subinterfaces:
- MVector3d
public interface Vector3d
Read-only interface for 3-dimensional vectors.
- Since:
- 9.10.2
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Vector3dThe vector (-1, 0, 0).static final Vector3dThe vector (0, -1, 0).static final Vector3dThe vector (0, 0, -1).static final Vector3dThe vector (1, 0, 0).static final Vector3dThe vector (0, 1, 0).static final Vector3dThe vector (0, 0, 1).static final Vector3dThe vector (0, 0, 0).
- 
Method SummaryModifier and TypeMethodDescriptionReturns the sum of this vector and the given vector.doubleReturns the angle in radians between this vector and the given vector.static MVector3dcentroidOf(Collection<? extends Vector3d> vectors) Returns the centroid (the average vector) of the given collection of vectors.static Vector3dcreate(double x, double y, double z) Returns a new vector with the given component values.static Vector3dReturns a new vector with the component values of the given vector.crossProduct(Vector3d vector) Returns the cross product of this vector and the given vector.doubleReturns the distance between this vector and the given vector.doubledistanceSquared(Vector3d vector) Returns the squared distance between this vector and the given vector.doubledotProduct(Vector3d vector) Returns the dot product of this vector and the given vector.booleanequalsWithTolerance(Vector3d vector, double tolerance) Returns true if this vector is within tolerance of the given vector.doubleReturns the length of this vector.doubleReturns the squared length of this vector.doublegetX()Returns the X component of this vector.doublegetY()Returns the Y component of this vector.doublegetZ()Returns the Z component of this vector.interpolate(Vector3d vector, double alpha) Interpolates linearly between this vector and the given vector and returns the resulting vector.negate()Returns a negated copy of this vector.Returns a normalized copy of this vector.Returns an orthogonal projection of this vector on the given vector if it exists.scale(double scalar) Returns a copy of this vector scaled by the given scalar.Returns the difference between this vector and the given vector.Returns this vector projected onto the XY-plane.
- 
Field Details- 
ZEROThe vector (0, 0, 0).- Since:
- 9.10.2
 
- 
UNIT_XThe vector (1, 0, 0).- Since:
- 9.10.2
 
- 
NEG_UNIT_XThe vector (-1, 0, 0).- Since:
- 9.10.2
 
- 
UNIT_YThe vector (0, 1, 0).- Since:
- 9.10.2
 
- 
NEG_UNIT_YThe vector (0, -1, 0).- Since:
- 9.10.2
 
- 
UNIT_ZThe vector (0, 0, 1).- Since:
- 9.10.2
 
- 
NEG_UNIT_ZThe vector (0, 0, -1).- Since:
- 9.10.2
 
 
- 
- 
Method Details- 
createReturns a new vector with the component values of the given vector.- Parameters:
- vector- the vector whose component values are set to the new vector
- Returns:
- a new vector with the component values of the given vector
- Since:
- 9.10.2
 
- 
createReturns a new vector with the given component values.- Parameters:
- x- the x component value
- y- the y component value
- z- the z component value
- Returns:
- a new vector with the given component values
- Since:
- 9.10.2
 
- 
centroidOfReturns the centroid (the average vector) of the given collection of vectors.- Parameters:
- vectors- the vectors for which the centroid is computed
- Returns:
- the centroid of the given collection of vectors
- Since:
- 9.10.2
 
- 
angleReturns the angle in radians between this vector and the given vector. The return value is constrained to the range [0,PI].- Parameters:
- vector- the vector to which the angle is computed
- Returns:
- the the angle in radians between this vector and the given vector in the range [0,PI]
- Since:
- 9.10.2
 
- 
distanceReturns the distance between this vector and the given vector.- Parameters:
- vector- the vector to which the distance is computed
- Returns:
- the distance between this vector and the given vector
- Since:
- 9.10.2
 
- 
distanceSquaredReturns the squared distance between this vector and the given vector.- Parameters:
- vector- the vector to which the squared distance is computed
- Returns:
- the squared distance between this vector and the given vector
- Since:
- 9.10.2
 
- 
dotProductReturns the dot product of this vector and the given vector.- Parameters:
- vector- the vector with which the dot product is computed
- Returns:
- the dot product of this vector and the given vector
- Since:
- 9.10.2
 
- 
equalsWithToleranceReturns true if this vector is within tolerance of the given vector.- Parameters:
- vector- the vector with which this vector is compared for approximate equality
- tolerance- the allowed deviation between this vector and the given vector
- Returns:
- true if this vector is within tolerance of the given vector
- Since:
- 9.10.2
 
- 
getXdouble getX()Returns the X component of this vector.- Returns:
- the X component of this
- Since:
- 9.10.2
 
- 
getYdouble getY()Returns the Y component of this vector.- Returns:
- the Y component of this
- Since:
- 9.10.2
 
- 
getZdouble getZ()Returns the Z component of this vector.- Returns:
- the Z component of this
- Since:
- 9.10.2
 
- 
getLengthSquareddouble getLengthSquared()Returns the squared length of this vector.- Returns:
- the squared length of this vector
- Since:
- 9.10.2
 
- 
getLengthdouble getLength()Returns the length of this vector.- Returns:
- the length of this vector
- Since:
- 9.10.2
 
- 
crossProductReturns the cross product of this vector and the given vector.- Parameters:
- vector- the vector with which the cross product is computed
- Returns:
- the cross product of this vector and the given vector
- Since:
- 9.10.2
 
- 
subtractReturns the difference between this vector and the given vector.- Parameters:
- vector- the vector on the right side of the difference
- Returns:
- the difference between this vector and the given vector
- Since:
- 9.10.2
 
- 
scaleReturns a copy of this vector scaled by the given scalar.- Parameters:
- scalar- the scalar by which the returned vector is scaled
- Returns:
- a copy of this vector scaled by the given scalar
- Since:
- 9.10.2
 
- 
addReturns the sum of this vector and the given vector.- Parameters:
- vector- the vector that is added to this to create the returned vector
- Returns:
- the sum of this vector and the given vector
- Since:
- 9.10.2
 
- 
to2dVectorMVector2d to2dVector()Returns this vector projected onto the XY-plane.- Returns:
- this vector projected onto the XY-plane
- Since:
- 9.10.2
 
- 
normalizeMVector3d normalize()Returns a normalized copy of this vector. If this vector is of zero length, then returns a vector with all components set to NaN.- Returns:
- a normalized copy of this vector
- Since:
- 9.10.2
 
- 
negateMVector3d negate()Returns a negated copy of this vector.- Returns:
- a negated copy of this vector
- Since:
- 9.10.2
 
- 
interpolateInterpolates linearly between this vector and the given vector and returns the resulting vector. If the alpha value is greater than 1 it is set to 1 and if the alpha value is smaller than 0 it is set to 0. Example: If this vector and the given vector represent two points, the result of the interpolation is a point on the segment from this point to the given point which divides the segment with a ratios alpha, (1 - alpha), respectively.- Parameters:
- vector- the vector with which this is interpolated
- alpha- the interpolation factor
- Returns:
- a vector that is the interpolation between this vector and the given vector
- Since:
- 9.10.2
 
- 
projectReturns an orthogonal projection of this vector on the given vector if it exists.- Parameters:
- vector- the vector onto which this vector is to be projected orthogonally
- Returns:
- a vector that is the orthogonal projection of this vector onto the given vector; empty, if given vector is zero vector
- Since:
- 9.10.2
 
 
-