Skip to content

Instantly share code, notes, and snippets.

Avatar

Éric Renaud-Houde num3ric

View GitHub Profile
@num3ric
num3ric / interleave.cpp
Last active Dec 2, 2020
In-place array interleaving
View interleave.cpp
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <assert.h>
typedef std::chrono::high_resolution_clock Clock;
template<typename T>
@num3ric
num3ric / gaussian_elim.py
Created Nov 11, 2011
Gaussian elimination using NumPy.
View gaussian_elim.py
import numpy as np
def GENP(A, b):
'''
Gaussian elimination with no pivoting.
% input: A is an n x n nonsingular matrix
% b is an n x 1 vector
% output: x is the solution of Ax=b.
% post-condition: A and b have been modified.
'''
@num3ric
num3ric / seqalignment.py
Created Sep 16, 2011
Sequence alignment - Dynamic programming algorithm
View seqalignment.py
#!/usr/bin/python -O
import numpy as np
from numpy import array
A, C, G, T = 0, 1, 2, 3
int_to_char = {0:'A', 1:'C', 2:'G', 3:'T'}
#indel = -1
#scoring = array([[1,-1,-1,-1],
#[-1,1,-1,-1],
View ray_tracing.glsl
/*
* Reviewing ray-tracing basics in glsl. Loosely based on Inigo Quilez's articles.
* Éric Renaud-Houde - num3ric.com
* December 2012
*/
#ifdef GL_ES
precision highp float;
#endif
@num3ric
num3ric / tutorial.md
Last active May 17, 2016
UE4 custom material nodes
View tutorial.md

Primer on how to use multiple custom material nodes in Unreal Engine 4

Create three custom nodes as follows:

Material Node Graph

SinewaveCustom (with output type CMOT Float 1)

//It is possible to use macros to define convenience local functions
#define SINENORM( arg ) 0.5 * ( sin( arg ) + 1.0 )
@num3ric
num3ric / easing.pde
Last active Dec 17, 2015
Easing demo in Processing.
View easing.pde
PVector b0, b1, b2, b3;
PVector pos, debutPos, ciblePos;
float t_anim, t_debut, t_duree;
void setup() {
size(400, 400);
background(0);
smooth();
t_anim = t_duree = 2000.0;
@num3ric
num3ric / QuatTestApp.cpp
Created Feb 25, 2013
Quaternion interpolation test
View QuatTestApp.cpp
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/Quaternion.h"
#include "cinder/Timeline.h"
#include "cinder/MayaCamUI.h"
using namespace ci;
using namespace ci::app;
using namespace std;
View random_walker.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
' 0 is forward mode (robot is moving)
' 1 is rotate mode (robot is rotating to randomAngle)
currentState VAR Bit
'Random bits for the random angle generation
randomBits VAR Word
@num3ric
num3ric / meta_frag.glsl
Created Sep 23, 2012
Shader Study 03 - Metaballs: vimeo.com/46562719
View meta_frag.glsl
/************************************
* Shader Study 03 : Metaballs *
* num3ric - Eric Renaud-Houde *
* Summer 2012 *
************************************/
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_texture_non_power_of_two : enable
@num3ric
num3ric / gluTestApp.cpp
Created Oct 29, 2011
Using glu NURBS inside Cinder.
View gluTestApp.cpp
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/Camera.h"
#include "cinder/MayaCamUI.h"
#if defined( CINDER_MAC )
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif