net.sf.j3d.threeD.raytracer.primitives
Class PolynomialTerm

java.lang.Object
  extended by net.sf.j3d.threeD.raytracer.primitives.PolynomialTerm

public class PolynomialTerm
extends Object

A PolynomialTerm object represents a single term of a polynomial function represented by a Polynomial object.


Constructor Summary
PolynomialTerm()
          Constructs a new PolynomialTerm object with a coefficient of 0.0 and all powers set to 0.
PolynomialTerm(double coefficient, int x, int y, int z)
          Constructs a new PolynomialTerm object using the specified coefficient and the specified integer powers of x, y, and z.
 
Method Summary
 void calculateDx()
          Calculates the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to X and stores it for later use.
 void calculateDy()
          Calculates the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Y and stores it for later use.
 void calculateDz()
          Calculates the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Z and stores it for later use.
 double evaluate(double x, double y, double z)
          Evaluates the polynomial term represented by this PolynomialTerm object for the specfied x, y, and z values and returns the result as a double value.
 double expand(double value, int power)
          Raises the specified value to the specified integer power and returns the result as a double value.
 double getCoefficient()
          Returns the coefficient of this PolynomialTerm object as a double value.
 PolynomialTerm getDx()
          Returns the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to X as a PolynomialTerm object.
 PolynomialTerm getDy()
          Returns the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Y as a PolynomialTerm object.
 PolynomialTerm getDz()
          Returns the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Z as a PolynomialTerm object.
 int getExpOfX()
          Returns the exponent on X of this PolynomialTerm object as an integer value.
 int getExpOfY()
          Returns the exponent on Y of this PolynomialTerm object as an integer value.
 int getExpOfZ()
          Returns the exponent on Z of this PolynomialTerm object as an integer value.
 boolean isLikeTerm(PolynomialTerm term)
          Returns true if the exponents of x, y, and z of this PolynomialTerm object are the same as the specified PolynomialTerm object.
 PolynomialTerm multiply(PolynomialTerm term)
          Calculates the product of this PolynomialTerm object with the specified PolynomialTerm object and returns the result as a PolynomialTerm object.
 void setCoefficient(double coefficient)
          Sets the coefficient of this PolynomialTerm object to the specified double value.
 void setExpOfX(int x)
          Sets the exponent on X of this PolynomialTerm object to the specified integer value.
 void setExpOfY(int y)
          Sets the exponent on Y of this PolynomialTerm object to the specified integer value.
 void setExpOfZ(int z)
          Sets the exponent on Z of this PolynomialTerm object to the specified integer value.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PolynomialTerm

public PolynomialTerm()
Constructs a new PolynomialTerm object with a coefficient of 0.0 and all powers set to 0.


PolynomialTerm

public PolynomialTerm(double coefficient,
                      int x,
                      int y,
                      int z)
Constructs a new PolynomialTerm object using the specified coefficient and the specified integer powers of x, y, and z.

Method Detail

setCoefficient

public void setCoefficient(double coefficient)
Sets the coefficient of this PolynomialTerm object to the specified double value.


setExpOfX

public void setExpOfX(int x)
Sets the exponent on X of this PolynomialTerm object to the specified integer value.


setExpOfY

public void setExpOfY(int y)
Sets the exponent on Y of this PolynomialTerm object to the specified integer value.


setExpOfZ

public void setExpOfZ(int z)
Sets the exponent on Z of this PolynomialTerm object to the specified integer value.


getCoefficient

public double getCoefficient()
Returns the coefficient of this PolynomialTerm object as a double value.


getExpOfX

public int getExpOfX()
Returns the exponent on X of this PolynomialTerm object as an integer value.


getExpOfY

public int getExpOfY()
Returns the exponent on Y of this PolynomialTerm object as an integer value.


getExpOfZ

public int getExpOfZ()
Returns the exponent on Z of this PolynomialTerm object as an integer value.


getDx

public PolynomialTerm getDx()
Returns the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to X as a PolynomialTerm object.


getDy

public PolynomialTerm getDy()
Returns the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Y as a PolynomialTerm object.


getDz

public PolynomialTerm getDz()
Returns the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Z as a PolynomialTerm object.


evaluate

public double evaluate(double x,
                       double y,
                       double z)
Evaluates the polynomial term represented by this PolynomialTerm object for the specfied x, y, and z values and returns the result as a double value.


calculateDx

public void calculateDx()
Calculates the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to X and stores it for later use.


calculateDy

public void calculateDy()
Calculates the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Y and stores it for later use.


calculateDz

public void calculateDz()
Calculates the partial derivative of the polynomial term represented by this PolynomialTerm object with respect to Z and stores it for later use.


multiply

public PolynomialTerm multiply(PolynomialTerm term)
Calculates the product of this PolynomialTerm object with the specified PolynomialTerm object and returns the result as a PolynomialTerm object.


isLikeTerm

public boolean isLikeTerm(PolynomialTerm term)
Returns true if the exponents of x, y, and z of this PolynomialTerm object are the same as the specified PolynomialTerm object.


expand

public double expand(double value,
                     int power)
Raises the specified value to the specified integer power and returns the result as a double value.


toString

public String toString()
Overrides:
toString in class Object