background preloader

Haskel

Facebook Twitter

sDrop, a processing library by andreas schlegel. About sDrop is a library written by Andreas Schlegel for the programming environment processing.

sDrop, a processing library by andreas schlegel.

Last update, 05/09/2010. sDrop is a processing library that lets you drag and drop objects such as files, images, bookmarks, or text into your processing sketch. once dropped you can access the information of the object from a DropEvent that has been forwarded to the processing sketch. Installation unzip and put the extracted sDrop folder into your processing sketches folder. reference and examples are also included in the sDrop folder.

Export to Applet The security regulations for applets are very high and strict, in order to make sDrop work properly within an applet, you need to make fields and functions which are used by sDrop public in your code. Details Keywords dnd,drag,drop Reference. Source. Platform osx,windows,linux Processing 1.1 Dependencies none. Drawing trees with Haskell and Cairo. I'd like to draw a tree, but how?

Drawing trees with Haskell and Cairo

Let's start by writing a simple draw loop: module Main where import Graphics.Rendering.Cairo import Canvas main = canvas draw 600 600 draw w h t = do color white rectangle 0 0 w h fill color black drawTree w h t Then, what is a tree? Let's define a simple branch as a function of age and angle. Branch 0 angle = [map (rotateP angle) [(0,0), (0, -1)]] branch n angle = this ++ subBranches where this = branch 0 angle [[_,(x,y)]] = this subBranches = map (map (translateP x y)) (left ++ right) left = branch (n-1) (angle-pi/8) right = branch (n-1) (angle+pi/8) To draw the branches, we need to write the drawTree procedure. DrawTree w h t = do translate (w/2) (h/2) rotate t mapM_ strokeLine tree where tree = map (map (uscaleP 25)) $ branch 7 0 You can see the result on the right. To draw lines of different thickness, we need to add the thickness information to the line data structure. StrokeWidthLine = tupleDo lineWidth strokeLine mapWidthLine f = fupleR (map f)

Haskell IDE in Haskell. Chrome Web Store - Apps, Extensions and Themes. … wherein I use Haskell to model lightning, impress my boss, and have more fun than I probably should have. Scientific programming and Haskell Let’s face it: most scientific programming is boring. The bulk is simple array manipulations, data handling, and making plain vanilla plots. There are a few beautiful algorithms, but the goal is to solve problems, not solve problems beautifully (perhaps explaining the continued survival of Fortran?). Enter Haskell. Enter lightning. Lightning modeling First, the physics. The most impressive way to describe this is a movie . This suggests the skeleton of an algorithm. Start: define a positive and negative charge regions. Initiate: form a conducting channel. Evolve: let charges flow according to the laws of physics. Branch: choose a likely point at random and extend the network.

The resulting structure should be a branching tree connecting the original positive and negative charge regions… a lot like lightning. Implementation Voltages Electric fields Graphics. Notes on Haskell.