Skip to content

Instantly share code, notes, and snippets.

View monkstone's full-sized avatar

Martin Prout monkstone

View GitHub Profile
@monkstone
monkstone / elegant_ball.py
Created June 7, 2011 13:16
A pyprocessing sketch that uses PVector
"""
elegant_ball.py
Another opengl sketch from lazydog translated to pyprocessing by monkstone.
http://lazydog-bookfragments.blogspot.com/2009/05/final-version-of-ball-of
-confusion-for.html
"""
from pyprocessing import *
from math import pi, sqrt, sin
@monkstone
monkstone / csgrammar.py
Created June 10, 2011 15:35
Context Sensitive Grammar in python
axiom = 'baa[a]aaaa'
IGNORE='[]'
RULES = {
'b': 'a',
'b<a': 'b'
}
LEFT = -1
RIGHT = 1
@monkstone
monkstone / QuickHull3D.java
Created June 21, 2011 19:31
Updated quickhull 3D
/**
* Copyright John E. Lloyd, 2004. All rights reserved. Permission to use,
* copy, modify and redistribute is granted, provided that this copyright
* notice is retained and the author is given credit whenever appropriate.
*
* This software is distributed "as is", without any warranty, including
* any implied warranty of merchantability or fitness for a particular
* use. The author assumes no responsibility for, and shall not be liable
* for, any special, indirect, or consequential damages, or any damages
* whatsoever, arising out of or in connection with the use of this
@monkstone
monkstone / grammar.rb
Created July 12, 2011 18:14
Non Stochastic LSystem grammar in ruby
#############################################################
# library/grammar/grammar.rb
# Non-stochastic grammar
# with unique premise/rules
############################################################
class Grammar
attr_accessor :axiom, :rules
def initialize axiom
@axiom = axiom
@monkstone
monkstone / lut.LUT.java
Created July 12, 2011 18:15
Java sin/cos lookup table library
/**
* Copyright (c) 2011 Martin Prout
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* http://creativecommons.org/licenses/LGPL/2.1/
*
@monkstone
monkstone / rod_hilbert.rb
Created July 12, 2011 18:18
A little ruby script to create Rod Hilbert
class Rod_Hilbert < Processing::App
#full_screen # NB: All distances are relative to screen height
load_libraries 'grammar', 'lut'
import 'lut'
attr_reader :grammar, :production, :distance, :depth, :centre_adjust
# some lsystem constants
CENTER_ADJUST = [0, 0.5, 1.5, 3.5, 7.5]
XPOS = 0
@monkstone
monkstone / hilbert.rb
Created September 30, 2011 15:09
Hilbert Fractal Sketch
############################
# Non-stochastic grammar
# with unique premise/rules
############################
class Grammar
attr_accessor :axiom, :rules
def initialize axiom
@axiom = axiom
@rules = Hash.new
@monkstone
monkstone / newP5Main.java
Last active September 27, 2015 20:48
Processing Main Applet Produced From Template
<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">
import processing.core.*;
/**
*
* @author ${user}
@monkstone
monkstone / P5Library.java
Last active January 28, 2019 06:00
Template Files For Processing Applications in NetBeans
<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">
<#if package?? && package != "">
package ${package};
</#if>
/**
@monkstone
monkstone / .nbattrs
Last active September 27, 2015 20:58
Netbeans Template .nbattrs
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE attributes PUBLIC "-//NetBeans//DTD DefaultAttributes 1.0//EN" "http://www.netbeans.org/dtds/attributes-1_0.dtd">
<attributes version="1.0">
<fileobject name="P5Library.java">
<attr name="SystemFileSystem.icon" urlvalue="File:///home/tux/.netbeans/7.4/config/Templates/processing.png"/>
<attr name="displayName" stringvalue="Java P5Library"/>
<attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>
<attr name="template" boolvalue="true"/>
</fileobject>
<fileobject name="P5Main.java">