Skip to content

Instantly share code, notes, and snippets.

@notlion
notlion / MapUtil.as
Created January 26, 2010 00:58
Utility for ModestMaps
package candymaps.map
{
import com.modestmaps.geo.Location;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
public class MapUtil
{
@notlion
notlion / draw_demo.cpp
Created April 3, 2010 20:26
View Space Tri Strips Shader
void Arc::draw(ofxShader& shader)
{
GLuint pr_loc = glGetAttribLocationARB(shader.shader, "a_vtx_pr");
GLuint nx_loc = glGetAttribLocationARB(shader.shader, "a_vtx_nx");
glColor4f(color.x, color.y, color.z, 1);
glBegin(GL_TRIANGLE_STRIP);
ofxVec3f vtx_pr, vtx, vtx_nx;
vtx_nx.set(p1);
for(int i = 1; i < n_steps; i++){
TouchMgr::TouchMgr(AppCocoaTouch *app)
{
app->registerTouchesBegan(this, &TouchMgr::onTouchesBegan);
}
bool TouchMgr::onTouchesBegan(TouchEvent e)
{
const std::vector<TouchEvent::Touch> touches = e.getTouches();
for(std::vector<TouchEvent::Touch>::const_iterator tit = touches.begin(); tit != touches.end(); ++tit){
active_pnts.insert(std::make_pair(tit->getId(), TouchPoint(tit->getPos())));
@notlion
notlion / grab_srtm_tiffs.py
Created November 27, 2010 18:57
SRTM Elevation Image Grabber
import commands
import os
baseUrl = "http://hypersphere.telascience.org/elevation/cgiar_srtm_v4/tiff/zip/"
for x in range(1,73):
for y in range(1,25):
zipname = "srtm_%02d_%02d.ZIP" % (x, y)
tifname = "srtm_%02d_%02d.TIF" % (x, y)
@notlion
notlion / Plask.sublime-build
Created June 16, 2011 21:29
Plask Build File for SublimeText 2
{
"cmd": [ "Plask", "${file}" ],
"selector": "source.js",
"path": "< path to >/Plask.app/Contents/MacOS/",
"working_dir": "${file_path}"
}
@notlion
notlion / hello_pdf.js
Created June 17, 2011 23:55
Messy Circle Drawer
var plask = require('plask');
plask.SkPath.prototype.splineTo = function(vertices){
var nv = vertices.length;
if(nv >= 3){
var p0, p1, p2;
for(var i = 1, n = nv - 1; i <= n; i++){
p0 = vertices[i - 1];
p1 = vertices[i];
if(i == n){ // finish him
var x = 0;
var y = 0;
var symbols = [215, 178, 177, 221];
var punct = [232, 233, 234, 235];
var si = 0, pi = 0;
function printSym(s){
pSymbolA(s);
pPixel(x, y);
x += 1;
@notlion
notlion / obj.js
Created August 5, 2011 13:01
Plask OBJ Loader
// Based on Dean McNamee's OBJ loader
// Modified to output triangles with texture coords
function loadOBJ(filename){
var filedata = fs.readFileSync(filename, 'utf8');
var lines = filedata.split('\n');
var tris = [ ];
var v = [ null, ]; // Verts, indexed from 1, so put in a filler.
@notlion
notlion / test_vec3_rotate.js
Created October 6, 2011 11:46
Test for Plask Vec3.rotate()
var plask = require("plask");
plask.simpleWindow({
settings: {
type: "3d",
width: 500,
height: 500,
multisample: true
},
rotateBuffer: function(axis, theta){
@notlion
notlion / test_plane_intersectApp.cpp
Created October 16, 2011 02:33
Test Cinder Ray / Plane Intersection
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/Rand.h"
#include "cinder/Camera.h"
#include "cinder/Perlin.h"
using namespace ci;
using namespace ci::app;
using namespace std;