Skip to content

Instantly share code, notes, and snippets.

View jeremyabel's full-sized avatar

Jeremy Abel jeremyabel

View GitHub Profile
var ncp = require('ncp').ncp;
var copyobj = require('../package.json').copy;
for (var prop in copyobj) {
ncp(copyobj[prop].src, copyobj[prop].dest, function (err) {
if (err) {
return console.error(err);
/* this code is licensed CC-0 https://creativecommons.org/publicdomain/zero/1.0/ . use as you see fit.*/
function distance(a, b) {
/* Find the Euclidean distance between two 2-dimensional points.
*
* a: the first point.
* b: the second point.
*
* returns: the distance.
*/
@mattatz
mattatz / Matrix.hlsl
Last active March 24, 2025 23:12
Matrix operations for HLSL
#ifndef __MATRIX_INCLUDED__
#define __MATRIX_INCLUDED__
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
float4x4 inverse(float4x4 m) {
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0];
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1];
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2];
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3];
from math import *
# a performant solution would store a prefix sum of line lengths to
# a sidechannel and then use that to do a bsearch; on the GPU,
# you'd do a sum tree / histopyramid as a preprocessing step
def find_point(points, d):
d = d
for i in range(1, len(points)):
x0,y0 = points[i-1]
x1,y1 = points[i]
@SammyJames
SammyJames / UnifiedDelegate.h
Last active March 24, 2025 20:22
A wrapper to handle native and script delegates
#pragma once
#include "Delegate.h"
#include "Delegates/IDelegateInstance.h"
#include "LogMacros.h"
#include "UnrealTypeTraits.h"
namespace Private
{
template <bool, class T>
package org.ygl.openrndr.demos
import org.openrndr.application
import org.openrndr.color.rgb
import org.openrndr.draw.LineCap
import org.openrndr.draw.renderTarget
import org.openrndr.extra.compositor.compose
import org.openrndr.extra.compositor.draw
import org.openrndr.extra.compositor.post
import org.openrndr.extra.fx.blur.FrameBlur