Instantly share code, notes, and snippets.

💭
learning

# Alexander Milevskiw8r

💭
learning
• Sort options
Last active Mar 20, 2020
BVH
 The MIT License (MIT) Copyright (c) 2018 Ricky Reusser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Created Nov 24, 2017
View Cubic Catmull-Rom curve segment length approximation
 // // CatmullRomLength() // // //******************************************************************************************* template T CatmullRomLength( const CVector2 &p0, const CVector2 &p1, const CVector2 &p2, const CVector2 &p3,
Created Nov 22, 2017
2D point projection onto cubic (Catmull-Rom) curve
View gist:d47be1fbd0f240b5051bdc81cb62f79e
 // // CatmullRomCurveProjectPt() // // //******************************************************************************************* template T CatmullRomCurveProjectPt( const CVector2 &p0, const CVector2 &p1, const CVector2 &p2, const CVector2 &p3,
Created Nov 15, 2017
 using System.Collections.Generic; using UnityEngine; public interface QuadtreeItem { Rect GetBounds(); } public class QuadtreeNode where T : QuadtreeItem { const int MAX_DEPTH = 10;
Created Oct 18, 2017
How to use regl in React or React Native
View Bunny.js
 import React, { PureComponent } from "react"; import { StyleSheet } from "react-native"; import ReglView from "./ReglView"; import mat4 from "gl-mat4"; import bunny from "bunny"; export default class Bunny extends PureComponent { drawCommand = regl => { return regl({ vert: `
Last active Jul 31, 2020
How to make a scientific looking PDF from markdown (with bibliography)
Last active Jul 2, 2018
Force-directed layout
View .block
Last active Jul 16, 2018
World Tour along Flying Arcs
Last active Nov 25, 2019
Smoother polygon transitions

Smooth transitioning US tour in the same vein as this example. Steps:

1. Compares both shapes and adds evenly-spaced points to whichever polygon has fewer so that both have the same number of points
2. Picks the winding of the first polygon that minimizes the sum of the squared distances between point pairs

Some possible improvements:

• Adding additional points to both shapes first such that every segment longer than a certain distance is bisected
• Tweaking the placement of added points with simulated annealing
• Using a cost function that factors in self-intersections at the halfway mark in addition to distance traveled
Created May 30, 2016
BTree implementation in JavaScript
View btree.js
 #!/usr/bin/env node const NKEYS = 4; function arrayOfSize(size) { var a = Array(size); for (var i = 0; i < size; i += 1) a[i] = null;
You can’t perform that action at this time.