Class Vector

java.lang.Object
  extended byVector

public class Vector
extends java.lang.Object

Class Vector Version 2


Constructor Summary
Vector()
          Constructor.
Vector(double x, double y)
          Constructor.
Vector(float len, double ang)
          Constructor.
Vector(java.awt.geom.Point2D s)
          Constructor.
 
Method Summary
 boolean equal(Vector vV)
          Determines wheather this vector is equal to other vector.
 java.awt.geom.Point2D getSpets()
          Returns spets of this vector.
 double getx()
          Retrieves the coordinate x of this vector.
 double gety()
          Retrieves the coordinate y of this vector.
 double magnitud()
          Returns magnitud of this vector.
 void multPorEscalar(double m)
          Mulitplies vector with scalar.
static double productoPunto(Vector a, Vector b)
          Creates "producto punto" multiplying two vectors
 void restarLe(Vector vV)
          Subtracts vector from this vector.
static Vector restVectores(Vector a, Vector b)
          Creates new vector subtracting one vector from other vector
 void rotar(double ang)
          Rotates vector to the left certain number of radians.
 void set(double x, double y)
          Sets the spets of this vector to coordinates x, y.
 void set(java.awt.geom.Point2D xy)
          Sets the spets of this vector to coordinates xy
 void sumarLe(Vector vV)
          Adds vector to this vector.
static Vector sumaVectores(Vector a, Vector b)
          Creates new vector summing up two otheres
 java.lang.String toString()
          Retrieves this vector in format String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector

public Vector()
Constructor. Initializes a new Vector.


Vector

public Vector(java.awt.geom.Point2D s)
Constructor. Initializes a new point.

Parameters:
s - Initializes spets

Vector

public Vector(double x,
              double y)
Constructor. Initializes a new point.

Parameters:
x - Initializes spets
y - Initializes spets

Vector

public Vector(float len,
              double ang)
Constructor. Initializes a new point.

Parameters:
len - Initializes spets
ang - Initializes spets
Method Detail

set

public void set(double x,
                double y)
Sets the spets of this vector to coordinates x, y.

Parameters:
x - -
y - -

set

public void set(java.awt.geom.Point2D xy)
Sets the spets of this vector to coordinates xy

Parameters:
xy - -

sumarLe

public void sumarLe(Vector vV)
Adds vector to this vector.

Parameters:
vV - the vector to be added.

restarLe

public void restarLe(Vector vV)
Subtracts vector from this vector.

Parameters:
vV - the vector to be added.

multPorEscalar

public void multPorEscalar(double m)
Mulitplies vector with scalar.

Parameters:
m - the scalar.

rotar

public void rotar(double ang)
Rotates vector to the left certain number of radians.

Parameters:
ang - the certain number of radians.

toString

public java.lang.String toString()
Retrieves this vector in format String.

Returns:
the vector in format String.

equal

public boolean equal(Vector vV)
Determines wheather this vector is equal to other vector.

Parameters:
vV - the other vector
Returns:
true if equality else false

sumaVectores

public static Vector sumaVectores(Vector a,
                                  Vector b)
Creates new vector summing up two otheres

Parameters:
a - & b the two vectors to be added up
b - & a the two vectors to be added up
Returns:
new vector

restVectores

public static Vector restVectores(Vector a,
                                  Vector b)
Creates new vector subtracting one vector from other vector

Parameters:
a - other vector
b - one vector
Returns:
new vector

productoPunto

public static double productoPunto(Vector a,
                                   Vector b)
Creates "producto punto" multiplying two vectors

Parameters:
a - & b the two vectors to be multiplied
b - & a the two vectors to be multiplied
Returns:
"producto punto"

magnitud

public double magnitud()
Returns magnitud of this vector.

Returns:
magnitud

getSpets

public java.awt.geom.Point2D getSpets()
Returns spets of this vector.

Returns:
the spets

getx

public double getx()
Retrieves the coordinate x of this vector.

Returns:
the coordinate x.

gety

public double gety()
Retrieves the coordinate y of this vector.

Returns:
the coordinate y.