public class Vector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double |
x
x coordinate of this
Vector . |
double |
y
y coordinate of this
Vector . |
double |
z
z coordinate of this
Vector . |
Constructor and Description |
---|
Vector(double x,
double y,
double z)
Instantiates a new vector.
|
Vector(Point p)
Instantiates a new vector.
|
Vector(Point p1,
Point p2)
Instantiates a new vector.
|
Vector(net.minecraft.util.Vec3 vec)
Instantiates a new vector.
|
Vector(Vector v)
Instantiates a new vector.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Vector v)
Adds the given
Vector from this Vector . |
void |
cross(Vector v)
Calculates the cross product of this
Vector with a given Vector . |
double |
dot(Point p)
|
double |
dot(Vector v)
Calculates the dot product of this
Vector with a given Vector . |
double |
length()
Gets the squared length of this
Vector . |
double |
lengthSquared()
Gets the squared length of this
Vector . |
void |
negate()
Inverses the vector.
|
void |
normalize()
Normalizes this
Vector . |
void |
scale(double factor)
Scales this
Vector by a factor. |
void |
set(double x,
double y,
double z)
Sets the x, y and z coordinates for this
Vector . |
void |
subtract(Vector v)
Subtracts the given
Vector from this Vector . |
java.lang.String |
toString() |
public double x
Vector
.public double y
Vector
.public double z
Vector
.public Vector(double x, double y, double z)
x
- the xy
- the yz
- the zpublic Vector(Vector v)
v
- the vpublic Vector(Point p)
p
- the ppublic Vector(Point p1, Point p2)
p1
- the p1p2
- the p2public Vector(net.minecraft.util.Vec3 vec)
vec
- the vecpublic void set(double x, double y, double z)
Vector
.x
- the xy
- the yz
- the zpublic double lengthSquared()
Vector
.public double length()
Vector
.public void normalize()
Vector
.public void subtract(Vector v)
Vector
from this Vector
.v
- the vector to subtractpublic void add(Vector v)
Vector
from this Vector
.v
- the vector to addpublic void cross(Vector v)
Vector
with a given Vector
.v
- the vectorpublic double dot(Vector v)
Vector
with a given Vector
.v
- the vectorpublic double dot(Point p)
p
- the pointpublic void scale(double factor)
Vector
by a factor.factor
- the factor to scalepublic void negate()
public java.lang.String toString()
toString
in class java.lang.Object