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 Tubes::computeEdgeCoordinateSystems() { | |
Vec3 dir; | |
float inv = 0.0f; | |
vector<Edge*>::iterator it = graph.edges.begin(); | |
while(it != graph.edges.end()) { | |
Edge* e = (*it); | |
dir = graph.getEdgeDirection(e).normalize(); | |
e->z_axis = dir; | |
if(fabsf(dir.x) > fabsf(dir.y)) { | |
inv = 1.0f / sqrtf(dir.x*dir.x + dir.z*dir.z); |
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
// Generate spiral | |
int prev_vertex = gr.addVertex(Vec3(0,0,0)); | |
int prev_node = gr.addNode(new Node(prev_vertex)); | |
int num_edges = 30; | |
float angle = 0; | |
float radius = 2.0f; | |
float y = 0; | |
for(int i = 0; i < num_edges; ++i) { | |
angle += ((float)TWO_PI/(num_edges*0.25)); | |
float x = cos(angle) * radius; |
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
// source: http://stackoverflow.com/questions/10105229/c-c-puzzle-to-print-values-from-1-15-15-1-with-a-single-for-loop | |
for (int i = 1; i < 31; i++) { | |
int number = (1-i/16) * i + (i/16) * (31 - i); | |
printf("%d ", number); | |
} |
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
ffmpeg -i 07.05.09_%04d.png -r 60 -s 640x480 -vcodec libx264 -vpre hq -b 2000k movie3.mov |
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
#ifndef SOLVERH | |
#define SOLVERH | |
#define IX(i,j) ((i)+(N+2)*(j)) | |
#define SWAP(x0,x) {float * tmp=x0;x0=x;x=tmp;} | |
#define FOR_EACH_CELL for ( i=1 ; i<=N ; i++ ) { for ( j=1 ; j<=N ; j++ ) { | |
#define END_FOR }} | |
static void add_source ( int N, float * x, float * s, float dt ) | |
{ | |
int i, size=(N+2)*(N+2); |
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" | |
testApp::testApp() { | |
} | |
void testApp::setup(){ | |
ofBackground(22,33,44); | |
ofSetFrameRate(60); | |
grad_w = 50; |
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" | |
// generate random data for "u" | |
void testApp::setup(){ | |
ofBackground(22,33,44); | |
float dt = 0.1; | |
for(int i = 0; i < N; ++i) { | |
u[i] = ofNoise(dt*i); | |
} | |
} |
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" | |
void testApp::setup(){ | |
ofSetFrameRate(60); | |
ofBackground(22,33,44); | |
gif.setup(ofGetWidth(), ofGetHeight()); | |
record = false; | |
// setup some initial data. |
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" | |
//-------------------------------------------------------------- | |
void testApp::setup(){ | |
ofEnableNormalizedTexCoords(); | |
ofDisableArbTex(); | |
ofSetFrameRate(60); | |
ofBackground(22,33,44); | |
// Shader + VAO/VBO |
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" | |
//-------------------------------------------------------------- | |
void testApp::setup(){ | |
ofSetFrameRate(60); | |
ofBackground(22,33,44); | |
// create shader program | |
shader.setupShaderFromSource(GL_VERTEX_SHADER, VS); |