public class Vec2
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
Vec2() |
Vec2(float x,
float y) |
Vec2(Vec2 toCopy) |
Modifier and Type | Method and Description |
---|---|
Vec2 |
abs()
Return a new vector that has positive components.
|
static Vec2 |
abs(Vec2 a) |
void |
absLocal() |
static void |
absToOut(Vec2 a,
Vec2 out) |
Vec2 |
add(Vec2 v)
Return the sum of this vector and another; does not alter either one.
|
Vec2 |
addLocal(float x,
float y)
Adds values to this vector and returns result - alters this vector.
|
Vec2 |
addLocal(Vec2 v)
Add another vector to this one and returns result - alters this vector.
|
Vec2 |
clone()
Return a copy of this vector.
|
static Vec2 |
cross(float s,
Vec2 a) |
static Vec2 |
cross(Vec2 a,
float s) |
static float |
cross(Vec2 a,
Vec2 b) |
static void |
crossToOut(float s,
Vec2 a,
Vec2 out) |
static void |
crossToOut(Vec2 a,
float s,
Vec2 out) |
static void |
crossToOutUnsafe(float s,
Vec2 a,
Vec2 out) |
static void |
crossToOutUnsafe(Vec2 a,
float s,
Vec2 out) |
static float |
dot(Vec2 a,
Vec2 b) |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isValid()
True if the vector represents a pair of valid, non-infinite floating point numbers.
|
float |
length()
Return the length of this vector.
|
float |
lengthSquared()
Return the squared length of this vector.
|
static Vec2 |
max(Vec2 a,
Vec2 b) |
static void |
maxToOut(Vec2 a,
Vec2 b,
Vec2 out) |
static Vec2 |
min(Vec2 a,
Vec2 b) |
static void |
minToOut(Vec2 a,
Vec2 b,
Vec2 out) |
Vec2 |
mul(float a)
Return this vector multiplied by a scalar; does not alter this vector.
|
Vec2 |
mulLocal(float a)
Multiply this vector by a number and return result - alters this vector.
|
Vec2 |
negate()
Return the negation of this vector; does not alter this vector.
|
Vec2 |
negateLocal()
Flip the vector and return it - alters this vector.
|
static void |
negateToOut(Vec2 a,
Vec2 out) |
float |
normalize()
Normalize this vector and return the length before normalization.
|
Vec2 |
set(float x,
float y)
Set the vector component-wise.
|
Vec2 |
set(Vec2 v)
Set this vector to another vector.
|
void |
setZero()
Zero out this vector.
|
Vec2 |
skew()
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
|
void |
skew(Vec2 out)
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
|
Vec2 |
sub(Vec2 v)
Return the difference of this vector and another; does not alter either one.
|
Vec2 |
subLocal(Vec2 v)
Subtract another vector from this one and return result - alters this vector.
|
java.lang.String |
toString() |
public Vec2()
public Vec2(float x, float y)
public Vec2(Vec2 toCopy)
public final void setZero()
public final Vec2 set(float x, float y)
public final Vec2 add(Vec2 v)
public final Vec2 sub(Vec2 v)
public final Vec2 mul(float a)
public final Vec2 negate()
public final Vec2 negateLocal()
public final Vec2 addLocal(Vec2 v)
public final Vec2 addLocal(float x, float y)
public final Vec2 subLocal(Vec2 v)
public final Vec2 mulLocal(float a)
public final Vec2 skew()
public final void skew(Vec2 out)
public final float length()
public final float lengthSquared()
public final float normalize()
public final boolean isValid()
public final Vec2 abs()
public final void absLocal()
public final Vec2 clone()
clone
in class java.lang.Object
public final java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
Copyright © 2017. All Rights Reserved.