ProGAL.geom2d
Class Vector

java.lang.Object
  extended by ProGAL.geomNd.Vector
      extended by ProGAL.geom2d.Vector

public class Vector
extends Vector


Constructor Summary
Vector(double[] coords)
           
Vector(double x, double y)
           
Vector(Point p, Point q)
           
 
Method Summary
 Vector add(Vector v)
           
 Vector addThis(Point p)
           
 Vector addThis(Vector v)
           
 Vector clone()
          Create a clone of this vector.
static Vector createDiff(Vector u, Vector v)
           
 Vector createRotatedVector(double a)
           
static Vector createSum(Vector u, Vector v)
           
static double crossProduct(Vector u, Vector v)
           
 double dot(Vector v)
           
static double dotProduct(Vector u, Vector v)
           
 double[] getCoords()
           
 double getSlope()
           
 double getSquaredLength()
           
static boolean leftTurn(Vector u, Vector v)
           
 double length()
          Get the length of this vector.
 Vector multiply(double a)
          Multiply this vector by s and return the result (without changing this object).
 Vector multiplyThis(double a)
          Multiply this vector by s and return the result (changing this object).
 void negative()
           
 Vector normalize()
          Normalize this vector and return the result (without changing this object).
 Vector normalizeThis()
          Normalize this vector and return the result (changing this object).
static boolean rightTurn(Vector u, Vector v)
           
 Vector rotate90()
           
 Vector rotate90This()
           
 Vector rotateThis(double a)
           
 Vector scale(double a)
           
 Vector scaleToLength(double l)
          Scale this vector to a certain length (returns new object and does not change this object).
 void toConsole()
          Writes this vector to System.out.
 void toConsole(int dec)
          Writes this vector to System.out with dec decimals precision.
 Point toPoint()
          Convert this vector to a point.
 java.lang.String toString()
          Returns a string-representation of this vector formatted with two decimals precision.
 java.lang.String toString(int dec)
          Returns a string-representation of this vector formatted with dec decimals precision.
 double x()
           
 double y()
           
 
Methods inherited from class ProGAL.geomNd.Vector
add, addThis, angle, divide, divideThis, dot, equals, equals, get, getAngle, getCoord, getDimensions, getLengthSquared, isZeroVector, outerProduct, scaleToLengthThis, set, setCoord, setCoords, subtract, subtractThis
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector

public Vector(double x,
              double y)

Vector

public Vector(double[] coords)

Vector

public Vector(Point p,
              Point q)
Method Detail

x

public double x()

y

public double y()

getCoords

public double[] getCoords()

getSquaredLength

public double getSquaredLength()

length

public double length()
Description copied from class: Vector
Get the length of this vector.

Overrides:
length in class Vector

getSlope

public double getSlope()

negative

public void negative()

scale

public Vector scale(double a)

rotateThis

public Vector rotateThis(double a)

add

public Vector add(Vector v)

addThis

public Vector addThis(Vector v)

addThis

public Vector addThis(Point p)

multiply

public Vector multiply(double a)
Description copied from class: Vector
Multiply this vector by s and return the result (without changing this object).

Overrides:
multiply in class Vector

multiplyThis

public Vector multiplyThis(double a)
Description copied from class: Vector
Multiply this vector by s and return the result (changing this object).

Overrides:
multiplyThis in class Vector

normalize

public Vector normalize()
Description copied from class: Vector
Normalize this vector and return the result (without changing this object).

Overrides:
normalize in class Vector

normalizeThis

public Vector normalizeThis()
Description copied from class: Vector
Normalize this vector and return the result (changing this object).

Overrides:
normalizeThis in class Vector

createRotatedVector

public Vector createRotatedVector(double a)

rotate90

public Vector rotate90()

rotate90This

public Vector rotate90This()

toPoint

public Point toPoint()
Description copied from class: Vector
Convert this vector to a point.

Overrides:
toPoint in class Vector

createSum

public static Vector createSum(Vector u,
                               Vector v)

createDiff

public static Vector createDiff(Vector u,
                                Vector v)

crossProduct

public static double crossProduct(Vector u,
                                  Vector v)

dotProduct

public static double dotProduct(Vector u,
                                Vector v)

leftTurn

public static boolean leftTurn(Vector u,
                               Vector v)

rightTurn

public static boolean rightTurn(Vector u,
                                Vector v)

toString

public java.lang.String toString()
Description copied from class: Vector
Returns a string-representation of this vector formatted with two decimals precision.

Overrides:
toString in class Vector

toString

public java.lang.String toString(int dec)
Description copied from class: Vector
Returns a string-representation of this vector formatted with dec decimals precision.

Overrides:
toString in class Vector

toConsole

public void toConsole()
Description copied from class: Vector
Writes this vector to System.out.

Overrides:
toConsole in class Vector

toConsole

public void toConsole(int dec)
Description copied from class: Vector
Writes this vector to System.out with dec decimals precision.

Overrides:
toConsole in class Vector

scaleToLength

public Vector scaleToLength(double l)
Description copied from class: Vector
Scale this vector to a certain length (returns new object and does not change this object).

Overrides:
scaleToLength in class Vector

dot

public double dot(Vector v)

clone

public Vector clone()
Description copied from class: Vector
Create a clone of this vector.

Overrides:
clone in class Vector