Package jadex.extension.envsupport.math
Class Vector3Int
- java.lang.Object
-
- jadex.extension.envsupport.math.Vector3Int
-
-
Constructor Summary
Constructors Constructor Description Vector3Int()
Creates a new Vector3Int with the value (0,0,0).Vector3Int(int scalar)
Creates a new Vector3Int using the scalar to assign the value (scalar,scalar).Vector3Int(int x, int y, int z)
Creates a new Vector3Int with the given value.Vector3Int(IVector3 vector)
Creates a new Vector3 with the same value as the input vector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IVector3
add(double scalar)
Adds a scalar to each component of this vector.IVector3
add(IVector1 scalar)
Adds a scalar to each component of this vector.IVector3
add(IVector3 vector)
Adds another vector to this vector, adding individual components.IVector3
assign(IVector3 vector)
Assigns this vector the values of another vector.java.lang.Object
clone()
Generates a deep clone of the vector.IVector3
copy()
Makes a copy of the vector without using the complex clone interface.IVector3
divide(IVector3 vector)
Performs a division on the vector.boolean
equals(IVector3 vector)
Compares the vector to another vector.IVector2
getDirection()
Returns the direction of the vector.IVector1
getDistance(IVector3 vector)
Returns the distance to another vector.IVector1
getLength()
Returns the length (magnitude) of the vector.IVector1
getX()
Returns the x-component of the vector.java.math.BigDecimal
getXAsBigDecimal()
Returns the x-component of the vector as BigDecimal.double
getXAsDouble()
Returns the x-component of the vector as double.float
getXAsFloat()
Returns the x-component of the vector as float.int
getXAsInteger()
Returns the x-component of the vector as integer.long
getXAsLong()
Returns the x-component of the vector as long.IVector1
getY()
Returns the y-component of the vector.java.math.BigDecimal
getYAsBigDecimal()
Returns the y-component of the vector as BigDecimal.double
getYAsDouble()
Returns the y-component of the vector as double.float
getYAsFloat()
Returns the y-component of the vector as float.int
getYAsInteger()
Returns the y-component of the vector as integer.long
getYAsLong()
Returns the y-component of the vector as long.IVector1
getZ()
Returns the z-component of the vector.java.math.BigDecimal
getZAsBigDecimal()
Returns the z-component of the vector as BigDecimal.double
getZAsDouble()
Returns the z-component of the vector as double.float
getZAsFloat()
Returns the z-component of the vector as float.int
getZAsInteger()
Returns the z-component of the vector as integer.long
getZAsLong()
Returns the z-component of the vector as long.IVector3
mod(IVector3 modulus)
Applies a modulo vector.IVector3
multiply(double scalar)
Performs a scalar multiplication (scaling) on the vector.IVector3
multiply(IVector1 scalar)
Performs a scalar multiplication (scaling) on the vector.IVector3
multiply(IVector3 vector)
Performs a multiplication on the vector.IVector3
negate()
Negates the vector by negating its components.IVector3
negateX()
Negates the x-component.IVector3
negateY()
Negates the y-component.IVector3
negateZ()
Negates the z-component.IVector3
normalize()
Converts the vector to a unit vector (normalization)IVector3
randomX(IVector1 lower, IVector1 upper)
Sets the x-component to a random value in the interval [lower,upper]IVector3
randomY(IVector1 lower, IVector1 upper)
Sets the y-component to a random value in the interval [lower,upper]IVector3
randomZ(IVector1 lower, IVector1 upper)
Sets the z-component to a random value in the interval [lower,upper]IVector3
subtract(double scalar)
Subtracts a scalar to each component of this vector.IVector3
subtract(IVector1 scalar)
Subtracts a scalar to each component of this vector.IVector3
subtract(IVector3 vector)
Subtracts a scalar to each component of this vector.java.lang.String
toString()
IVector3
zero()
Sets all vector components to zero.
-
-
-
Field Detail
-
ZERO
public static final IVector3 ZERO
Zero vector.
-
-
Constructor Detail
-
Vector3Int
public Vector3Int()
Creates a new Vector3Int with the value (0,0,0).
-
Vector3Int
public Vector3Int(IVector3 vector)
Creates a new Vector3 with the same value as the input vector.
-
Vector3Int
public Vector3Int(int scalar)
Creates a new Vector3Int using the scalar to assign the value (scalar,scalar).
-
Vector3Int
public Vector3Int(int x, int y, int z)
Creates a new Vector3Int with the given value.
-
-
Method Detail
-
add
public IVector3 add(double scalar)
Adds a scalar to each component of this vector.
-
add
public IVector3 add(IVector3 vector)
Adds another vector to this vector, adding individual components.
-
subtract
public IVector3 subtract(IVector1 scalar)
Subtracts a scalar to each component of this vector.
-
subtract
public IVector3 subtract(IVector3 vector)
Subtracts a scalar to each component of this vector.
-
copy
public IVector3 copy()
Makes a copy of the vector without using the complex clone interface.
-
equals
public boolean equals(IVector3 vector)
Compares the vector to another vector. The vectors are equal if the components are equal.
-
getDirection
public IVector2 getDirection()
Returns the direction of the vector.- Specified by:
getDirection
in interfaceIVector3
- Returns:
- vector direction
-
getDistance
public IVector1 getDistance(IVector3 vector)
Returns the distance to another vector.- Specified by:
getDistance
in interfaceIVector3
- Parameters:
vector
- other vector- Returns:
- distance
-
getLength
public IVector1 getLength()
Returns the length (magnitude) of the vector.
-
getX
public IVector1 getX()
Returns the x-component of the vector.
-
getXAsBigDecimal
public java.math.BigDecimal getXAsBigDecimal()
Returns the x-component of the vector as BigDecimal.- Specified by:
getXAsBigDecimal
in interfaceIVector3
- Returns:
- x-component as BigDecimal
-
getXAsDouble
public double getXAsDouble()
Returns the x-component of the vector as double.- Specified by:
getXAsDouble
in interfaceIVector3
- Returns:
- x-component as double
-
getXAsFloat
public float getXAsFloat()
Returns the x-component of the vector as float.- Specified by:
getXAsFloat
in interfaceIVector3
- Returns:
- x-component as float
-
getXAsInteger
public int getXAsInteger()
Returns the x-component of the vector as integer.- Specified by:
getXAsInteger
in interfaceIVector3
- Returns:
- x-component as integer
-
getXAsLong
public long getXAsLong()
Returns the x-component of the vector as long.- Specified by:
getXAsLong
in interfaceIVector3
- Returns:
- x-component as long
-
getY
public IVector1 getY()
Returns the y-component of the vector.
-
getYAsBigDecimal
public java.math.BigDecimal getYAsBigDecimal()
Returns the y-component of the vector as BigDecimal.- Specified by:
getYAsBigDecimal
in interfaceIVector3
- Returns:
- y-component as BigDecimal
-
getYAsDouble
public double getYAsDouble()
Returns the y-component of the vector as double.- Specified by:
getYAsDouble
in interfaceIVector3
- Returns:
- y-component as double
-
getYAsFloat
public float getYAsFloat()
Returns the y-component of the vector as float.- Specified by:
getYAsFloat
in interfaceIVector3
- Returns:
- y-component as float
-
getYAsInteger
public int getYAsInteger()
Returns the y-component of the vector as integer.- Specified by:
getYAsInteger
in interfaceIVector3
- Returns:
- y-component as integer
-
getYAsLong
public long getYAsLong()
Returns the y-component of the vector as long.- Specified by:
getYAsLong
in interfaceIVector3
- Returns:
- y-component as long
-
getZ
public IVector1 getZ()
Returns the z-component of the vector.
-
getZAsBigDecimal
public java.math.BigDecimal getZAsBigDecimal()
Returns the z-component of the vector as BigDecimal.- Specified by:
getZAsBigDecimal
in interfaceIVector3
- Returns:
- z-component as BigDecimal
-
getZAsDouble
public double getZAsDouble()
Returns the z-component of the vector as double.- Specified by:
getZAsDouble
in interfaceIVector3
- Returns:
- z-component as double
-
getZAsFloat
public float getZAsFloat()
Returns the z-component of the vector as float.- Specified by:
getZAsFloat
in interfaceIVector3
- Returns:
- z-component as float
-
getZAsInteger
public int getZAsInteger()
Returns the z-component of the vector as integer.- Specified by:
getZAsInteger
in interfaceIVector3
- Returns:
- z-component as integer
-
getZAsLong
public long getZAsLong()
Returns the z-component of the vector as long.- Specified by:
getZAsLong
in interfaceIVector3
- Returns:
- z-component as long
-
mod
public IVector3 mod(IVector3 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.
-
multiply
public IVector3 multiply(double scalar)
Performs a scalar multiplication (scaling) on the vector.
-
multiply
public IVector3 multiply(IVector1 scalar)
Performs a scalar multiplication (scaling) on the vector.
-
negate
public IVector3 negate()
Negates the vector by negating its components.
-
negateX
public IVector3 negateX()
Negates the x-component.
-
negateY
public IVector3 negateY()
Negates the y-component.
-
negateZ
public IVector3 negateZ()
Negates the z-component.
-
normalize
public IVector3 normalize()
Converts the vector to a unit vector (normalization)
-
randomX
public IVector3 randomX(IVector1 lower, IVector1 upper)
Sets the x-component to a random value in the interval [lower,upper]
-
randomY
public IVector3 randomY(IVector1 lower, IVector1 upper)
Sets the y-component to a random value in the interval [lower,upper]
-
randomZ
public IVector3 randomZ(IVector1 lower, IVector1 upper)
Sets the z-component to a random value in the interval [lower,upper]
-
subtract
public IVector3 subtract(double scalar)
Subtracts a scalar to each component of this vector.
-
zero
public IVector3 zero()
Description copied from interface:IVector3
Sets all vector components to zero.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Description copied from interface:IVector3
Generates a deep clone of the vector.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-