Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit | |
height: 500 | |
border: no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shuffle(arr) { | |
for (let i = arr.length - 1; i >= 0; i--) { | |
let j = Math.floor(Math.random() * (i + 1)); | |
j = Math.max(Math.min(j, i), 0); | |
const tmp = arr[i]; | |
arr[i] = arr[j]; | |
arr[j] = tmp; | |
} | |
return arr; | |
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class HeapSet { | |
constructor (values) { | |
this._values = values; | |
this._list = new Array(values.length * 3); | |
this._idToIndex = {}; | |
const list = this._list; | |
for (let i = 0, prev = -1; i < values.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isLeft (x0, y0, x1, y1, x2, y2) { | |
return ((x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0)); | |
} | |
export default function pointInPoygon (x, y, V) { | |
let wn = 0; // winding number | |
for (let i = 0; i < V.length - 1; i++) { // edge from V[i] to V[i+1] | |
const vi = V[i], vj = V[i + 1]; | |
if (vi.y <= y) { // start y <= P.y | |
if (vj.y > y) { // an upward crossing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nodes": [ | |
{ | |
"id": 0, | |
"data": { | |
"type": "device", | |
"name": "iPhone" | |
} | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function circleContainsCircle(cx, cy, cr, x, y, r) { | |
const dx = cx - x; | |
const dy = cy - y; | |
const dr = cr - r; | |
// reduce precision not to deal with square roots | |
return (dx * dx + dy * dy) < (dr * dr + 1e-6); | |
} | |
function from2discs(ax, ay, bx, by, ar, br) { | |
const dx = bx - ax; |