public class Vec2d extends AbstractDoubleVec<Vec2d>
Describes a vector in 2 dimensional space.
- Author:
- Dr. Peter Droste, Omix Visualization
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description Vec2d
dot(double m)
Scalingdouble
dot(Vec2d multiplicator)
Scalar productboolean
equals(Object obj)
Determines if the vector is equals another objectdouble
getAngle(Vec2d coordinate)
Computes the angle between two vectors.double
getLength()
Length of the vectordouble
getX()
returns X componentdouble
getY()
returns Y componentboolean
isInfinite()
Determines if one coordinate component is infinity.boolean
isNaN()
Determines if one coordinate component is NaN.Vec2d
minus(Vec2d v)
SubtractionVec2d
negate()
NegationVec2d
normalize()
NormalizationVec2d
plus(Vec2d v)
AdditionVec2d
rotate(double angle)
Rotates the vector.void
set(Vec2d c)
Change the coordinates of this vector.
this := cvoid
setX(double x)
Changes the X coordinatevoid
setY(double y)
Changes the Y coordinatedouble[]
toDouble()
Returns the vector as double array.float[]
toFloat()
Returns the vector as float array.String
toString()
-
Constructor Details
-
Method Details
-
equals
Description copied from class:AbstractVec
Determines if the vector is equals another object- Specified by:
equals
in classAbstractVec<Vec2d>
- Returns:
- this==object
- See Also:
AbstractVec.equals(java.lang.Object)
-
set
Description copied from class:AbstractVec
Change the coordinates of this vector.
this := c- Specified by:
set
in classAbstractVec<Vec2d>
- See Also:
AbstractVec.set(omix.util.math.vector.AbstractVec)
-
getX
public double getX()returns X component- Returns:
- x
-
getY
public double getY()returns Y component- Returns:
- y
-
plus
Description copied from class:AbstractVec
Addition- Specified by:
plus
in classAbstractVec<Vec2d>
- Returns:
- this+v
- See Also:
AbstractVec.plus(omix.util.math.vector.AbstractVec)
-
minus
Description copied from class:AbstractVec
Subtraction- Specified by:
minus
in classAbstractVec<Vec2d>
- Returns:
- this-v
- See Also:
AbstractVec.minus(omix.util.math.vector.AbstractVec)
-
dot
Description copied from class:AbstractDoubleVec
Scaling- Specified by:
dot
in classAbstractDoubleVec<Vec2d>
- Returns:
- this⋅m
- See Also:
AbstractDoubleVec.dot(double)
-
dot
Description copied from class:AbstractDoubleVec
Scalar product- Specified by:
dot
in classAbstractDoubleVec<Vec2d>
- Returns:
- this⋅multiplicator
- See Also:
AbstractDoubleVec.dot(omix.util.math.vector.AbstractDoubleVec)
-
normalize
Description copied from class:AbstractVec
Normalization- Specified by:
normalize
in classAbstractVec<Vec2d>
- Returns:
- this / |this|
- See Also:
AbstractVec.normalize()
-
negate
Description copied from class:AbstractVec
Negation- Specified by:
negate
in classAbstractVec<Vec2d>
- Returns:
- -this
- See Also:
AbstractVec.negate()
-
getLength
public double getLength()Description copied from class:AbstractDoubleVec
Length of the vector- Specified by:
getLength
in classAbstractDoubleVec<Vec2d>
- Returns:
- |this|
- See Also:
AbstractDoubleVec.getLength()
-
rotate
Rotates the vector.- Parameters:
angle
-- Returns:
- the rotated vector
-
isNaN
public boolean isNaN()Description copied from class:AbstractVec
Determines if one coordinate component is NaN.- Specified by:
isNaN
in classAbstractVec<Vec2d>
- 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<Vec2d>
- Returns:
- is infinity
- See Also:
AbstractVec.isInfinite()
-
toString
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
getAngle
Description copied from class:AbstractDoubleVec
Computes the angle between two vectors.- Specified by:
getAngle
in classAbstractDoubleVec<Vec2d>
- Returns:
- angle in radians
- See Also:
AbstractDoubleVec.getAngle(omix.util.math.vector.AbstractDoubleVec)
-
toDouble
public double[] toDouble()Description copied from class:AbstractVec
Returns the vector as double array.- Specified by:
toDouble
in classAbstractVec<Vec2d>
- 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<Vec2d>
- Returns:
- new float[]{...}
- See Also:
AbstractVec.toFloat()
-
setX
public void setX(double x)Changes the X coordinate- Parameters:
x
- the x to set
-
setY
public void setY(double y)Changes the Y coordinate- Parameters:
y
- the y to set
-