public class LXVector extends Object
Modifier and Type | Field and Description |
---|---|
int |
index
Index of the LXPoint this corresponds to
|
LXPoint |
point
Helper to retrieve the point this corresponds to
|
float |
x |
float |
y |
float |
z |
Constructor and Description |
---|
LXVector(float x,
float y,
float z) |
LXVector(LXPoint point)
Construct a mutable vector based on an LXPoint
|
LXVector(LXVector that) |
Modifier and Type | Method and Description |
---|---|
LXVector |
add(float x,
float y) |
LXVector |
add(float x,
float y,
float z) |
LXVector |
add(LXVector that) |
static float |
angleBetween(LXVector v1,
LXVector v2)
Calculates and returns the angle (in radians) between two vectors.
|
LXVector |
copy() |
LXVector |
cross(float x,
float y,
float z) |
LXVector |
cross(LXVector that) |
float |
dist(LXVector that) |
LXVector |
div(float n) |
float |
dot(float x,
float y,
float z) |
float |
dot(LXVector that) |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isZero() |
LXVector |
lerp(LXVector that,
float amt) |
LXVector |
limit(float max) |
float |
mag() |
float |
magSq() |
LXVector |
mult(float n) |
LXVector |
normalize() |
LXVector |
rotate(float theta)
Rotate in x-y plane
|
LXVector |
rotate(float theta,
float l,
float m,
float n)
Rotate about an arbitrary vector.
|
LXVector |
set(float x,
float y) |
LXVector |
set(float x,
float y,
float z) |
LXVector |
set(LXPoint that) |
LXVector |
set(LXVector that) |
LXVector |
setMag(float mag) |
LXVector |
sub(float x,
float y) |
LXVector |
sub(float x,
float y,
float z) |
LXVector |
sub(LXVector that) |
String |
toString() |
public float x
public float y
public float z
public final LXPoint point
public final int index
public LXVector(LXPoint point)
point
- Point with index referencepublic LXVector(LXVector that)
public LXVector(float x, float y, float z)
public LXVector set(float x, float y)
public LXVector set(float x, float y, float z)
public LXVector copy()
public LXVector add(float x, float y)
public LXVector add(float x, float y, float z)
public LXVector sub(float x, float y)
public LXVector sub(float x, float y, float z)
public LXVector mult(float n)
public LXVector div(float n)
public float mag()
public float magSq()
public float dist(LXVector that)
public float dot(float x, float y, float z)
public float dot(LXVector that)
public LXVector cross(float x, float y, float z)
public LXVector normalize()
public LXVector limit(float max)
public LXVector setMag(float mag)
public boolean isZero()
public LXVector rotate(float theta)
theta
- Radians to rotate bypublic LXVector rotate(float theta, float l, float m, float n)
theta
- Angle to rotate by, in radiansl
- vector x-valuem
- vector y-valuen
- vector z-valuepublic static float angleBetween(LXVector v1, LXVector v2)
v1
- the x, y, and z components of an LXVectorv2
- the x, y, and z components of an LXVectorLX library by Mark C. Slee. © 2012-2020