Spreadsheet Toolkit

corpus.analyser
Class MathVector

java.lang.Object
  |
  +--corpus.analyser.MathVector
All Implemented Interfaces:
java.io.Serializable

public class MathVector
extends java.lang.Object
implements java.io.Serializable

A Mathmatical style vector in 3D space with a start and finish point as well as a magnitude. pg 765 in Anton.

See Also:
Serialized Form

Field Summary
protected  double magnitude
           
protected  double magX
          i, j, k
protected  double magY
          i, j, k
protected  double magZ
          i, j, k
protected  double x1
           
protected  double x2
           
protected  double y1
           
protected  double y2
           
protected  double z1
           
protected  double z2
           
 
Constructor Summary
MathVector(double magX, double magY, double magZ)
          Create from three magnitudes
MathVector(double x1, double y1, double z1, double x2, double y2, double z2)
           
 
Method Summary
 void add(MathVector sv2)
           
 void add2(MathVector sv2)
           
 void addMag(double X, double Y, double Z)
           
 double angleBetween(MathVector mv1)
           
static double angleBetween(MathVector mv1, MathVector mv2)
          Anton pg778 Radians
 double angleBetweenDeg(MathVector mv1)
           
static double angleBetweenDeg(MathVector mv1, MathVector mv2)
          Returns angle between two MathVectors in Degrees
static MathVector average(java.util.Vector mvectors)
          Given a vector of MathVectors, this method will return the average of all the magnitudes and points.
static MathVector averageMagnitude(java.util.Vector mvectors)
          Given a vector of MathVectors, this method will return the average of all the magnitudes, centered at the origin.
 boolean checkNaN()
          Returns true if one of the components of the MathVector is a Double.NaN
static MathVector crossProduct(MathVector mv1, MathVector mv2)
          Anton pg787
static double distanceBetween(double magX, double magY, double magZ)
           
static double distanceBetween(double x1, double y1, double z1, double x2, double y2, double z2)
           
 void divide(double n)
           
 void divideMag(double n)
           
 MathVector divideMV(double n)
           
 double dotProduct(MathVector mv1)
          Anton pg776
static double dotProduct(MathVector mv1, MathVector mv2)
          Anton pg776
 double[] getFinish()
           
 double[] getMag()
           
 double[] getStart()
           
 double magnitude()
          Anton pg777 ||v|| = sqrt(v.v)
static void main(java.lang.String[] args)
           
static void saveCSV(java.lang.String path, java.util.Vector mvectors)
          Turns a Vector of MathVectors into a string and saves it to path.
 void sub(MathVector sv2)
           
 java.lang.String toString()
           
 MathVector unitVector()
          returns a MathVector that is the unit vector of the this MathVector UV = V/|V|
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x1

protected double x1

y1

protected double y1

x2

protected double x2

y2

protected double y2

z1

protected double z1

z2

protected double z2

magX

protected double magX
i, j, k


magY

protected double magY
i, j, k


magZ

protected double magZ
i, j, k


magnitude

protected double magnitude
Constructor Detail

MathVector

public MathVector(double magX,
                  double magY,
                  double magZ)
Create from three magnitudes


MathVector

public MathVector(double x1,
                  double y1,
                  double z1,
                  double x2,
                  double y2,
                  double z2)
Method Detail

toString

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

getStart

public double[] getStart()

getFinish

public double[] getFinish()

getMag

public double[] getMag()

distanceBetween

public static double distanceBetween(double x1,
                                     double y1,
                                     double z1,
                                     double x2,
                                     double y2,
                                     double z2)

distanceBetween

public static double distanceBetween(double magX,
                                     double magY,
                                     double magZ)

add

public void add(MathVector sv2)

add2

public void add2(MathVector sv2)

sub

public void sub(MathVector sv2)

addMag

public void addMag(double X,
                   double Y,
                   double Z)

divideMag

public void divideMag(double n)

divide

public void divide(double n)

divideMV

public MathVector divideMV(double n)

averageMagnitude

public static MathVector averageMagnitude(java.util.Vector mvectors)
Given a vector of MathVectors, this method will return the average of all the magnitudes, centered at the origin.


average

public static MathVector average(java.util.Vector mvectors)
Given a vector of MathVectors, this method will return the average of all the magnitudes and points.


saveCSV

public static void saveCSV(java.lang.String path,
                           java.util.Vector mvectors)
Turns a Vector of MathVectors into a string and saves it to path.


checkNaN

public boolean checkNaN()
Returns true if one of the components of the MathVector is a Double.NaN


dotProduct

public double dotProduct(MathVector mv1)
Anton pg776


dotProduct

public static double dotProduct(MathVector mv1,
                                MathVector mv2)
Anton pg776


crossProduct

public static MathVector crossProduct(MathVector mv1,
                                      MathVector mv2)
Anton pg787


magnitude

public double magnitude()
Anton pg777 ||v|| = sqrt(v.v)


angleBetween

public double angleBetween(MathVector mv1)

angleBetween

public static double angleBetween(MathVector mv1,
                                  MathVector mv2)
Anton pg778 Radians


angleBetweenDeg

public double angleBetweenDeg(MathVector mv1)

angleBetweenDeg

public static double angleBetweenDeg(MathVector mv1,
                                     MathVector mv2)
Returns angle between two MathVectors in Degrees


unitVector

public MathVector unitVector()
returns a MathVector that is the unit vector of the this MathVector UV = V/|V|

Returns:
a MathVector equivalent to the parent with a magnitude of 1.

main

public static void main(java.lang.String[] args)

Spreadsheet Toolkit

Project Home Page