public class Vec2 extends java.lang.Object implements IData<Vec2>
| Modifier and Type | Field and Description |
|---|---|
static Vec2 |
one
Don't modify the value of this vector.
|
float |
x |
float |
y |
static Vec2 |
zero
Don't modify the value of this vector.
|
| Constructor and Description |
|---|
Vec2()
Constructor of the (0, 0) point
|
Vec2(float x,
float y)
Constructor of a (x, y) point
|
| Modifier and Type | Method and Description |
|---|---|
Vec2 |
add(float x,
float y) |
Vec2 |
add(Vec2 vec) |
Vec2 |
add(Vec2 vec1,
Vec2 vec2) |
Vec2 |
addScale(Vec2 vec1,
Vec2 vec2,
float scale) |
Vec2 |
addScale(Vec2 vec1,
Vec2 vec2,
Vec2 scale) |
Vec2 |
clone() |
float |
distance(Vec2 vec) |
float |
distanceSqr(Vec2 vec) |
Vec2 |
divide(Vec2 vec,
float f) |
Vec2 |
divide(Vec2 vec1,
Vec2 vec2) |
float |
dot(Vec2 vec) |
boolean |
equals(java.lang.Object obj) |
float[] |
get() |
float |
getX() |
float |
getY() |
int |
hashCode() |
Vec2 |
interpolate(Vec2 current,
Vec2 next,
float t)
Interpolate
current and next and store result in this. |
void |
interpolateNoCheck(Vec2 next,
float t,
float[] dest,
int destIndex) |
Vec2 |
interpolateNoCheck(Vec2 current,
Vec2 next,
float t) |
void |
interpolateScaleAddNoCheck(Vec2 next,
float t,
float scaleX,
float scaleY,
float addX,
float addY,
float[] dest,
int destIndex) |
Vec2 |
invert(Vec2 vec) |
boolean |
isUnitVector() |
boolean |
isZeroVector() |
float |
magnitude() |
Vec2 |
magnitude(float length) |
float |
magnitudeSqr() |
Vec2 |
max(Vec2 vec1,
Vec2 vec2) |
Vec2 |
min(Vec2 vec1,
Vec2 vec2) |
Vec2 |
multiply(float f) |
Vec2 |
multiply(Vec2 vec) |
Vec2 |
multiply(Vec2 vec,
float f) |
Vec2 |
multiply(Vec2 vec1,
Vec2 vec2) |
float |
normalize()
Normalize this
Vec2 |
Vec2 |
set(float x,
float y) |
Vec2 |
set(Vec2 src)
Copy
src in this vector. |
Vec2 |
setUnit() |
Vec2 |
setX(float x) |
Vec2 |
setY(float y) |
Vec2 |
setZero() |
Vec2 |
subtract(Vec2 vec) |
Vec2 |
subtract(Vec2 vec1,
Vec2 vec2) |
java.lang.String |
toString() |
public static final Vec2 zero
public static final Vec2 one
public float x
public float y
public Vec2()
public Vec2(float x,
float y)
public final Vec2 clone()
public final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic final java.lang.String toString()
toString in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Objectpublic final boolean isZeroVector()
public final Vec2 setZero()
public final boolean isUnitVector()
public final Vec2 setUnit()
public final float[] get()
public final Vec2 set(float x, float y)
public final float getX()
public final Vec2 setX(float x)
public final float getY()
public final Vec2 setY(float y)
public Vec2 add(float x, float y)
public final Vec2 add(Vec2 vec1, Vec2 vec2)
vec1 - vec2 - public final Vec2 addScale(Vec2 vec1, Vec2 vec2, Vec2 scale)
vec1 - vec2 - scale - public final Vec2 addScale(Vec2 vec1, Vec2 vec2, float scale)
vec1 - vec2 - scale - public final Vec2 subtract(Vec2 vec1, Vec2 vec2)
vec1 - vec2 - public final Vec2 multiply(Vec2 vec1, Vec2 vec2)
vec1 - vec2 - public final Vec2 multiply(float f)
vec - f - public final Vec2 multiply(Vec2 vec, float f)
vec - f - public final Vec2 divide(Vec2 vec1, Vec2 vec2)
vec1 - vec2 - public final float magnitude()
Vec2public final float magnitudeSqr()
Vec2public final Vec2 magnitude(float length)
length - new magnitude (length) for this Vec2public final float normalize()
Vec2public final float distance(Vec2 vec)
vec - a vectorpublic final float distanceSqr(Vec2 vec)
vec - a vectorpublic final float dot(Vec2 vec)
vec - a vectorpublic final Vec2 interpolate(Vec2 current, Vec2 next, float t)
IInterpolablecurrent and next and store result in this.interpolate in interface IInterpolable<Vec2>interpolate in interface IData<Vec2>next - t - range is [0, 1]current - current valuepublic final void interpolateNoCheck(Vec2 next, float t, float[] dest, int destIndex)
public final void interpolateScaleAddNoCheck(Vec2 next, float t, float scaleX, float scaleY, float addX, float addY, float[] dest, int destIndex)
public final Vec2 set(Vec2 src)
src in this vector.set in interface IValueCopy<Vec2>src - source vectorBonzai Engine 1.3.4 11/12/2015 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2015 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com