public class Vec4d extends AbstractDoubleVec<Vec4d>
Describes a vector in 3 dimensional space (homogeneous coordinates).
- Author:
- Dr. Peter Droste, Omix Visualization
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description int
closest(Vec4d[] vecs)
Returns the index of the vector closest to this.Vec4d
copy()
Clones the coordinateVec4d
cross(Vec4d c)
Cross productVec4d
dot(double multiplicator)
Scalingdouble
dot(Vec4d multiplicator)
Scalar productboolean
equals(Object obj)
Determines if the vector is equals another objectdouble
getAngle(Vec4d coordinate)
Computes the angle between two vectors.double
getLength()
Length of the vectordouble
getW()
double
getX()
double
getY()
double
getZ()
boolean
isComplementOf(Vec4d cc)
Determines if this is complement of given vector.boolean
isDirection()
Determines if vector describes direction or location.boolean
isInfinite()
Determines if one coordinate component is infinity.boolean
isLocation()
Determines if vector describes direction or location.boolean
isNaN()
Determines if one coordinate component is NaN.Vec4d
minus(Vec4d cc)
SubtractionVec4d
negate()
NegationVec4d
normalize()
NormalizationVec4d
plus(Vec4d cc)
Additionvoid
set(double x, double y, double z, double w)
Change the single coordinates of this vector.void
set(Vec4d c)
Change the coordinates of this vector.
this := cvoid
setW(double w)
void
setX(double x)
void
setY(double y)
void
setZ(double z)
double[]
toDouble()
Returns the vector as double array.float[]
toFloat()
Returns the vector as float array.String
toString()
-
Constructor Details
-
Method Details
-
isDirection
public boolean isDirection()Determines if vector describes direction or location.- Returns:
- true if direction.
-
isLocation
public boolean isLocation()Determines if vector describes direction or location.- Returns:
- true if location.
-
getX
public double getX() -
getY
public double getY() -
getZ
public double getZ() -
getW
public double getW() -
setX
public void setX(double x) -
setY
public void setY(double y) -
setZ
public void setZ(double z) -
setW
public void setW(double w) -
set
Description copied from class:AbstractVec
Change the coordinates of this vector.
this := c- Specified by:
set
in classAbstractVec<Vec4d>
- See Also:
AbstractVec.set(omix.util.math.vector.AbstractVec)
-
set
public void set(double x, double y, double z, double w)Change the single coordinates of this vector.- Parameters:
x
-y
-z
-w
-
-
copy
Clones the coordinate- Returns:
- T
-
dot
Description copied from class:AbstractDoubleVec
Scalar product- Specified by:
dot
in classAbstractDoubleVec<Vec4d>
- Returns:
- this⋅multiplicator
- See Also:
AbstractDoubleVec.dot(omix.util.math.vector.AbstractDoubleVec)
-
normalize
Description copied from class:AbstractVec
Normalization- Specified by:
normalize
in classAbstractVec<Vec4d>
- Returns:
- this / |this|
- See Also:
AbstractVec.normalize()
-
negate
Description copied from class:AbstractVec
Negation- Specified by:
negate
in classAbstractVec<Vec4d>
- Returns:
- -this
- See Also:
AbstractVec.negate()
-
plus
Description copied from class:AbstractVec
Addition- Specified by:
plus
in classAbstractVec<Vec4d>
- Returns:
- this+v
- See Also:
AbstractVec.plus(omix.util.math.vector.AbstractVec)
-
dot
Description copied from class:AbstractDoubleVec
Scaling- Specified by:
dot
in classAbstractDoubleVec<Vec4d>
- Returns:
- this⋅m
- See Also:
AbstractDoubleVec.dot(double)
-
minus
Description copied from class:AbstractVec
Subtraction- Specified by:
minus
in classAbstractVec<Vec4d>
- Returns:
- this-v
- See Also:
AbstractVec.minus(omix.util.math.vector.AbstractVec)
-
cross
Cross product- Parameters:
c
-- Returns:
- a new vector representing the cross product: this × c
-
isComplementOf
Determines if this is complement of given vector.- Parameters:
cc
-- Returns:
- complement?
-
getLength
public double getLength()Description copied from class:AbstractDoubleVec
Length of the vector- Specified by:
getLength
in classAbstractDoubleVec<Vec4d>
- Returns:
- |this|
- See Also:
AbstractDoubleVec.getLength()
-
getAngle
Description copied from class:AbstractDoubleVec
Computes the angle between two vectors.- Specified by:
getAngle
in classAbstractDoubleVec<Vec4d>
- Returns:
- angle in radians
- See Also:
AbstractDoubleVec.getAngle(omix.util.math.vector.AbstractDoubleVec)
-
equals
Description copied from class:AbstractVec
Determines if the vector is equals another object- Specified by:
equals
in classAbstractVec<Vec4d>
- Returns:
- this==object
- See Also:
AbstractVec.equals(java.lang.Object)
-
toString
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
toDouble
public double[] toDouble()Description copied from class:AbstractVec
Returns the vector as double array.- Specified by:
toDouble
in classAbstractVec<Vec4d>
- Returns:
- new double[]{...}
- See Also:
AbstractVec.toDouble()
-
toFloat
public float[] toFloat()Description copied from class:AbstractVec
Returns the vector as float array.- Specified by:
toFloat
in classAbstractVec<Vec4d>
- Returns:
- new float[]{...}
- See Also:
AbstractVec.toFloat()
-
closest
Returns the index of the vector closest to this.- Parameters:
vecs
- array of vectors.- Returns:
- the closest of the given vectors
-
isNaN
public boolean isNaN()Description copied from class:AbstractVec
Determines if one coordinate component is NaN.- Specified by:
isNaN
in classAbstractVec<Vec4d>
- Returns:
- is NaN
- See Also:
AbstractVec.isNaN()
-
isInfinite
public boolean isInfinite()Description copied from class:AbstractVec
Determines if one coordinate component is infinity.- Specified by:
isInfinite
in classAbstractVec<Vec4d>
- Returns:
- is infinity
- See Also:
AbstractVec.isInfinite()
-