This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ofVec3f cartesianToSpherical(const ofVec3f &v) | |
{ | |
float r = v.length(); | |
float s = acos(v.z / r); | |
float f = atan2(v.y, v.x); | |
return ofVec3f(r, s, f); | |
} | |
ofVec3f sphericalToCartesian(const ofVec3f &v) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
struct Type2Int | |
{ | |
static unsigned int value() | |
{ | |
static size_t m = 0; | |
return (unsigned int)&m; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
struct Type2String | |
{ | |
static std::string value() | |
{ | |
throw std::runtime_error("unregistered type"); | |
} | |
}; | |
#define REGISTER_TYPE(t) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <sstream> | |
#include <vector> | |
#include <map> | |
namespace text_util | |
{ | |
typedef std::map<std::string, std::string> param; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "testApp.h" | |
#include "Poco/Base64Decoder.h" | |
// # encodeing | |
// $ base64 openFrameworks.png | |
string base64ImageData = "iVBORw0KGgoAAAANSUhEUgAAAHIAAAA8CAYAAAC6j+5hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sLGgwmJX2ZbqEAAAQrSURBVHja7Z2rdxtHFIe/34xspFO+f4BbXIXrD6hQkIMC2qAE1CygMbJBjWpSFhGjmoTJxRUpqniPeMXbZfHOLdjNqRw/9Kj2odm9TEBndefbO/cxd65kZrRVJD2r4DF/mdlC0hHwRUnP+FtVg5TUB74qPv5pZmldIHtyv5f/FHt/azb28j8LG5TwgDTDXvdKBHYEDBwMwPU/KeHR54uZq4tmENIAM2BmZnM6WQuimc17u4Z3gBsFbORRf+mtXP1dbADCw7AAnBr6LRCuO6hPQwTYCcie9A3olUdJYGdbdV/5CzHqyS2KLeqm43cfIoD7v8FCT+4D6BRISvzhCei0J/dB0rCDeBfi1hYpKXFw4ql8UROPLrz8LBDOzWzRQdzSIiUNPboS9VmGsIFHVy2zzkchbgzyUP7Eowug3wDF+h5dHMqftB3iRiC9/LuAHTdNw4Ade/l3EZct5hn2fFXk7taFKGzUWFWxkZeu4oQYXq9TNHH7DvE/mDqKyzLXh7gSZE/6bh8gLltmHD5zM4hPgswLynq1b0sQsOP9jmY3h/goSEl9j37c16Xw6FRS0haIj4J0cNqQFGPr1MTBSVsgPghS0rM6k/0dBj/Dis4ba4f4IEgH38cS93n0Qxsg3gNZWONRRIlYkp/MxA3xHkiH+za2lNrgRewQ74CUlJTUilB7oaDoVogW4h2QB7hjIpUD3ChmiHdABizaI6Hm6FYORCgOliUlnn1MoNcPeiQldR5EizDJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "ofMain.h" | |
bool loadObj(string path, ofMesh &mesh, ofImage *tex = NULL) | |
{ | |
path = ofToDataPath(path); | |
if (!ofFile::doesFileExist(path)) return false; | |
ifstream ifs(path.c_str()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "testApp.h" | |
#include "ofxCv.h" | |
using namespace ofxCv; | |
using namespace cv; | |
#include <opencv2/flann/flann.hpp> | |
ofMesh mesh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
import sys, os | |
if len(sys.argv) is not 2: | |
print 'usage: ./cstringify.py [FILENAME]' | |
sys.exit(-1) | |
filename = sys.argv[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |