Class Vec2

java.lang.Object
org.jbox2d.common.Vec2
All Implemented Interfaces:
Serializable

public class Vec2 extends Object implements Serializable
A 2D column vector.
Author:
Daniel Murphy
See Also:
Repolink:
Github: erincatto/box2d include/box2d/b2_math.h Lines 40 - 129
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
     
    float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor does nothing (for performance).
    Vec2(float x, float y)
    Construct using coordinates.
    Vec2(Vec2 toCopy)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final Vec2
    abs()
    Return a new vector that has positive components.
    static Vec2
    abs(Vec2 a)
     
    final void
     
    static void
    absToOut(Vec2 a, Vec2 out)
     
    final Vec2
    add(Vec2 v)
    Return the sum of this vector and another; does not alter either one.
    final Vec2
    addLocal(float x, float y)
    Adds values to this vector and returns result - alters this vector.
    final Vec2
    Add another vector to this one and returns result - alters this vector.
    final Vec2
    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
     
    int
     
    final boolean
    Does this vector contain finite coordinates?
    final float
    Get the length of this vector (the norm).
    final float
    Get the length squared.
    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)
     
    final Vec2
    mul(float a)
    Return this vector multiplied by a scalar; does not alter this vector.
    final Vec2
    mulLocal(float a)
    Multiply this vector by a number and return result - alters this vector.
    final Vec2
    Return the negation of this vector; does not alter this vector.
    final Vec2
    Flip the vector and return it - alters this vector.
    static void
     
    final float
    Convert this vector into a unit vector.
    final Vec2
    set(float x, float y)
    Set the vector component-wise.
    final Vec2
    set(Vec2 v)
    Set this vector to another vector.
    final void
    Zero out this vector.
    final Vec2
    Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
    final void
    skew(Vec2 out)
    Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
    final Vec2
    sub(Vec2 v)
    Return the difference of this vector and another; does not alter either one.
    final Vec2
    Subtract another vector from this one and return result - alters this vector.
    final String
     

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait