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
'use strict' | |
var getWingedEdges = function( g ){ | |
var edgeMap = {}; | |
// find the edges | |
function getEdgeKey( i0, i1 ){ | |
return Math.min(i0, i1) + '_' + Math.max(i0, i1); | |
} |
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
# overwrite master with contents of seotweaks branch (seotweaks > master) | |
git checkout seotweaks # source name | |
git merge -s ours master # target name | |
git checkout master # target name | |
git merge seotweaks # source name |
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
// 1D gaussian kernel | |
// pretty much ripped from here: http://www.apileofgrains.nl/blur-filters-c/ | |
vector<float> gaussianKernel( int radius, float weight = 1.) | |
{ | |
int mem_amount = (radius*2)+1; | |
vector<float> kernel( (radius*2) + 1 ); | |
float twoRadiusSquaredRecip = 1.0 / (2.0 * radius * radius); | |
float sqrtTwoPiTimesRadiusRecip = 1.0 / (sqrt(2.0 * PI) * 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
static void makeScreenQuad(ofMesh& m, float w=2, float h=2) | |
{ | |
w *= .5; | |
h *= .5; | |
m.clear(); | |
m.addVertex(ofVec3f(-w,-h,0)); | |
m.addVertex(ofVec3f( w,-h,0)); | |
m.addVertex(ofVec3f( w, h,0)); | |
m.addVertex(ofVec3f(-w, h,0)); |
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
//theta in [0,TWO_PI), phi in [0,PI], and where radius in [0,infty) | |
static ofVec3f pointOnSphere(float theta, float phi, float radius = 50) | |
{ | |
ofVec3f p; | |
p.x = radius * cos(theta) * sin(phi); | |
p.y = radius * cos(phi); | |
p.z = radius * sin(theta) * sin(phi); | |
return p; |
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
// | |
// Mesh2Points.h | |
// | |
// Created by lars berg on 8/1/14. | |
// | |
#pragma once | |
#include "ofMain.h" |
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" | |
namespace RandomPointsOnMesh | |
{ | |
static float areaOfTriangle(ofVec3f p0, ofVec3f p1, ofVec3f p2) | |
{ | |
return (p2 - p1).cross(p0 - p1).length() * .5; |
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
static void addSvgToMesh(string dir, ofMesh& m) | |
{ | |
ofxSVG svg; | |
svg.load(dir); | |
for ( auto i=0; i<svg.getNumPath(); i++ ) | |
{ | |
auto& path = svg.getPathAt(i); | |
path.simplify(); | |
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 ofApp::draw() | |
{ | |
ofEnableAlphaBlending(); | |
//pass 1 | |
glEnable(GL_CULL_FACE); | |
glCullFace(GL_FRONT); | |
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
if (!document.styleSheets.length) document.head.appendChild(document.createElement('style')); | |
var sheet = document.styleSheets[document.styleSheets.length - 1]; | |
var rules = {}; | |
function cssRule(selector, styles) { | |
var index; | |
if (selector in rules) { | |
index = rules[selector]; | |
sheet.deleteRule(index); | |
} else { | |
index = rules[selector] = sheet.cssRules.length; |
NewerOlder