Package jadex.extension.envsupport.math
Interface IVector2
- 
- All Known Implementing Classes:
- SynchronizedVector2Wrapper,- Vector2Double,- Vector2Int
 
 public interface IVector2Interface for cartesian 2-vectors NOTE: All operations on the vector are destructive and the instance returned is the same as the one whose method was called. If you require a copy of the vector before performing operations on it, use the copy constructor, the copy method or the clone interface.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description IVector2add(double scalar)Adds a scalar to each component of this vector.IVector2add(IVector1 scalar)Adds a scalar to each component of this vector.IVector2add(IVector2 vector)Adds another vector to this vector, adding individual components.IVector2assign(IVector2 vector)Assigns this vector the values of another vector.java.lang.Objectclone()Generates a deep clone of the vector.IVector2copy()Makes a copy of the vector without using the complex clone interface.IVector2divide(IVector2 vector)Performs a division on the vector.booleanequals(IVector2 vector)Compares the vector to another vector.booleanequals(java.lang.Object obj)Compares the vector to an objectIVector1getDirection()Returns the direction (theta) of the vector.IVector1getDirection(IVector2 vector)Returns the direction (theta) of the vector.doublegetDirectionAsDouble()Returns the direction (theta) of the vector as double.doublegetDirectionAsDouble(IVector2 vector)Returns the direction (theta) of the vector as double.floatgetDirectionAsFloat()Returns the direction (theta) of the vector as float.floatgetDirectionAsFloat(IVector2 vector)Returns the direction (theta) of the vector as float.IVector1getDistance(IVector2 vector)Returns the distance to another vector.doublegetInnerProductAsDouble(IVector2 vector)Returns the length (magnitude) of the vector.IVector1getLength()Returns the length (magnitude) of the vector.IVector1getMean()Returns the mean average of the vector components.IVector1getSquaredLength()Returns the squared length (magnitude) of the vector.IVector1getX()Returns the x-component of the vector.java.math.BigDecimalgetXAsBigDecimal()Returns the x-component of the vector as BigDecimal.doublegetXAsDouble()Returns the x-component of the vector as double.floatgetXAsFloat()Returns the x-component of the vector as float.intgetXAsInteger()Returns the x-component of the vector as integer.longgetXAsLong()Returns the x-component of the vector as long.IVector1getY()Returns the y-component of the vector.java.math.BigDecimalgetYAsBigDecimal()Returns the component of the vector as BigDecima;.doublegetYAsDouble()Returns the component of the vector as double.floatgetYAsFloat()Returns the component of the vector as float.intgetYAsInteger()Returns the component of the vector as integer.longgetYAsLong()Returns the component of the vector as float.IVector2mod(IVector2 modulus)Applies a modulo vector.IVector2multiply(double scalar)Performs a scalar multiplication (scaling) on the vector.IVector2multiply(IVector1 scalar)Performs a scalar multiplication (scaling) on the vector.IVector2multiply(IVector2 vector)Performs a multiplication on the vector.IVector2negate()Negates the vector by negating its components.IVector2negateX()Negates the x-component.IVector2negateY()Negates the y-component.IVector2normalize()Converts the vector to a unit vector (normalization)IVector2randomX(IVector1 lower, IVector1 upper)Sets the x-component to a random value in the interval [lower,upper]IVector2randomY(IVector1 lower, IVector1 upper)Sets the y-component to a random value in the interval [lower,upper]IVector2redirect(double angle)Redirects the vector to a new direction, maintaining the magnitude.IVector2subtract(double scalar)Subtracts a scalar to each component of this vector.IVector2subtract(IVector1 scalar)Subtracts a scalar to each component of this vector.IVector2subtract(IVector2 vector)Subtracts another vector to this vector, subtracting individual components.IVector2zero()Sets all vector components to zero.
 
- 
- 
- 
Method Detail- 
assignIVector2 assign(IVector2 vector) Assigns this vector the values of another vector.- Parameters:
- vector- the other vector
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
addIVector2 add(double scalar) Adds a scalar to each component of this vector.- Parameters:
- scalar- scalar value as double
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
addIVector2 add(IVector1 scalar) Adds a scalar to each component of this vector.- Parameters:
- scalar- scalar value
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
addIVector2 add(IVector2 vector) Adds another vector to this vector, adding individual components.- Parameters:
- vector- the vector to add to this vector
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
subtractIVector2 subtract(double scalar) Subtracts a scalar to each component of this vector.- Parameters:
- scalar- scalar value as double
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
subtractIVector2 subtract(IVector1 scalar) Subtracts a scalar to each component of this vector.- Parameters:
- scalar- scalar value
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
subtractIVector2 subtract(IVector2 vector) Subtracts another vector to this vector, subtracting individual components.- Parameters:
- vector- the vector to subtract from this vector
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
modIVector2 mod(IVector2 modulus) Applies a modulo vector. The modulus will be added first so that values in the interval (-modulus, 0) will wrap over into the positive range.- Parameters:
- modulus- modulus
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
multiplyIVector2 multiply(double scalar) Performs a scalar multiplication (scaling) on the vector.- Parameters:
- scalar- the scale factor double
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
multiplyIVector2 multiply(IVector1 scalar) Performs a scalar multiplication (scaling) on the vector.- Parameters:
- scalar- the scale factor
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
multiplyIVector2 multiply(IVector2 vector) Performs a multiplication on the vector.- Parameters:
- vector- vector
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
divideIVector2 divide(IVector2 vector) Performs a division on the vector.- Parameters:
- vector- vector
- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
zeroIVector2 zero() Sets all vector components to zero.- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
negateXIVector2 negateX() Negates the x-component.- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
negateYIVector2 negateY() Negates the y-component.- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
negateIVector2 negate() Negates the vector by negating its components.- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
randomXIVector2 randomX(IVector1 lower, IVector1 upper) Sets the x-component to a random value in the interval [lower,upper]- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
randomYIVector2 randomY(IVector1 lower, IVector1 upper) Sets the y-component to a random value in the interval [lower,upper]- Returns:
- a reference to the called vector (NOT a copy)
 
 - 
normalizeIVector2 normalize() Converts the vector to a unit vector (normalization)
 - 
redirectIVector2 redirect(double angle) Redirects the vector to a new direction, maintaining the magnitude.- Parameters:
- angle- The new direction.
- Returns:
- The vector.
 
 - 
getInnerProductAsDoubledouble getInnerProductAsDouble(IVector2 vector) Returns the length (magnitude) of the vector.- Returns:
- vector length
 
 - 
getLengthIVector1 getLength() Returns the length (magnitude) of the vector.- Returns:
- vector length
 
 - 
getSquaredLengthIVector1 getSquaredLength() Returns the squared length (magnitude) of the vector.- Returns:
- squared vector length
 
 - 
getDirectionIVector1 getDirection(IVector2 vector) Returns the direction (theta) of the vector.- Returns:
- vector direction
 
 - 
getDirectionAsFloatfloat getDirectionAsFloat(IVector2 vector) Returns the direction (theta) of the vector as float.- Returns:
- vector direction as float
 
 - 
getDirectionAsDoubledouble getDirectionAsDouble(IVector2 vector) Returns the direction (theta) of the vector as double.- Returns:
- vector direction as double
 
 - 
getDirectionIVector1 getDirection() Returns the direction (theta) of the vector.- Returns:
- vector direction
 
 - 
getDirectionAsFloatfloat getDirectionAsFloat() Returns the direction (theta) of the vector as float.- Returns:
- vector direction as float
 
 - 
getDirectionAsDoubledouble getDirectionAsDouble() Returns the direction (theta) of the vector as double.- Returns:
- vector direction as double
 
 - 
getMeanIVector1 getMean() Returns the mean average of the vector components.- Returns:
- vector direction
 
 - 
getDistanceIVector1 getDistance(IVector2 vector) Returns the distance to another vector.- Parameters:
- vector- other vector
- Returns:
- distance
 
 - 
getXIVector1 getX() Returns the x-component of the vector.- Returns:
- x-component
 
 - 
getYIVector1 getY() Returns the y-component of the vector.- Returns:
- y-component
 
 - 
getXAsIntegerint getXAsInteger() Returns the x-component of the vector as integer.- Returns:
- x-component as integer
 
 - 
getYAsIntegerint getYAsInteger() Returns the component of the vector as integer.- Returns:
- y-component as float
 
 - 
getXAsLonglong getXAsLong() Returns the x-component of the vector as long.- Returns:
- x-component as long
 
 - 
getYAsLonglong getYAsLong() Returns the component of the vector as float.- Returns:
- y-component as float
 
 - 
getXAsFloatfloat getXAsFloat() Returns the x-component of the vector as float.- Returns:
- x-component as float
 
 - 
getYAsFloatfloat getYAsFloat() Returns the component of the vector as float.- Returns:
- y-component as float
 
 - 
getXAsDoubledouble getXAsDouble() Returns the x-component of the vector as double.- Returns:
- x-component as double
 
 - 
getYAsDoubledouble getYAsDouble() Returns the component of the vector as double.- Returns:
- y-component as double
 
 - 
getXAsBigDecimaljava.math.BigDecimal getXAsBigDecimal() Returns the x-component of the vector as BigDecimal.- Returns:
- x-component as BigDecimal
 
 - 
getYAsBigDecimaljava.math.BigDecimal getYAsBigDecimal() Returns the component of the vector as BigDecima;.- Returns:
- y-component as BigDecimal
 
 - 
copyIVector2 copy() Makes a copy of the vector without using the complex clone interface.- Returns:
- copy of the vector
 
 - 
clonejava.lang.Object clone() throws java.lang.CloneNotSupportedExceptionGenerates a deep clone of the vector.- Returns:
- clone of this vector
- Throws:
- java.lang.CloneNotSupportedException
 
 - 
equalsboolean equals(java.lang.Object obj) Compares the vector to an object- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- obj- the object
- Returns:
- always returns false unless the object is an IVector2, in which case it is equivalent to equals(IVector vector)
 
 - 
equalsboolean equals(IVector2 vector) Compares the vector to another vector. The vectors are equal if the components are equal.- Parameters:
- vector- the other vector
- Returns:
- true if the vectors are equal
 
 
- 
 
-