Fractal
Class PSLSystem2

java.lang.Object
  extended by Fractal.LSystem2Renderer
      extended by Fractal.PSLSystem2

public class PSLSystem2
extends LSystem2Renderer

Write an LSystem grammar to a PostScript file

Author:
eliott bartley

Constructor Summary
PSLSystem2(java.lang.String grammar, int depth, float angle)
          Create a new LSystem that can be written to a PS file with axiom 'F'
PSLSystem2(java.lang.String axiom, java.lang.String grammar, int depth, float angle)
          Create a new LSystem that can be written to a PS file
 
Method Summary
protected  void drawLine(java.lang.Object user, int x, int y, int u, int v)
          Execute the LSystem and write its movements to the PS file, scaled to fit the page
 void save(java.lang.String filename)
          Save the LSystem to the named file at dimensions (500, 500)
 void save(java.lang.String filename, float width, float height)
          Save the LSystem to the named file at the specified dimensions
 
Methods inherited from class Fractal.LSystem2Renderer
getDerivedGrammar, render, setDimension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSLSystem2

public PSLSystem2(java.lang.String grammar,
                  int depth,
                  float angle)
Create a new LSystem that can be written to a PS file with axiom 'F'

Parameters:
grammar - The grammar of the LSystem
depth - The recursive depth of the grammar
angle - The angle distance each turn should make, in degrees

PSLSystem2

public PSLSystem2(java.lang.String axiom,
                  java.lang.String grammar,
                  int depth,
                  float angle)
Create a new LSystem that can be written to a PS file

Parameters:
axiom - The axiom to apply the fractal to
grammar - The grammar of the LSystem
depth - The recursive depth of the grammar
angle - The angle distance each turn should make, in degrees
Method Detail

save

public void save(java.lang.String filename)
Save the LSystem to the named file at dimensions (500, 500)

Parameters:
filename - Filepath to save to

save

public void save(java.lang.String filename,
                 float width,
                 float height)
Save the LSystem to the named file at the specified dimensions

Parameters:
filename - Filepath to save to
width - Width of PostScript (in centimeters?)
height - Height of PostScript (in centimeters?)

drawLine

protected void drawLine(java.lang.Object user,
                        int x,
                        int y,
                        int u,
                        int v)
Execute the LSystem and write its movements to the PS file, scaled to fit the page

Specified by:
drawLine in class LSystem2Renderer
Parameters:
user - Any object the caller wants to pass. This is forwarded on to the drawLine callback