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
| // rollup.config.js (builds src/api => api -- use `rollup -c` to build) | |
| import { join } from 'path'; | |
| import { mkdirSync, copyFileSync, statSync, readdirSync } from 'fs'; | |
| import babel from '@rollup/plugin-babel'; | |
| import resolve from '@rollup/plugin-node-resolve'; | |
| const API_DIR = join(process.cwd(), 'src/api'); | |
| const BUILD_DIR = join(process.cwd(), 'api'); | |
| // Copy package.json to build dir |
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 { Vector3 } from 'https://cdn.skypack.dev/three'; | |
| const tempVector = new Vector3(); | |
| function deCasteljauAlgorithm(vectors, t) { | |
| if (t === 1) return vectors[vectors.length - 1]; | |
| if (t === 0 || vectors.length === 1) return vectors[0]; | |
| const calculatedVectors = []; |
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 deCasteljauAlgorithm(points, t) { | |
| if (t === 1) return points[points.length - 1]; | |
| if (t === 0 || points.length === 1) return points[0]; | |
| const calculatedPoints = []; | |
| for (let i = 1; i < points.length; i++) { | |
| const [p1X, p1Y] = points[i - 1]; | |
| const [p2X, p2Y] = points[i]; |
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
| <!DOCTYPE > | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <style> | |
| body { | |
| margin: 0; | |
| } | |
| canvas { |
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
| body { | |
| margin: 0; | |
| } | |
| canvas { | |
| display: block; | |
| } | |
| video { | |
| display: none; |
NewerOlder