mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Support published three.js rotations, bounds, ray intersections, culling, and vertex attributes on native and WASM targets without a JavaScript engine. - Preserve JavaScript class defaults, data descriptors, and captured loop bindings in static code. - Handle typed-array input unions and constructor identities while keeping unsupported method overrides explicit.
9 lines
347 B
JavaScript
9 lines
347 B
JavaScript
class Vector { constructor(x = 0) { this.x = x; } dot(other) { return this.x * other.x; } }
|
|
class Plane { constructor() { this.normal = new Vector(2); } }
|
|
class Ray {
|
|
constructor() { this.direction = new Vector(3); }
|
|
distance(plane) { return plane.normal.dot(this.direction); }
|
|
}
|
|
const ray = new Ray();
|
|
console.log(ray.distance(new Plane()));
|