|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjadex.application.space.envsupport.math.Vector2Double
public class Vector2Double
Implementation of a cartesian 2-vector using double components.
| Field Summary | |
|---|---|
static IVector2 |
ZERO
Zero vector. |
| Constructor Summary | |
|---|---|
Vector2Double()
Creates a new Vector2Double with the value (0,0). |
|
Vector2Double(double scalar)
Creates a new Vector2 using the scalar to assign the value (scalar,scalar). |
|
Vector2Double(double x,
double y)
Creates a new Vector2 with the given value. |
|
Vector2Double(IVector2 vector)
Creates a new Vector2 with the same value as the input vector. |
|
| Method Summary | |
|---|---|
IVector2 |
add(double scalar)
Adds a scalar to each component of this vector. |
IVector2 |
add(IVector1 scalar)
Adds a scalar to each component of this vector. |
IVector2 |
add(IVector2 vector)
Adds another vector to this vector, adding individual components. |
IVector2 |
assign(IVector2 vector)
Assigns this vector the values of another vector. |
Object |
clone()
Generates a deep clone of the vector. |
IVector2 |
copy()
Makes a copy of the vector without using the complex clone interface. |
IVector2 |
divide(IVector2 vector)
Performs a division on the vector. |
boolean |
equals(IVector2 vector)
Compares the vector to another vector. |
boolean |
equals(Object obj)
Compares the vector to an object |
IVector1 |
getDirection()
Returns the direction (theta) of the vector. |
double |
getDirectionAsDouble()
Returns the direction (theta) of the vector as double. |
float |
getDirectionAsFloat()
Returns the direction (theta) of the vector as float. |
IVector1 |
getDistance(IVector2 vector)
Returns the distance to another vector. |
IVector1 |
getLength()
Returns the length (magnitude) of the vector. |
IVector1 |
getMean()
Returns the mean average of the vector components. |
static IVector2 |
getVector2(Double a,
Double b)
Get a vector for two doubles. |
IVector1 |
getX()
Returns the x-component of the vector. |
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. |
BigDecimal |
getYAsBigDecimal()
Returns the component of the vector as BigDecima;. |
double |
getYAsDouble()
Returns the component of the vector as double. |
float |
getYAsFloat()
Returns the component of the vector as float. |
int |
getYAsInteger()
Returns the component of the vector as integer. |
long |
getYAsLong()
Returns the component of the vector as float. |
int |
hashCode()
Compute the hash code. |
IVector2 |
mod(IVector2 modulus)
Applies a modulo vector. |
IVector2 |
multiply(double scalar)
Performs a scalar multiplication (scaling) on the vector. |
IVector2 |
multiply(IVector1 scalar)
Performs a scalar multiplication (scaling) on the vector. |
IVector2 |
multiply(IVector2 vector)
Performs a multiplication on the vector. |
IVector2 |
negate()
Negates the vector by negating its components. |
IVector2 |
negateX()
Negates the x-component. |
IVector2 |
negateY()
Negates the y-component. |
IVector2 |
normalize()
Converts the vector to a unit vector (normalization) |
IVector2 |
randomX(IVector1 lower,
IVector1 upper)
Sets the x-component to a random value in the interval [lower,upper] |
IVector2 |
randomY(IVector1 lower,
IVector1 upper)
Sets the y-component to a random value in the interval [lower,upper] |
void |
setX(IVector1 x)
|
void |
setY(IVector1 y)
|
IVector2 |
subtract(double scalar)
Subtracts a scalar to each component of this vector. |
IVector2 |
subtract(IVector1 scalar)
Subtracts a scalar to each component of this vector. |
IVector2 |
subtract(IVector2 vector)
Subtracts another vector to this vector, subtracting individual components. |
String |
toString()
|
IVector2 |
zero()
Sets all vector components to zero. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final IVector2 ZERO
| Constructor Detail |
|---|
public Vector2Double()
public Vector2Double(IVector2 vector)
public Vector2Double(double scalar)
public Vector2Double(double x,
double y)
| Method Detail |
|---|
public IVector2 assign(IVector2 vector)
assign in interface IVector2vector - the other vector
public IVector2 add(double scalar)
IVector2
add in interface IVector2scalar - scalar value as double
public IVector2 add(IVector1 scalar)
IVector2
add in interface IVector2scalar - scalar value
public IVector2 add(IVector2 vector)
IVector2
add in interface IVector2vector - the vector to add to this vector
public IVector2 subtract(double scalar)
IVector2
subtract in interface IVector2scalar - scalar value as double
public IVector2 subtract(IVector1 scalar)
IVector2
subtract in interface IVector2scalar - scalar value
public IVector2 subtract(IVector2 vector)
IVector2
subtract in interface IVector2vector - the vector to subtract from this vector
public IVector2 mod(IVector2 modulus)
IVector2
mod in interface IVector2modulus - modulus
public IVector2 multiply(double scalar)
IVector2
multiply in interface IVector2scalar - the scale factor double
public IVector2 multiply(IVector1 scalar)
IVector2
multiply in interface IVector2scalar - the scale factor
public IVector2 multiply(IVector2 vector)
IVector2
multiply in interface IVector2vector - vector
public IVector2 divide(IVector2 vector)
divide in interface IVector2vector - vector
public IVector2 zero()
IVector2
zero in interface IVector2public IVector2 negateX()
IVector2
negateX in interface IVector2public IVector2 negateY()
IVector2
negateY in interface IVector2public IVector2 negate()
IVector2
negate in interface IVector2
public IVector2 randomX(IVector1 lower,
IVector1 upper)
IVector2
randomX in interface IVector2
public IVector2 randomY(IVector1 lower,
IVector1 upper)
IVector2
randomY in interface IVector2public IVector2 normalize()
IVector2
normalize in interface IVector2public IVector1 getLength()
IVector2
getLength in interface IVector2public IVector1 getDirection()
IVector2
getDirection in interface IVector2public float getDirectionAsFloat()
IVector2
getDirectionAsFloat in interface IVector2public double getDirectionAsDouble()
IVector2
getDirectionAsDouble in interface IVector2public IVector1 getMean()
IVector2
getMean in interface IVector2public IVector1 getDistance(IVector2 vector)
IVector2
getDistance in interface IVector2vector - other vector
public IVector1 getX()
IVector2
getX in interface IVector2public IVector1 getY()
IVector2
getY in interface IVector2public void setX(IVector1 x)
public void setY(IVector1 y)
public int getXAsInteger()
getXAsInteger in interface IVector2public int getYAsInteger()
getYAsInteger in interface IVector2public long getXAsLong()
getXAsLong in interface IVector2public long getYAsLong()
getYAsLong in interface IVector2public float getXAsFloat()
IVector2
getXAsFloat in interface IVector2public float getYAsFloat()
IVector2
getYAsFloat in interface IVector2public double getXAsDouble()
IVector2
getXAsDouble in interface IVector2public double getYAsDouble()
IVector2
getYAsDouble in interface IVector2public BigDecimal getXAsBigDecimal()
IVector2
getXAsBigDecimal in interface IVector2public BigDecimal getYAsBigDecimal()
IVector2
getYAsBigDecimal in interface IVector2public IVector2 copy()
IVector2
copy in interface IVector2
public Object clone()
throws CloneNotSupportedException
IVector2
clone in interface IVector2clone in class ObjectCloneNotSupportedExceptionpublic boolean equals(Object obj)
IVector2
equals in interface IVector2equals in class Objectobj - the object
public boolean equals(IVector2 vector)
IVector2
equals in interface IVector2vector - the other vector
public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
public static IVector2 getVector2(Double a,
Double b)
a - The first value.b - The second value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||