Unformatted text preview:

COMS 4115 Programming Languages and Translators IpsoFracto Fractal Generation Language Leo Gertsenshteyn lpg2006 AT columbia DOT edu Sarah Gilman srg2104 AT columbia DOT edu Rob Notwicz rcn15 AT columbia DOT edu Anya Robertson alr33 AT columbia DOT edu Part I IpsoFracto Whitepaper Introduction IpsoFracto is a language for defining fractals from basic lines polygons and kinks bends in a line It produces bitmap images of a fractal from the code This is a handy tool allowing a user to alter the definition of their fractal by changing the initial shape or the kinks applied to the lines and quickly see the results Usability IpsoFracto is a simple language with very few syntactic restraints The language is easy to use due to the visual nature of the results if a user is unsure of what the attributes of a kink do they can always change them and see immediately what they control In this way IpsoFracto is well suited to the beginner even one relatively unfamiliar with programming or fractal math Portability IpsoFracto uses ANLTR to parse the code initially and a Java interpreter to produce bitmap images from the AST This allows IpsoFracto programs to be compiled on any platform that supports ANTLR and Java Error Handling IpsoFracto is a fairly simple language with very few possible errors The parser catches all syntax errors and the interpreter is responsible for catching errors such as invalid points It will obviously be possible for a user to get unexpected images but the nature of the language makes it easy for the user to return to the program and alter lines or kinks Library Kinks are defined in a library They take parameters indicating ratios of the entire line on which they are placed to the height and width of the kink itself For instance trikink 5 5 produces a triangle shaped kink with a height and width each roughly equal to one fifth of the line on which it is placed All kinks can be applied to lines using the apply function with the key word parameters for positions LEFT RIGHT and CENTER and line orientation POS and NEG as well as a parameter for specifying how many kinks should appear next to each other Data Types IpsoFracto has three main data types Line MultiLine and Polygon These define the basic starting points for the fractal All three are based on an implicit type the Point which is a 2 D position in the bitmap Lines MultiLines and Polygons are all sets of Points linked with the operators and These operators indicate the orientation of a line For example Line myline 0 10 0 30 defines a line from 0 10 to 0 30 while Line myline 0 10 0 30 defines a line from 0 30 to 0 10 These operators were chosen because it is intuitively clear which point is the start and which is the end of the line Multilines and Polygons are collections of points with the Polygon having an added implicit line from the last point to the first For example Polygon mysquare 0 10 10 10 10 20 0 20 defines a square Scope All Lines defined in a program will be valid and available throughout the program Lines MultiLines and Polygons should be defined at the top of the file since they are the starting point for the fractal Control flow IpsoFracto supports iter loops a variant of the for loop in order to allow the user to chose how many times they wish to apply a kink to a line These can be controlled by the number of kink iterations by the time to add kinks or by the kink size IpsoFracto also supports a variation of the standard if statement in order to allow the user to alter the kink applied based on variables such as the current iteration count Sample syntax line lineA 20 0 50 0 iter 2 apply lineA CENTER POS trikink 3 3 1 This syntax defines a single line and then iteratively places a single triangular kink in the line at the center position and positive orientation This syntax produces a fractal that looks like this Extensions It is easy to extend IpsoFracto by defining libraries with new kinks Part II IpsoFracto Language Tutorial Introduction IpsoFracto is a simple language for fractal generation The graphical fractal output is written to a bitmap file IpsoFracto is fairly easy to use and a great deal can be accomplished with a small amount of code This tutorial will walk you through writing your first IpsoFracto program and highlight the basic commands you will need to develop more complex programs The most basic block required for an IpsoFracto program is a line in a loose sense as all graphical manipulation is ultimately done on a line You may declare and assign Points Lines Polygons MultiLines and or Groups in IpsoFracto programs Polygons MultiLines and Groups can be seen as collections of Lines and Points as the building blocks for Lines The lines within a Polygon or within a MultiLine are connected to one another A polygon has the distinction of being an implicitly closed shape A Group on the other hand is simply a collection of possibly unrelated lines Every object declared in an IpsoFracto program is automatically part of a group called Thegroup This is useful to allow the application of effects on all lines in the program Lines are manipulated by applying kinks to them A kink is simply a bend in the line Installing IpsoFracto First unzip the IpsoFracto zip archive In the root directory are two batch files Run build bat to compile all code by typing build on the command line from the root directory of IpsoFracto Getting Started Every IpsoFracto program is in a separate text file and each begins with an export line This line is of the following format export path filename where path filename is replaced by the path and filename of the output bitmap file Choose a location for your output file create a text file for your IpsoFracto program and insert the export line at the top of the file You are now ready to add statements to your program Statements There are several types of statements valid in IpsoFracto programs declarations assignments postfix increment and decrement control flow statements and function calls All statements except the initial export statement and control flow statements end with a bang or question mark The choice between these is at the programmer s discretion Declarations and Assignments Points are declared with the Point keyword followed by a label for the point the assignment operator then either the label of an existing point or the definition of a new one A new point definition consists of the x and y coordinates separated by a comma and enclosed in square brackets The


View Full Document

Columbia COMS W4115 - IpsoFracto - Fractal Generation Language

Documents in this Course
YOLT

YOLT

13 pages

Lattakia

Lattakia

15 pages

EasyQL

EasyQL

14 pages

Photogram

Photogram

163 pages

Espresso

Espresso

27 pages

NumLang

NumLang

6 pages

EMPATH

EMPATH

14 pages

La Mesa

La Mesa

9 pages

JTemplate

JTemplate

238 pages

MATVEC

MATVEC

4 pages

TONEDEF

TONEDEF

14 pages

SASSi

SASSi

16 pages

JTemplate

JTemplate

39 pages

BATS

BATS

10 pages

Synapse

Synapse

11 pages

c.def

c.def

116 pages

TweaXML

TweaXML

108 pages

Load more
Loading Unlocking...
Login

Join to view IpsoFracto - Fractal Generation Language and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view IpsoFracto - Fractal Generation Language and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?