Skip to content

Instantly share code, notes, and snippets.

@satoruhiga
satoruhiga / retina2normal.py
Created July 11, 2011 19:19
retina2normal.py
#!/usr/bin/env python
import os, sys
imgs = [x for x in os.listdir('.') if x.endswith('@2x.png')]
for i in imgs:
t = i.replace('@2x.png', '.png')
os.system("convert -resize 50%% %s %s" % (i, t))
@satoruhiga
satoruhiga / PolygonArc.hpp
Created August 10, 2011 16:10
PolygonArc
class PolygonArc
{
public:
PolygonArc()
{
curveResolution = 4;
}
void draw()
@satoruhiga
satoruhiga / testApp.cpp
Created August 18, 2011 18:44
Strip Sphere
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup()
{
ofSetFrameRate(60);
ofSetVerticalSync(true);
ofBackground(0);
@satoruhiga
satoruhiga / ofxKdTree.h
Created August 22, 2011 17:14
ofxKdTree
#include "kdtree.h"
template<class T>
class ofxKdTree
{
public:
ofxKdTree()
{
kd = kd_create(3);
@satoruhiga
satoruhiga / ofxSmooth.h
Created August 30, 2011 15:28
ofxSmooth.h
#pragma once
#include "ofMain.h"
template <class T>
class ofxSmooth
{
T value, value_t;
float smooth;
@satoruhiga
satoruhiga / ofxRecordableOscReceiver.h
Created September 23, 2011 00:32
ofxRecordableOscReceiver
#pragma once
#include "ofMain.h"
#include "ofxOsc.h"
#define OFX_RECOSC_SAVE_XML
#ifdef OFX_RECOSC_SAVE_XML
#include "ofxXmlSettings.h"
#endif
@satoruhiga
satoruhiga / ofxSimpleParticleSystem.h
Created September 29, 2011 14:06
ofxSimpleParticleSystem
#pragma once
#include "ofMain.h"
#include <tr1/array>
/*
// EXAMPLE
#include "testApp.h"
#include "ofxSimpleParticleSystem.h"
@satoruhiga
satoruhiga / testApp.cpp
Created October 19, 2011 16:58
Multithreaded image loading
#include "testApp.h"
static CGLContextObj ctx;
static CGLPixelFormatObj pixStuff;
class MyThread : public ofThread
{
public:
ofImage image;
@satoruhiga
satoruhiga / homography2glModelViewMatrix.h
Created December 5, 2011 08:45
homography2glModelViewMatrix
inline ofMatrix4x4 homography2glModelViewMatrix(const cv::Mat &homography)
{
ofMatrix4x4 matrix;
matrix(0, 0) = homography.at<double>(0, 0);
matrix(0, 1) = homography.at<double>(1, 0);
matrix(0, 2) = 0;
matrix(0, 3) = homography.at<double>(2, 0);
matrix(1, 0) = homography.at<double>(0, 1);
@satoruhiga
satoruhiga / readDepthPixelsToImage.h
Created December 11, 2011 12:38
readDepthPixelsToImage
void readDepthPixelsToImage(ofFloatImage &image)
{
glPopAttrib();
glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT );
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, image.getWidth(), image.getHeight(), GL_DEPTH_COMPONENT, GL_FLOAT, image.getPixels());
glPopClientAttrib();
image.update();
}