Class Vec2
java.lang.Object
org.jbox2d.common.Vec2
- All Implemented Interfaces:
java.io.Serializable
public class Vec2
extends java.lang.Object
implements java.io.Serializable
A 2D column vector
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Vec2abs()Return a new vector that has positive components.static final Vec2final voidabsLocal()static final voidfinal Vec2Return the sum of this vector and another; does not alter either one.final Vec2addLocal(float x, float y) Adds values to this vector and returns result - alters this vector.final Vec2Add another vector to this one and returns result - alters this vector.final Vec2clone()Return a copy of this vector.static final Vec2static final Vec2static final floatstatic final voidcrossToOut(float s, Vec2 a, Vec2 out) static final voidcrossToOut(Vec2 a, float s, Vec2 out) static final voidcrossToOutUnsafe(float s, Vec2 a, Vec2 out) static final voidcrossToOutUnsafe(Vec2 a, float s, Vec2 out) static final floatbooleanequals(java.lang.Object obj) inthashCode()final booleanisValid()True if the vector represents a pair of valid, non-infinite floating point numbers.final floatlength()Return the length of this vector.final floatReturn the squared length of this vector.static final Vec2static final voidstatic final Vec2static final voidfinal Vec2mul(float a) Return this vector multiplied by a scalar; does not alter this vector.final Vec2mulLocal(float a) Multiply this vector by a number and return result - alters this vector.final Vec2negate()Return the negation of this vector; does not alter this vector.final Vec2Flip the vector and return it - alters this vector.static final voidnegateToOut(Vec2 a, Vec2 out) final floatNormalize this vector and return the length before normalization.final Vec2set(float x, float y) Set the vector component-wise.final Vec2Set this vector to another vector.final voidsetZero()Zero out this vector.final Vec2skew()Get the skew vector such that dot(skew_vec, other) == cross(vec, other)final voidGet the skew vector such that dot(skew_vec, other) == cross(vec, other)final Vec2Return the difference of this vector and another; does not alter either one.final Vec2Subtract another vector from this one and return result - alters this vector.final java.lang.StringtoString()Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
x
public float x -
y
public float y
-
-
Constructor Details
-
Vec2
public Vec2() -
Vec2
public Vec2(float x, float y) -
Vec2
-
-
Method Details
-
setZero
public final void setZero()Zero out this vector. -
set
Set the vector component-wise. -
set
-
add
-
sub
-
mul
Return this vector multiplied by a scalar; does not alter this vector. -
negate
Return the negation of this vector; does not alter this vector. -
negateLocal
Flip the vector and return it - alters this vector. -
addLocal
-
addLocal
Adds values to this vector and returns result - alters this vector. -
subLocal
-
mulLocal
Multiply this vector by a number and return result - alters this vector. -
skew
Get the skew vector such that dot(skew_vec, other) == cross(vec, other) -
skew
Get the skew vector such that dot(skew_vec, other) == cross(vec, other) -
length
public final float length()Return the length of this vector. -
lengthSquared
public final float lengthSquared()Return the squared length of this vector. -
normalize
public final float normalize()Normalize this vector and return the length before normalization. Alters this vector. -
isValid
public final boolean isValid()True if the vector represents a pair of valid, non-infinite floating point numbers. -
abs
Return a new vector that has positive components. -
absLocal
public final void absLocal() -
clone
-
toString
public final java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
abs
-
absToOut
-
dot
-
cross
-
cross
-
crossToOut
-
crossToOutUnsafe
-
cross
-
crossToOut
-
crossToOutUnsafe
-
negateToOut
-
min
-
max
-
minToOut
-
maxToOut
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object- See Also:
-
equals
public boolean equals(java.lang.Object obj) - Overrides:
equalsin classjava.lang.Object- See Also:
-