apps.lightrays.raytracer.scene
Class Vector

java.lang.Object
  extended by apps.lightrays.raytracer.scene.Vector

public class Vector
extends java.lang.Object

The Class Vector.


Field Summary
static double EPSILON
          The Constant EPSILON.
 double x
          The x.
 double y
          The y.
 double z
          The z.
 
Constructor Summary
Vector()
          Instantiates a new vector.
Vector(double x, double y, double z)
          Instantiates a new vector.
Vector(Point p, Point origin)
          Instantiates a new vector.
Vector(Vector v)
          Instantiates a new vector.
 
Method Summary
 void add(Vector v)
          Adds the.
 Vector addNew(Vector v)
          Adds the new.
 void crossProduct(Vector v)
          Cross product.
 Vector crossProductNew(Vector v)
          Cross product new.
 double dotproduct(Vector v)
          Dotproduct.
 double length()
          Length.
 Vector multiplyNew(double a)
          Multiply new.
 boolean nonzero()
          Nonzero.
 void normalise()
          Normalise.
 void scale(double a)
          Scale.
 void set(double x, double y, double z)
          Sets the.
 void subtract(Vector v)
          Subtract.
 Vector subtractNew(Vector v)
          Subtract new.
 Point toPoint()
          To point.
 java.lang.String toString()
           
 void unaryMinus()
          Unary minus.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EPSILON

public static final double EPSILON
The Constant EPSILON.

See Also:
Constant Field Values

x

public double x
The x.


y

public double y
The y.


z

public double z
The z.

Constructor Detail

Vector

public Vector()
Instantiates a new vector.


Vector

public Vector(double x,
              double y,
              double z)
Instantiates a new vector.

Parameters:
x - the x
y - the y
z - the z

Vector

public Vector(Point p,
              Point origin)
Instantiates a new vector.

Parameters:
p - the p
origin - the origin

Vector

public Vector(Vector v)
Instantiates a new vector.

Parameters:
v - the v
Method Detail

add

public void add(Vector v)
Adds the.

Parameters:
v - the v

addNew

public Vector addNew(Vector v)
Adds the new.

Parameters:
v - the v
Returns:
the vector

crossProduct

public void crossProduct(Vector v)
Cross product.

Parameters:
v - the v

crossProductNew

public Vector crossProductNew(Vector v)
Cross product new.

Parameters:
v - the v
Returns:
the vector

dotproduct

public double dotproduct(Vector v)
Dotproduct.

Parameters:
v - the v
Returns:
the double

length

public double length()
Length.

Returns:
the double

multiplyNew

public Vector multiplyNew(double a)
Multiply new.

Parameters:
a - the a
Returns:
the vector

nonzero

public boolean nonzero()
Nonzero.

Returns:
true, if successful

normalise

public void normalise()
Normalise.


scale

public void scale(double a)
Scale.

Parameters:
a - the a

set

public void set(double x,
                double y,
                double z)
Sets the.

Parameters:
x - the x
y - the y
z - the z

subtract

public void subtract(Vector v)
Subtract.

Parameters:
v - the v

subtractNew

public Vector subtractNew(Vector v)
Subtract new.

Parameters:
v - the v
Returns:
the vector

toPoint

public Point toPoint()
To point.

Returns:
the point

toString

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

unaryMinus

public void unaryMinus()
Unary minus.