Skip to content

Instantly share code, notes, and snippets.

nicolas barradeau nicoptere

Block or report user

Report or block nicoptere

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
nicoptere / remove small paths in illustrator
Last active May 30, 2018
this will remove illustrator paths under a given length ( to clean up smaller paths basically )
View remove small paths in illustrator
#target illustrator
var document = app.activeDocument;
var maxLength = prompt ("maximum length of a path", 10, "destroy them with lasers!");
for (i=0 ; i< document.pathItems.length; i++)
var ipath = document.pathItems[i]
if( ipath.hidden == true )continue;
var l = 0;
for( var j = 0; j < ipath.pathPoints.length - 1; j++ ){
var p0 = ipath.pathPoints[j].anchor;
View affine transform
// and
function adj(m) { // Compute the adjugate of m
return [
m[4]*m[8]-m[5]*m[7], m[2]*m[7]-m[1]*m[8], m[1]*m[5]-m[2]*m[4],
m[5]*m[6]-m[3]*m[8], m[0]*m[8]-m[2]*m[6], m[2]*m[3]-m[0]*m[5],
m[3]*m[7]-m[4]*m[6], m[1]*m[6]-m[0]*m[7], m[0]*m[4]-m[1]*m[3]
nicoptere / toOBJ
Created Apr 14, 2017
converts a THREE.geometry to OBJ
View toOBJ
var str = "# object mesh \n";
var vs = g.getAttribute("position").array;
var ind = g.getIndex().array;
var precision = 6;
for( var i = 0 ; i < vs.length; i+=3 ){
View Object3D.js
* Created by nico on 19/02/14.
var Object3d = function( node, position, rotation )
this.node = node;
this.parent = null;
View gist:abe6cabf590158c885ecce0768cee41c
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
html, body{
overflow: hidden;
nicoptere / mixer
Created Jun 15, 2016
texture mixer
View mixer
<!DOCTYPE html>
<head lang="en">
<meta charset="UTF-8">
head, body{
overflow: hidden;
nicoptere / convert.jsx
Last active Jul 1, 2019
converts after effects layers' keyframes to JSON and saves file on hard drive.
View convert.jsx
//JSON object
"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(t){return 10>t?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),"function"==typeof rep&&(,t,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?i+"":"null";case"boolean":case"null":return i+"";case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;u>r;r+=1)f[r]=str(r,i)||"null";return o=0===f.length?"[]":gap?"[\n"+gap+f.join(",\n"+gap)+"\n"+a+"]":"["+f.join(",")+"]",gap=a,o}if(rep&&"object"==typeof rep)for(u=rep.length,r=0;u>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],o=str(n,i),o&&f.push
nicoptere / bresenham.js
Created Oct 20, 2015
bresenham circle / disc
View bresenham.js
function bresenhamCircle( cx,cy,r )
var x = 0,y = r,p;
ctx.fillRect( cx+x,cy-y, 1, 1 );
nicoptere / MercatorPlane.js
Last active Apr 7, 2019
THREE.js object that converts equirectangular (or spherical) projection to mercator projection
View MercatorPlane.js
var MercatorPlane = function()
// create the material
var vs = "varying vec2 vUv;\nvoid main() {\n vUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";
var fs = "uniform sampler2D map;\nvarying vec2 vUv;\n void main() {\nvec4 color = texture2D( map, vUv );\ngl_FragColor = color;\n}";
var material = new THREE.ShaderMaterial({
uniforms: {
map: { type: "t", value: null }
nicoptere / sortGauss.js
Created Aug 12, 2015
sorts an array by storing highest values in the "center"
View sortGauss.js
//sorts an array by storing highest values in the "center"
function sortGauss( array )
array.sort( function(a,b)
return a - b;
var a = [];
var b = [];
while( array.length > 0 )
You can’t perform that action at this time.