This file contains hidden or 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 { Type, typedArray } from '@thi.ng/api' | |
| import { MemPool } from '@thi.ng/malloc' | |
| import { Vec } from '@thi.ng/vectors' | |
| import { computeNewData } from './buffers' | |
| const { numSliceRows, numSliceColumns, resolution } = globalState.deref() | |
| const poolSize = numSliceRows * numSliceColumns * (resolution + 3) | |
| const POOL = new MemPool({ size: poolSize }) | |
| console.log('poolSize of', { poolSize }) |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| from io import BytesIO | |
| import numpy as np | |
| import numpy.linalg as linalg | |
| import scipy.interpolate as interpolate | |
| from PIL import Image | |
| from flask import Flask, send_file, escape, request | |
| app = Flask(__name__) |
This file contains hidden or 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 circlePath(cx=0, cy=0, r=10) { | |
| // https://stackoverflow.com/a/10477334/433685 | |
| const startPointX = - r | |
| const startPointY = 0 | |
| return `M ${cx} ${cy} | |
| m ${startPointX}, ${startPointY} | |
| a ${r},${r} 0 1,0 ${(r * 2)},0 |
This file contains hidden or 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 numpy as np | |
| def cube_geometry(x, y, z): | |
| xSize = x / 2 | |
| ySize = y / 2 | |
| zSize = z / 2 | |
| positions = np.array([ | |
| [-xSize, ySize, zSize], [xSize, ySize, zSize], | |
| [-xSize, -ySize, zSize], [xSize, -ySize, zSize], |
This file contains hidden or 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 { useState, useEffect } from 'react'; | |
| import { noop } from 'lodash'; | |
| /** original code from | |
| * https://usehooks.com/useScript/ | |
| * https://stackoverflow.com/a/51242436/433685 | |
| * */ | |
| function isScriptLoaded(src: string) { | |
| return document.querySelector('script[src="' + src + '"]') ? true : false; |
This file contains hidden or 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 ab2str(buf: any) { | |
| return Buffer.from(buf).toString("utf8"); | |
| } | |
| console.log("hello"); | |
| var oReq = new XMLHttpRequest(); | |
| console.log(oReq); | |
| oReq.addEventListener("load", reqListener); | |
| oReq.open("GET", "./test.env"); | |
| oReq.responseType = "arraybuffer"; |
This file contains hidden or 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 { clearDOM } from '@thi.ng/hdom' | |
| import { Vec } from '@thi.ng/vectors' | |
| import { buildSketch3d } from './sketch-skelton' | |
| import { adaptDPI, CanvasHandlers } from '@thi.ng/hdom-components' | |
| import { compileModel, draw, ModelSpec, shader, quad } from '@thi.ng/webgl' | |
| import { | |
| defMain, | |
| assign, | |
| FLOAT0, | |
| FLOAT1, |
This file contains hidden or 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 * as tx from "@thi.ng/transducers"; | |
| import { clearDOM } from "@thi.ng/hdom"; | |
| import { | |
| stream, | |
| Stream, | |
| sync, | |
| fromRAF, | |
| sidechainToggle | |
| } from "@thi.ng/rstream"; | |
| import { updateDOM } from "@thi.ng/transducers-hdom"; |
This file contains hidden or 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
| // use typescript | |
| // use math.js | |
| import math from "mathjs"; | |
| // a | |
| // a1 a2 b c d | |
| // (2^n*n!)^(-1/2) * Pi^(-1/4) * Exp[-x^2/2] * HermiteH[n, x]; | |
| function psi(n: number, x: number) { |
This file contains hidden or 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 { renderOnce, clearDOM } from "@thi.ng/hdom"; | |
| import * as svg from "@thi.ng/hiccup-svg"; | |
| import * as tx from "@thi.ng/transducers"; | |
| import * as isec from "@thi.ng/geom-isec"; | |
| import { add2, subN2 } from "@thi.ng/vectors"; | |
| import { poissonDiscSampler } from "./poisson-disc-sampler"; | |
| const width = 600; | |
| const height = 500; |