Class Vector3
java.lang.Object
zombie.iso.Vector3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd another vector to this one and return as a new vectorAdd another vector to this one and store the result in this oneSet the direction of this vector to point to another vector, maintaining the lengthfloat
Calculate the angle between this point and anotherclone()
Clone this vectorfloat
distanceTo
(float float2, float float1, float float0) float
distanceTo
(Vector2 other) Calculate the distance between this point and anotherfloat
distanceTo
(Vector3 vector31) div
(float scalar) static float
dot
(float _x, float _y, float tx, float ty) float
float
boolean
See if this vector is equal to anotherstatic Vector2
fromLengthDirection
(float length, float direction) Create a new vector with a specified length and directionfloat
get the direction in which this vector is pointingfloat
get the length of this vectorfloat
get the length squared (L^2) of this vectorvoid
void
rotate
(float rad) void
rotatey
(float rad) set
(float _x, float _y, float _z) Set the horizontal and vertical parts of this vectorMake this vector identical to another vectorsetDirection
(float direction) Set the direction of this vector, maintaining the lengthsetLength
(float length) Set the length of this vector, maintaining the directionsetLengthAndDirection
(float direction, float length) Set the length and direction of this vectorstatic Vector3
toString()
-
Field Details
-
x
public float xThe horizontal part of this vector -
y
public float yThe vertical part of this vector -
z
public float z
-
-
Constructor Details
-
Vector3
public Vector3()Create a new vector with zero length -
Vector3
Create a new vector which is identical to another vector- Parameters:
other
- The Vector2 to copy
-
Vector3
public Vector3(float _x, float _y, float _z) Create a new vector with specified horizontal and vertical parts- Parameters:
_x
- The horizontal part_y
- The vertical part_z
-
-
-
Method Details
-
fromLengthDirection
Create a new vector with a specified length and direction- Parameters:
length
- The length of the new vectordirection
- The direction of the new vector, in radians
-
dot
public static float dot(float _x, float _y, float tx, float ty) -
rotate
public void rotate(float rad) -
rotatey
public void rotatey(float rad) -
add
-
addToThis
-
addToThis
-
div
-
aimAt
-
angleTo
Calculate the angle between this point and another- Parameters:
other
- The second point as vector- Returns:
- The angle between them, in radians
-
clone
-
distanceTo
Calculate the distance between this point and another- Parameters:
other
- The second point as vector- Returns:
- The distance between them
-
distanceTo
-
distanceTo
public float distanceTo(float float2, float float1, float float0) -
dot
-
dot3d
-
equals
-
getDirection
public float getDirection()get the direction in which this vector is pointing- Returns:
- The direction in which this vector is pointing in radians
-
setDirection
Set the direction of this vector, maintaining the length- Parameters:
direction
- The new direction of this vector, in radians
-
getLength
public float getLength()get the length of this vector- Returns:
- The length of this vector
-
getLengthSq
public float getLengthSq()get the length squared (L^2) of this vector- Returns:
- The length squared of this vector
-
setLength
Set the length of this vector, maintaining the direction- Parameters:
length
- The length of this vector
-
normalize
public void normalize() -
set
-
set
Set the horizontal and vertical parts of this vector- Parameters:
_x
- The horizontal part_y
- The vertical part_z
-
-
setLengthAndDirection
Set the length and direction of this vector- Parameters:
direction
- The direction of this vector, in radianslength
- The length of this vector
-
toString
-
sub
-
sub
-