Modifier and Type | Field and Description |
---|---|
static Vector |
ONE |
static Vector |
RIGHT |
static Vector |
UNIT_X |
static Vector |
UNIT_Y |
static Vector |
UNIT_Z |
static Vector |
UP |
protected double |
x |
protected double |
y |
protected double |
z |
static Vector |
ZERO |
Constructor and Description |
---|
Vector(double x,
double y,
double z)
Create vector with double values
|
Vector(float x,
float y,
float z)
Create vector with float values
|
Vector(int x,
int y,
int z)
Create vector with rounded values
|
Vector(Location loc)
Create vector according to the given location
|
Modifier and Type | Method and Description |
---|---|
Vector |
add(Vector vec)
Add vector to another vector
|
float |
angle(Vector other)
Get the angle between 2 vectors.
|
Vector |
clone() |
Vector |
copy(Vector vec)
Copy the given vector to the current.
|
Vector |
crossProduct(Vector o) |
double |
distance(Vector o)
Get the distance between this vector nd the given one
|
double |
distanceSquared(Vector o)
Get the distance squared between this vector nd the given one
|
Vector |
divide(double len)
Divide the current vector to the given length
|
Vector |
divide(Vector vec)
Divide the current vector to the given one
|
double |
dot(Point other) |
double |
dot(Vector other) |
boolean |
equals(Object obj) |
int |
getBlockX() |
int |
getBlockY() |
int |
getBlockZ() |
double |
getX() |
double |
getY() |
double |
getZ() |
int |
hashCode() |
boolean |
isInAABB(Vector min,
Vector max) |
boolean |
isInSphere(Vector origin,
double radius) |
double |
length() |
double |
lengthSquared() |
Vector |
multiply(double m) |
Vector |
multiply(float m) |
Vector |
multiply(int m) |
Vector |
multiply(Vector vec)
Multiply the current vector to the given one
|
Vector |
negate() |
Vector |
normalize() |
Vector |
setX(double x) |
Vector |
setX(float x) |
Vector |
setX(int x) |
Vector |
setY(double y) |
Vector |
setY(float y) |
Vector |
setY(int y) |
Vector |
setZ(double z) |
Vector |
setZ(float z) |
Vector |
setZ(int z) |
Vector |
subtract(Vector vec)
Remove vector to another vector
|
Vector |
toBlockVector()
Convert this vector into a new one with int block
|
Location |
toLocation(World w) |
String |
toShowableString() |
String |
toString() |
Vector |
zero() |
public static final Vector ZERO
public static final Vector UNIT_X
public static final Vector UNIT_Y
public static final Vector UNIT_Z
public static final Vector ONE
public static final Vector RIGHT
public static final Vector UP
protected double x
protected double y
protected double z
public Vector(Location loc)
loc
- the location that must to be vectorisedpublic Vector(int x, int y, int z)
x
- the X vector movementy
- the Y vector movementz
- the Z vector movementpublic Vector(double x, double y, double z)
x
- the X vector movementy
- the Y vector movementz
- the Z vector movementpublic Vector(float x, float y, float z)
x
- the X vector movementy
- the Y vector movementz
- the Z vector movementpublic Vector toBlockVector()
public Vector add(Vector vec)
vec
- the added vector movementpublic Vector subtract(Vector vec)
vec
- the remoevd vector movementpublic Vector multiply(Vector vec)
vec
- the multiplying vectorpublic Vector divide(Vector vec)
vec
- the divided vectorpublic Vector divide(double len)
len
- the lengthpublic Vector copy(Vector vec)
vec
- the new vector values of this onepublic double length()
public double lengthSquared()
public double distance(Vector o)
o
- the vector which will compare topublic double distanceSquared(Vector o)
o
- the vector which will compare topublic float angle(Vector other)
other
- the vector to compare withpublic Vector multiply(int m)
public Vector multiply(double m)
public Vector multiply(float m)
public double dot(Vector other)
public double dot(Point other)
public Vector normalize()
public Vector zero()
public boolean isInSphere(Vector origin, double radius)
public double getX()
public int getBlockX()
public double getY()
public int getBlockY()
public double getZ()
public int getBlockZ()
public Vector setX(int x)
public Vector setX(double x)
public Vector setX(float x)
public Vector setY(int y)
public Vector setY(double y)
public Vector setY(float y)
public Vector setZ(int z)
public Vector setZ(double z)
public Vector setZ(float z)
public Vector negate()
public String toShowableString()