Class Wave2D

java.lang.Object
  |
  +--Wave2D
All Implemented Interfaces:
java.awt.Shape

public class Wave2D
extends java.lang.Object
implements java.awt.Shape

Programm: Wave
Copyright: 2002 Andreas Gohr, Frank Schubert
License: GPL2 or higher

Info: Creates a Wave Shape


Constructor Summary
Wave2D()
          empty Constructor - initializes the wave with the values of a normal sinus curve
Wave2D(double A, double lambda, double phi)
          constructor - takes amplitude, wavelength and phaseshift
Wave2D(double A, double lambda, double phi, double start, double end)
          constructor - takes amplitude, wavelength, phaseshift, start- and endpoint
 
Method Summary
 double calcWave(double x)
          calculates the amplitude for x
 boolean contains(double x, double y)
          the wave has no inside this returns always false
 boolean contains(double x, double y, double w, double h)
          the wave has no inside this returns always false
 boolean contains(java.awt.geom.Point2D p)
          the wave has no inside this returns always false
 boolean contains(java.awt.geom.Rectangle2D r)
          the wave has no inside this returns always false
 java.awt.Rectangle getBounds()
          returns the bounding box
 java.awt.geom.Rectangle2D getBounds2D()
          returns the bounding box
 double getEnd()
          gets last point to draw
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
          returns new WaveIterator
 java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
          returns new WaveIterator
 double getScale()
          returns the actual scale
 double getStart()
          gets first point to draw
 boolean intersects(double x, double y, double w, double h)
          returns always true - this may be wrong?
 boolean intersects(java.awt.geom.Rectangle2D r)
          returns always true - this may be wrong?
 void setAmplitude(double A)
          sets amplitude
 void setEnd(double end)
          sets last point to draw
 void setPhase(double phi)
          sets phaseshift
 void setScale(double scale)
          sets scale - the wave is calculated in 0.1 steps to calculate the x-value of the point where the actual amplitude is to be drawn the current index is multiplicated by this value.
 void setStart(double start)
          sets first point to draw
 void setWaveLength(double lambda)
          sets wavelength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Wave2D

public Wave2D()
empty Constructor - initializes the wave with the values of a normal sinus curve


Wave2D

public Wave2D(double A,
              double lambda,
              double phi)
constructor - takes amplitude, wavelength and phaseshift


Wave2D

public Wave2D(double A,
              double lambda,
              double phi,
              double start,
              double end)
constructor - takes amplitude, wavelength, phaseshift, start- and endpoint

Method Detail

setEnd

public void setEnd(double end)
sets last point to draw


getEnd

public double getEnd()
gets last point to draw


setStart

public void setStart(double start)
sets first point to draw


getStart

public double getStart()
gets first point to draw


setAmplitude

public void setAmplitude(double A)
sets amplitude


setWaveLength

public void setWaveLength(double lambda)
sets wavelength


setPhase

public void setPhase(double phi)
sets phaseshift


setScale

public void setScale(double scale)
sets scale - the wave is calculated in 0.1 steps to calculate the x-value of the point where the actual amplitude is to be drawn the current index is multiplicated by this value. It is set to 10 by default. A value of 0.0 is NOT allowed


getScale

public double getScale()
returns the actual scale


calcWave

public double calcWave(double x)
calculates the amplitude for x


getBounds

public java.awt.Rectangle getBounds()
returns the bounding box

Specified by:
getBounds in interface java.awt.Shape

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
returns the bounding box

Specified by:
getBounds2D in interface java.awt.Shape

contains

public boolean contains(double x,
                        double y)
the wave has no inside this returns always false

Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Point2D p)
the wave has no inside this returns always false

Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
the wave has no inside this returns always false

Specified by:
contains in interface java.awt.Shape

contains

public boolean contains(java.awt.geom.Rectangle2D r)
the wave has no inside this returns always false

Specified by:
contains in interface java.awt.Shape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
returns always true - this may be wrong?

Specified by:
intersects in interface java.awt.Shape

intersects

public boolean intersects(java.awt.geom.Rectangle2D r)
returns always true - this may be wrong?

Specified by:
intersects in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
returns new WaveIterator

Specified by:
getPathIterator in interface java.awt.Shape

getPathIterator

public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at,
                                                  double flatness)
returns new WaveIterator

Specified by:
getPathIterator in interface java.awt.Shape