de.jreality.tutorial.util.polygon
Class SubdividedPolygon

java.lang.Object
  extended by de.jreality.tutorial.util.polygon.SubdividedPolygon
All Implemented Interfaces:
PointSequence, java.util.EventListener, javax.swing.event.ChangeListener

public class SubdividedPolygon
extends java.lang.Object
implements javax.swing.event.ChangeListener, PointSequence

A subdivider that uses 4-point subdivision. For closed or open point sequences. It will be updated whenever the control point sequence changes.

Author:
Steffen Weissmann

Constructor Summary
SubdividedPolygon(PointSequence controlPoints)
          Create a SubdividedPolygon for a set of control points.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener cl)
           
 double[][] getPoints()
          returns the subdivided point sequence.
 boolean isClosed()
           
 void removeChangeListener(javax.swing.event.ChangeListener cl)
           
 void setSubdivisionLevel(int n)
          Set the number of subdivision steps.
 void stateChanged(javax.swing.event.ChangeEvent e)
          this is called from the control point sequence.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubdividedPolygon

public SubdividedPolygon(PointSequence controlPoints)
Create a SubdividedPolygon for a set of control points.

Parameters:
controlPoints - the control point sequence used for subdivision.
Method Detail

setSubdivisionLevel

public void setSubdivisionLevel(int n)
Set the number of subdivision steps.

Parameters:
n - number of steps

getPoints

public double[][] getPoints()
returns the subdivided point sequence.

Specified by:
getPoints in interface PointSequence

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
this is called from the control point sequence.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener

isClosed

public boolean isClosed()
Specified by:
isClosed in interface PointSequence

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener cl)
Specified by:
addChangeListener in interface PointSequence

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener cl)