Overview | Package | Class | Use | Tree | Index | Help
| Rings Version 0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## threeD.raytracer.primitives
Class Polynomial

    java.lang.Object
      threeD.raytracer.engine.AbstractSurface
          threeD.raytracer.primitives.Polynomial

All Implemented Interfaces:
  Surface

public class Polynomial
extends AbstractSurface

A Polynomial object represents a 3d polynomial surface.

Constructor Summary
`Polynomial()` Constructs a new Polynomial object with no terms.
`Polynomial(PolynomialTerm[] terms)` Constructs a new Polynomial object with the specified terms.

Method Summary
`Polynomial` | `add(Polynomial polynomial)` Combines the terms of this Polynomial object and the specified Polynomial object and returns the sum as a Polynomial object.
`void` | `addTerm(PolynomialTerm term)` Adds the specified PolynomialTerm object to this Polynomial object.
`void` | `calculateDx()` Calculates the terms of the partial derivative of the polynomial function represented by this Polynomial object with respect to X and stores the terms for later evaluatation.
`void` | `calculateDy()` Calculates the terms of the partial derivative of the polynomial function represented by this Polynomial object with respect to Y and stores the terms for later evaluatation.
`void` | `calculateDz()` Calculates the terms of the partial derivative of the polynomial function represented by this Polynomial object with respect to Z and stores the terms for later evaluatation.
`double` | `calculateZero(double initialValue, double yValue, double zValue, int recursions)` Calculates an estimate for an X value that allows the polynomial function represented by this Polynomial object to equal zero when the specified Y and Z values are held constant.
`double[]` | `calculateZeros(double start, double end, double increment, double yValue, double zValue, int recursions)` Calculates a series of zeros found by the calculateZero method in the interval from the double value start to the double value end choosing guesses at every interval of the length specified by the double value increment.
`double` | `evaluate(double x, double y, double z)` Evaluates the polynomial function represented by this Polynomial object for the specified values.
`Vector` | `evaluateGradient(double x, double y, double z)` Evaluates the gradient of the polynomial funtion represented by this Polynomial object for the specified values.
`Polynomial` | `expand(int power)` Multiplies this Polynomial object with itself as many times as indicated by the specified integer value.
`Polynomial` | `getDx()` Returns a Polynomial object that represents the partial derivative of the polynomial function represented by this Polynomial object with respect to X.
`Polynomial` | `getDy()` Returns a Polynomial object that represents the partial derivative of the polynomial function represented by this Polynomial object with respect to Y.
`Polynomial` | `getDz()` Returns a Polynomial object that represents the partial derivative of the polynomial function represented by this Polynomial object with respect to Z.
`Vector` | `getNormalAt(Vector point)` Returns a Vector object that represents the vector normal to this polynomial surface at the point represented by the specified Vector object.
`PolynomialTerm[]` | `getTerms()` Returns the terms of this Polynomial object as an array of PolynomialTerm objects.
`boolean` | `intersect(Ray ray)` Returns true if the ray represented by the specified Ray object intersects the polynomial surface represented by this Polynomial object in real space.
`Intersection` | `intersectAt(Ray ray)` Returns an array of double values representing the distance along the ray represented by the specified Ray object that intersection between the ray and the polynomial surface represented by this Polynomial object occurs.
`Polynomial` | `multiply(Polynomial polynomial)` Calculates the product of the polynomial function represented by this Polynomial object and that of the specified Polynomial object and returns the result as a Polynomial object.
`Polynomial` | `multiply(PolynomialTerm term)` Calculates the product of the polynomial function represented by this Polynomial object and that of the specified PolynomialTerm object and returns the result as a Polynomial object.
`void` | `removeTerm(int index)` Removes the PolynomialTerm object stored at the specified index from this Polynomial object.
`void` | `setTerms(PolynomialTerm[] terms)` Sets the terms of this Polynomial object to those specified.
`void` | `simplify()` Scans this Polynomial object for like terms and combines them and calculates the terms of the new partial derivatives.
`java.lang.String` | `toString()` Returns a String representation of this Polynomial object.

Methods inherited from class threeD.raytracer.engine.AbstractSurface
`addShader, addTexture, addTransform, calculateTransform, getColor, getColorAt, getLocation, getParent, getRotationCoefficients, getScaleCoefficients, getShadeBack, getShadeFront, getShaderSet, getSize, getTexture, getTextures, getTextureSet, getTransform, getTransform, getTransforms, removeTexture, removeTransform, setColor, setLocation, setParent, setRotationCoefficients, setScaleCoefficients, setShadeBack, setShadeFront, setShaders, setSize, setTexture, setTextures, setTransform, setTransforms, shade`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Polynomial

    public Polynomial()

  Constructs a new Polynomial object with no terms.

### Polynomial

    public Polynomial(PolynomialTerm[] terms)

  Constructs a new Polynomial object with the specified terms.

Method Detail

### setTerms

    public void setTerms(PolynomialTerm[] terms)

  Sets the terms of this Polynomial object to those specified.

### addTerm

    public void addTerm(PolynomialTerm term)

  Adds the specified PolynomialTerm object to this Polynomial object.

### removeTerm

    public void removeTerm(int index)

  Removes the PolynomialTerm object stored at the specified index from this Polynomial object.

### getTerms

    public PolynomialTerm[] getTerms()

  Returns the terms of this Polynomial object as an array of PolynomialTerm objects.

### simplify

    public void simplify()

  Scans this Polynomial object for like terms and combines them and calculates the terms of the new partial derivatives.

### add

    public Polynomial add(Polynomial polynomial)

  Combines the terms of this Polynomial object and the specified Polynomial object and returns the sum as a Polynomial object.

### multiply

    public Polynomial multiply(Polynomial polynomial)

  Calculates the product of the polynomial function represented by this Polynomial object and that of the specified Polynomial object and returns the result as a Polynomial object.

### multiply

    public Polynomial multiply(PolynomialTerm term)

  Calculates the product of the polynomial function represented by this Polynomial object and that of the specified PolynomialTerm object and returns the result as a Polynomial object.

### expand

    public Polynomial expand(int power)

  Multiplies this Polynomial object with itself as many times as indicated by the specified integer value. If power is less than 0, null is returned. The polynomial is simplified after each step.

### evaluate

    public double evaluate(double x,
                           double y,
                           double z)

  Evaluates the polynomial function represented by this Polynomial object for the specified values.

### evaluateGradient

    public Vector evaluateGradient(double x,
                                   double y,
                                   double z)

  Evaluates the gradient of the polynomial funtion represented by this Polynomial object for the specified values.

### calculateZeros

    public double[] calculateZeros(double start,
                                   double end,
                                   double increment,
                                   double yValue,
                                   double zValue,
                                   int recursions)

  Calculates a series of zeros found by the calculateZero method in the interval from the double value start to the double value end choosing guesses at every interval of the length specified by the double value increment. The Y and Z values and the number of recursions must also be specified.

### calculateZero

    public double calculateZero(double initialValue,
                                double yValue,
                                double zValue,
                                int recursions)

  Calculates an estimate for an X value that allows the polynomial function represented by this Polynomial object to equal zero when the specified Y and Z values are held constant. A recursive method is used and the number of recursions may be specified (3 or 4 usually works well).

### getDx

    public Polynomial getDx()

  Returns a Polynomial object that represents the partial derivative of the polynomial function represented by this Polynomial object with respect to X.

### getDy

    public Polynomial getDy()

  Returns a Polynomial object that represents the partial derivative of the polynomial function represented by this Polynomial object with respect to Y.

### getDz

    public Polynomial getDz()

  Returns a Polynomial object that represents the partial derivative of the polynomial function represented by this Polynomial object with respect to Z.

### calculateDx

    public void calculateDx()

  Calculates the terms of the partial derivative of the polynomial function represented by this Polynomial object with respect to X and stores the terms for later evaluatation.

### calculateDy

    public void calculateDy()

  Calculates the terms of the partial derivative of the polynomial function represented by this Polynomial object with respect to Y and stores the terms for later evaluatation.

### calculateDz

    public void calculateDz()

  Calculates the terms of the partial derivative of the polynomial function represented by this Polynomial object with respect to Z and stores the terms for later evaluatation.

### getNormalAt

    public Vector getNormalAt(Vector point)

  Returns a Vector object that represents the vector normal to this polynomial surface at the point represented by the specified Vector object.

### intersect

    public boolean intersect(Ray ray)

  Returns true if the ray represented by the specified Ray object intersects the polynomial surface represented by this Polynomial object in real space.

### intersectAt

    public Intersection intersectAt(Ray ray)

  Returns an array of double values representing the distance along the ray represented by the specified Ray object that intersection between the ray and the polynomial surface represented by this Polynomial object occurs.

### toString

    public java.lang.String toString()

  Returns a String representation of this Polynomial object.

Overview | Package | Class | Use | Tree | Index | Help
| Rings Version 0.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2003-05 Mike Murray