org.metasyntactic.graphics.primitives
Class Vector

java.lang.Object
  |
  +--org.metasyntactic.graphics.primitives.Vector

public final class Vector
extends java.lang.Object


Constructor Summary
Vector(double x, double y, double z)
           
 
Method Summary
 Vector add(Vector v)
           
 Vector cross(Vector v)
           
 double dot(Vector v)
           
static Vector fromXML(org.w3c.dom.Element element)
           
 double getMagnitude()
           
 double getPhi()
           
 double getR()
           
 double getTheta()
           
 double getX()
           
 double getY()
           
 double getZ()
           
 Vector multiply(double scale)
           
 Vector negate()
           
static Vector newCartesian(double x, double y, double z)
           
static Vector newPoints(Point p1, Point p2)
           
static Vector newPolar(double theta, double phi, double r)
           
 Vector normalize()
           
 Vector rotateUp(double rads)
           
 Vector subtract(Vector v)
           
 Point toPoint()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Vector

public Vector(double x,
              double y,
              double z)
Method Detail

newCartesian

public static Vector newCartesian(double x,
                                  double y,
                                  double z)

getTheta

public double getTheta()

getPhi

public double getPhi()

getR

public double getR()

getMagnitude

public double getMagnitude()

getX

public final double getX()

getY

public final double getY()

getZ

public final double getZ()

negate

public final Vector negate()

newPoints

public static Vector newPoints(Point p1,
                               Point p2)

newPolar

public static Vector newPolar(double theta,
                              double phi,
                              double r)

cross

public final Vector cross(Vector v)

dot

public final double dot(Vector v)

multiply

public final Vector multiply(double scale)

add

public final Vector add(Vector v)

subtract

public final Vector subtract(Vector v)

normalize

public final Vector normalize()

fromXML

public static Vector fromXML(org.w3c.dom.Element element)

rotateUp

public final Vector rotateUp(double rads)

toPoint

public Point toPoint()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object