Skip to content

Instantly share code, notes, and snippets.

View r-lyeh-archived's full-sized avatar

r-lyeh-archived

View GitHub Profile
@albeva
albeva / gist:2975962
Created June 23, 2012 00:25
C++11 variadic template based tuple sort
#include <iostream>
#include <utility>
#include <tuple>
using namespace std;
//
// forward declare
//
template<int N1, int N2, int LAST, typename T>
@rorydriscoll
rorydriscoll / FeatherUI.cpp
Created January 8, 2012 21:56
Mikko Mononen's UI 'feathering' technique
void CalculateEdgeNormal(float& nx, float& ny, float x0, float y0, float x1, float y1)
{
const float x01 = x1 - x0;
const float y01 = y1 - y0;
const float length = Sqrt(x01 * x01 + y01 * y01);
const float dx = x01 / length;
const float dy = y01 / length;