Package heronarts.lx.transform
Class LXVector
java.lang.Object
heronarts.lx.transform.LXVector
A mutable version of an LXPoint, which has had a transformation applied to
it, and may have other transformations applied to it. For Processing applications,
this mostly conforms to the PVector API.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(float x, float y) add
(float x, float y, float z) static float
angleBetween
(LXVector v1, LXVector v2) Calculates and returns the angle (in radians) between two vectors.copy()
cross
(float x, float y, float z) float
div
(float n) float
dot
(float x, float y, float z) float
boolean
int
hashCode()
boolean
isZero()
limit
(float max) float
mag()
float
magSq()
mult
(float n) rotate
(float theta) Rotate in x-y planerotate
(float theta, float l, float m, float n) Rotate about an arbitrary vector.set
(float x, float y) set
(float x, float y, float z) setMag
(float mag) sub
(float x, float y) sub
(float x, float y, float z) toString()
-
Field Details
-
x
public float x -
y
public float y -
z
public float z -
point
Helper to retrieve the point this corresponds to -
index
public final int indexIndex of the LXPoint this corresponds to
-
-
Constructor Details
-
LXVector
public LXVector()Construct a mutable vector -
LXVector
Construct a mutable vector based on an LXPoint- Parameters:
point
- Point with index reference
-
LXVector
-
LXVector
public LXVector(float x, float y, float z)
-
-
Method Details
-
set
-
set
-
set
-
set
-
copy
-
add
-
add
-
add
-
add
-
sub
-
sub
-
sub
-
mult
-
mult
-
div
-
mag
public float mag() -
magSq
public float magSq() -
dist
-
dot
public float dot(float x, float y, float z) -
dot
-
cross
-
cross
-
normalize
-
limit
-
setMag
-
lerp
-
isZero
public boolean isZero() -
rotate
Rotate in x-y plane- Parameters:
theta
- Radians to rotate by- Returns:
- this
-
rotate
Rotate about an arbitrary vector. If you are going to perform this operation on many LXVectors, it is better to use the LXProjection class to avoid a lot of redundant computation.- Parameters:
theta
- Angle to rotate by, in radiansl
- vector x-valuem
- vector y-valuen
- vector z-value- Returns:
- this, for method chaining
-
angleBetween
Calculates and returns the angle (in radians) between two vectors.- Parameters:
v1
- the x, y, and z components of an LXVectorv2
- the x, y, and z components of an LXVector- Returns:
- angle between vectors in radians
-
toString
-
equals
-
hashCode
public int hashCode()
-