Synergy Home Page

au.edu.swin.synergy.math
Class BVector2

java.lang.Object
  |
  +--au.edu.swin.synergy.math.BVector2

public class BVector2
extends Object
implements Serializable

A vector class for BScalars. It contains 2 elements. NOTE: this is not a Vector in the java sense, but rather a vector in the computer graphics/mathematical sense. While they are similar, there are certain differences that I won't elaborate on here. Just don't think that it's like a normal java.util.Vector. provides methods for multiplying, dividing, scaling, adding and subtracting vectors. The vector array is public, so no function calls are necessary to obtain the values. Index the array using the predefined constants.

Author:
Imron Alston
See Also:
Serialized Form

Field Summary
static int kNumElements
           
static int kXPos
           
static int kYPos
           
 BScalar[] vect
           
 
Constructor Summary
BVector2(BScalar x, BScalar y)
          Creates a new bvector2 from the scalar values given.
BVector2(float x, float y)
          Creates a new bvector2 with scalars that have the values of the floats passed in
BVector2(int x, int y)
          Creates a new bvector2 with scalars that have the values of the ints passed in
 
Method Summary
 void add(BScalar x, BScalar y)
          adds scalar values to the scalar
 void add(BVector2 op2)
          adds another vector to this vector
 void add(int x, int y)
          adds int values to the scalar
 void div(BVector2 op2)
          divs this vector by another vector
 BScalar getXScalar()
          gets the x scalar
 BScalar getYScalar()
          gets the y scalar
 void mult(BVector2 op2)
          multiplies this vector by another vector
 void mult(BVector2 op1, BVector2 op2)
          this vector = one vector multiplied by another vector
 void scale(float scale)
          scales this vector by a floating value.
 void setVals(BScalar x, BScalar y)
          sets the values of the bvector2
 void setVals(float x, float y)
          sets the values of the bvector2
 void setVals(int x, int y)
          sets the values of the bvector2
 void sub(BVector2 op2)
          subs another vector from this vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kNumElements

public static final int kNumElements

kXPos

public static final int kXPos

kYPos

public static final int kYPos

vect

public BScalar[] vect
Constructor Detail

BVector2

public BVector2(BScalar x,
                BScalar y)
Creates a new bvector2 from the scalar values given.

BVector2

public BVector2(int x,
                int y)
Creates a new bvector2 with scalars that have the values of the ints passed in

BVector2

public BVector2(float x,
                float y)
Creates a new bvector2 with scalars that have the values of the floats passed in
Method Detail

setVals

public void setVals(int x,
                    int y)
sets the values of the bvector2

setVals

public void setVals(float x,
                    float y)
sets the values of the bvector2

setVals

public void setVals(BScalar x,
                    BScalar y)
sets the values of the bvector2

getXScalar

public final BScalar getXScalar()
gets the x scalar

getYScalar

public final BScalar getYScalar()
gets the y scalar

mult

public final void mult(BVector2 op2)
multiplies this vector by another vector

mult

public final void mult(BVector2 op1,
                       BVector2 op2)
this vector = one vector multiplied by another vector

div

public final void div(BVector2 op2)
divs this vector by another vector

scale

public final void scale(float scale)
scales this vector by a floating value.

add

public final void add(BVector2 op2)
adds another vector to this vector

add

public final void add(int x,
                      int y)
adds int values to the scalar

add

public final void add(BScalar x,
                      BScalar y)
adds scalar values to the scalar

sub

public final void sub(BVector2 op2)
subs another vector from this vector

Synergy Home Page