@vib3code/sdk 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -0
- package/DOCS/BLUEPRINT_EXECUTION_PLAN_2026-01-07.md +34 -0
- package/DOCS/CI_TESTING.md +38 -0
- package/DOCS/CLI_ONBOARDING.md +75 -0
- package/DOCS/CONTROL_REFERENCE.md +64 -0
- package/DOCS/DEV_TRACK_ANALYSIS.md +77 -0
- package/DOCS/DEV_TRACK_PLAN_2026-01-07.md +42 -0
- package/DOCS/DEV_TRACK_SESSION_2026-01-31.md +220 -0
- package/DOCS/ENV_SETUP.md +189 -0
- package/DOCS/EXPORT_FORMATS.md +417 -0
- package/DOCS/GPU_DISPOSAL_GUIDE.md +21 -0
- package/DOCS/LICENSING_TIERS.md +275 -0
- package/DOCS/MASTER_PLAN_2026-01-31.md +570 -0
- package/DOCS/OBS_SETUP_GUIDE.md +98 -0
- package/DOCS/PROJECT_SETUP.md +66 -0
- package/DOCS/RENDERER_LIFECYCLE.md +40 -0
- package/DOCS/REPO_MANIFEST.md +121 -0
- package/DOCS/SESSION_014_PLAN.md +195 -0
- package/DOCS/SESSION_LOG_2026-01-07.md +56 -0
- package/DOCS/STRATEGIC_BLUEPRINT_2026-01-07.md +72 -0
- package/DOCS/SYSTEM_AUDIT_2026-01-30.md +738 -0
- package/DOCS/SYSTEM_INVENTORY.md +520 -0
- package/DOCS/TELEMETRY_EXPORTS.md +34 -0
- package/DOCS/WEBGPU_STATUS.md +38 -0
- package/DOCS/XR_BENCHMARKS.md +608 -0
- package/LICENSE +21 -0
- package/README.md +426 -0
- package/docs/.nojekyll +0 -0
- package/docs/01-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/02-hyperspatial_ego_death.html +346 -0
- package/docs/03-post_cartesian_sublime.html +346 -0
- package/docs/04-crystalline_void_meditation.html +346 -0
- package/docs/05-quantum_decoherence_ballet.html +346 -0
- package/docs/06-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/07-hyperspatial_ego_death.html +346 -0
- package/docs/08-post_cartesian_sublime.html +346 -0
- package/docs/09-crystalline_void_meditation.html +346 -0
- package/docs/10-quantum_decoherence_ballet.html +346 -0
- package/docs/11-dissolution_of_euclidean_hegemony.html +346 -0
- package/docs/12-hyperspatial_ego_death.html +346 -0
- package/docs/13-post_cartesian_sublime.html +346 -0
- package/docs/index.html +794 -0
- package/docs/test-hub.html +441 -0
- package/docs/url-state.js +102 -0
- package/docs/vib3-exports/01-quantum-quantum-tetrahedron-lattice.html +489 -0
- package/docs/vib3-exports/02-quantum-quantum-hypersphere-matrix.html +489 -0
- package/docs/vib3-exports/03-quantum-quantum-hypertetra-fractal.html +489 -0
- package/docs/vib3-exports/04-faceted-faceted-crystal-structure.html +407 -0
- package/docs/vib3-exports/05-faceted-faceted-klein-bottle.html +407 -0
- package/docs/vib3-exports/06-faceted-faceted-hypertetra-torus.html +407 -0
- package/docs/vib3-exports/07-holographic-holographic-wave-field.html +457 -0
- package/docs/vib3-exports/08-holographic-holographic-hypersphere-sphere.html +457 -0
- package/docs/vib3-exports/09-holographic-holographic-hypertetra-crystal.html +457 -0
- package/docs/vib3-exports/index.html +238 -0
- package/docs/webgpu-live.html +702 -0
- package/package.json +367 -0
- package/src/advanced/AIPresetGenerator.js +777 -0
- package/src/advanced/MIDIController.js +703 -0
- package/src/advanced/OffscreenWorker.js +1051 -0
- package/src/advanced/WebGPUCompute.js +1051 -0
- package/src/advanced/WebXRRenderer.js +680 -0
- package/src/agent/cli/AgentCLI.js +615 -0
- package/src/agent/cli/index.js +14 -0
- package/src/agent/index.js +73 -0
- package/src/agent/mcp/MCPServer.js +950 -0
- package/src/agent/mcp/index.js +9 -0
- package/src/agent/mcp/tools.js +548 -0
- package/src/agent/telemetry/EventStream.js +669 -0
- package/src/agent/telemetry/Instrumentation.js +618 -0
- package/src/agent/telemetry/TelemetryExporters.js +427 -0
- package/src/agent/telemetry/TelemetryService.js +464 -0
- package/src/agent/telemetry/index.js +52 -0
- package/src/benchmarks/BenchmarkRunner.js +381 -0
- package/src/benchmarks/MetricsCollector.js +299 -0
- package/src/benchmarks/index.js +9 -0
- package/src/benchmarks/scenes.js +259 -0
- package/src/cli/index.js +675 -0
- package/src/config/ApiConfig.js +88 -0
- package/src/core/CanvasManager.js +217 -0
- package/src/core/ErrorReporter.js +117 -0
- package/src/core/ParameterMapper.js +333 -0
- package/src/core/Parameters.js +396 -0
- package/src/core/RendererContracts.js +200 -0
- package/src/core/UnifiedResourceManager.js +370 -0
- package/src/core/VIB3Engine.js +636 -0
- package/src/core/renderers/FacetedRendererAdapter.js +32 -0
- package/src/core/renderers/HolographicRendererAdapter.js +29 -0
- package/src/core/renderers/QuantumRendererAdapter.js +29 -0
- package/src/core/renderers/RendererLifecycleManager.js +63 -0
- package/src/creative/ColorPresetsSystem.js +980 -0
- package/src/creative/ParameterTimeline.js +1061 -0
- package/src/creative/PostProcessingPipeline.js +1113 -0
- package/src/creative/TransitionAnimator.js +683 -0
- package/src/export/CSSExporter.js +226 -0
- package/src/export/CardGeneratorBase.js +279 -0
- package/src/export/ExportManager.js +580 -0
- package/src/export/FacetedCardGenerator.js +279 -0
- package/src/export/HolographicCardGenerator.js +543 -0
- package/src/export/LottieExporter.js +552 -0
- package/src/export/QuantumCardGenerator.js +315 -0
- package/src/export/SVGExporter.js +519 -0
- package/src/export/ShaderExporter.js +903 -0
- package/src/export/TradingCardGenerator.js +3055 -0
- package/src/export/TradingCardManager.js +181 -0
- package/src/export/VIB3PackageExporter.js +559 -0
- package/src/export/index.js +14 -0
- package/src/export/systems/TradingCardSystemFaceted.js +494 -0
- package/src/export/systems/TradingCardSystemHolographic.js +452 -0
- package/src/export/systems/TradingCardSystemQuantum.js +411 -0
- package/src/faceted/FacetedSystem.js +963 -0
- package/src/features/CollectionManager.js +433 -0
- package/src/gallery/CollectionManager.js +240 -0
- package/src/gallery/GallerySystem.js +485 -0
- package/src/geometry/GeometryFactory.js +314 -0
- package/src/geometry/GeometryLibrary.js +72 -0
- package/src/geometry/buffers/BufferBuilder.js +338 -0
- package/src/geometry/buffers/index.js +18 -0
- package/src/geometry/generators/Crystal.js +420 -0
- package/src/geometry/generators/Fractal.js +298 -0
- package/src/geometry/generators/KleinBottle.js +197 -0
- package/src/geometry/generators/Sphere.js +192 -0
- package/src/geometry/generators/Tesseract.js +160 -0
- package/src/geometry/generators/Tetrahedron.js +225 -0
- package/src/geometry/generators/Torus.js +304 -0
- package/src/geometry/generators/Wave.js +341 -0
- package/src/geometry/index.js +142 -0
- package/src/geometry/warp/HypersphereCore.js +211 -0
- package/src/geometry/warp/HypertetraCore.js +386 -0
- package/src/geometry/warp/index.js +57 -0
- package/src/holograms/HolographicVisualizer.js +1073 -0
- package/src/holograms/RealHolographicSystem.js +966 -0
- package/src/holograms/variantRegistry.js +69 -0
- package/src/integrations/FigmaPlugin.js +854 -0
- package/src/integrations/OBSMode.js +754 -0
- package/src/integrations/ThreeJsPackage.js +660 -0
- package/src/integrations/TouchDesignerExport.js +552 -0
- package/src/integrations/frameworks/Vib3React.js +591 -0
- package/src/integrations/frameworks/Vib3Svelte.js +654 -0
- package/src/integrations/frameworks/Vib3Vue.js +628 -0
- package/src/llm/LLMParameterInterface.js +240 -0
- package/src/llm/LLMParameterUI.js +577 -0
- package/src/math/Mat4x4.js +708 -0
- package/src/math/Projection.js +341 -0
- package/src/math/Rotor4D.js +637 -0
- package/src/math/Vec4.js +476 -0
- package/src/math/constants.js +164 -0
- package/src/math/index.js +68 -0
- package/src/math/projections.js +54 -0
- package/src/math/rotations.js +196 -0
- package/src/quantum/QuantumEngine.js +906 -0
- package/src/quantum/QuantumVisualizer.js +1103 -0
- package/src/reactivity/ReactivityConfig.js +499 -0
- package/src/reactivity/ReactivityManager.js +586 -0
- package/src/reactivity/SpatialInputSystem.js +1783 -0
- package/src/reactivity/index.js +93 -0
- package/src/render/CommandBuffer.js +465 -0
- package/src/render/MultiCanvasBridge.js +340 -0
- package/src/render/RenderCommand.js +514 -0
- package/src/render/RenderResourceRegistry.js +523 -0
- package/src/render/RenderState.js +552 -0
- package/src/render/RenderTarget.js +512 -0
- package/src/render/ShaderLoader.js +253 -0
- package/src/render/ShaderProgram.js +599 -0
- package/src/render/UnifiedRenderBridge.js +496 -0
- package/src/render/backends/WebGLBackend.js +1108 -0
- package/src/render/backends/WebGPUBackend.js +1409 -0
- package/src/render/commands/CommandBufferExecutor.js +607 -0
- package/src/render/commands/RenderCommandBuffer.js +661 -0
- package/src/render/commands/index.js +17 -0
- package/src/render/index.js +367 -0
- package/src/scene/Disposable.js +498 -0
- package/src/scene/MemoryPool.js +618 -0
- package/src/scene/Node4D.js +697 -0
- package/src/scene/ResourceManager.js +599 -0
- package/src/scene/Scene4D.js +540 -0
- package/src/scene/index.js +98 -0
- package/src/schemas/error.schema.json +84 -0
- package/src/schemas/extension.schema.json +88 -0
- package/src/schemas/index.js +214 -0
- package/src/schemas/parameters.schema.json +142 -0
- package/src/schemas/tool-pack.schema.json +44 -0
- package/src/schemas/tool-response.schema.json +127 -0
- package/src/shaders/common/fullscreen.vert.glsl +5 -0
- package/src/shaders/common/fullscreen.vert.wgsl +17 -0
- package/src/shaders/common/geometry24.glsl +65 -0
- package/src/shaders/common/geometry24.wgsl +54 -0
- package/src/shaders/common/rotation4d.glsl +85 -0
- package/src/shaders/common/rotation4d.wgsl +86 -0
- package/src/shaders/common/uniforms.glsl +44 -0
- package/src/shaders/common/uniforms.wgsl +48 -0
- package/src/shaders/faceted/faceted.frag.glsl +129 -0
- package/src/shaders/faceted/faceted.frag.wgsl +164 -0
- package/src/shaders/holographic/holographic.frag.glsl +406 -0
- package/src/shaders/holographic/holographic.frag.wgsl +185 -0
- package/src/shaders/quantum/quantum.frag.glsl +513 -0
- package/src/shaders/quantum/quantum.frag.wgsl +361 -0
- package/src/testing/ParallelTestFramework.js +519 -0
- package/src/testing/__snapshots__/exportFormats.test.js.snap +24 -0
- package/src/testing/exportFormats.test.js +8 -0
- package/src/testing/projections.test.js +14 -0
- package/src/testing/rotations.test.js +37 -0
- package/src/ui/InteractivityMenu.js +516 -0
- package/src/ui/StatusManager.js +96 -0
- package/src/ui/adaptive/renderers/webgpu/BufferLayout.ts +252 -0
- package/src/ui/adaptive/renderers/webgpu/PolytopeInstanceBuffer.ts +144 -0
- package/src/ui/adaptive/renderers/webgpu/TripleBufferedUniform.ts +170 -0
- package/src/ui/adaptive/renderers/webgpu/WebGPURenderer.ts +735 -0
- package/src/ui/adaptive/renderers/webgpu/index.ts +112 -0
- package/src/variations/VariationManager.js +431 -0
- package/src/viewer/AudioReactivity.js +505 -0
- package/src/viewer/CardBending.js +481 -0
- package/src/viewer/GalleryUI.js +832 -0
- package/src/viewer/ReactivityManager.js +590 -0
- package/src/viewer/TradingCardExporter.js +600 -0
- package/src/viewer/ViewerPortal.js +374 -0
- package/src/viewer/index.js +12 -0
- package/src/wasm/WasmLoader.js +296 -0
- package/src/wasm/index.js +132 -0
- package/tools/agentic/mcpTools.js +88 -0
- package/tools/cli/agent-cli.js +92 -0
- package/tools/export/formats.js +24 -0
- package/tools/math/rotation-baseline.mjs +64 -0
- package/tools/shader-sync-verify.js +937 -0
- package/tools/telemetry/manifestPipeline.js +141 -0
- package/tools/telemetry/telemetryEvents.js +35 -0
- package/types/adaptive-sdk.d.ts +185 -0
- package/types/advanced/AIPresetGenerator.d.ts +81 -0
- package/types/advanced/MIDIController.d.ts +100 -0
- package/types/advanced/OffscreenWorker.d.ts +82 -0
- package/types/advanced/WebGPUCompute.d.ts +52 -0
- package/types/advanced/WebXRRenderer.d.ts +77 -0
- package/types/advanced/index.d.ts +46 -0
- package/types/core/ErrorReporter.d.ts +50 -0
- package/types/core/VIB3Engine.d.ts +204 -0
- package/types/creative/ColorPresetsSystem.d.ts +91 -0
- package/types/creative/ParameterTimeline.d.ts +74 -0
- package/types/creative/PostProcessingPipeline.d.ts +109 -0
- package/types/creative/TransitionAnimator.d.ts +71 -0
- package/types/creative/index.d.ts +35 -0
- package/types/integrations/FigmaPlugin.d.ts +46 -0
- package/types/integrations/OBSMode.d.ts +74 -0
- package/types/integrations/ThreeJsPackage.d.ts +62 -0
- package/types/integrations/TouchDesignerExport.d.ts +36 -0
- package/types/integrations/Vib3React.d.ts +74 -0
- package/types/integrations/Vib3Svelte.d.ts +63 -0
- package/types/integrations/Vib3Vue.d.ts +55 -0
- package/types/integrations/index.d.ts +52 -0
- package/types/reactivity/SpatialInputSystem.d.ts +173 -0
- package/types/reactivity/index.d.ts +394 -0
- package/types/render/CommandBuffer.d.ts +169 -0
- package/types/render/RenderCommand.d.ts +312 -0
- package/types/render/RenderState.d.ts +279 -0
- package/types/render/RenderTarget.d.ts +254 -0
- package/types/render/ShaderProgram.d.ts +277 -0
- package/types/render/UnifiedRenderBridge.d.ts +143 -0
- package/types/render/WebGLBackend.d.ts +168 -0
- package/types/render/WebGPUBackend.d.ts +186 -0
- package/types/render/index.d.ts +141 -0
package/src/math/Vec4.js
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vec4 - 4D Vector Class
|
|
3
|
+
*
|
|
4
|
+
* Represents a point or direction in 4-dimensional space.
|
|
5
|
+
* Uses Float32Array for GPU compatibility and potential SIMD optimization.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const v = new Vec4(1, 2, 3, 0.5);
|
|
9
|
+
* const normalized = v.normalize();
|
|
10
|
+
* const dot = v.dot(other);
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export class Vec4 {
|
|
14
|
+
/**
|
|
15
|
+
* Create a new 4D vector
|
|
16
|
+
* @param {number} x - X component
|
|
17
|
+
* @param {number} y - Y component
|
|
18
|
+
* @param {number} z - Z component
|
|
19
|
+
* @param {number} w - W component (4th dimension)
|
|
20
|
+
*/
|
|
21
|
+
constructor(x = 0, y = 0, z = 0, w = 0) {
|
|
22
|
+
// Use Float32Array for GPU compatibility
|
|
23
|
+
this.data = new Float32Array(4);
|
|
24
|
+
this.data[0] = x;
|
|
25
|
+
this.data[1] = y;
|
|
26
|
+
this.data[2] = z;
|
|
27
|
+
this.data[3] = w;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Property accessors for readability
|
|
31
|
+
get x() { return this.data[0]; }
|
|
32
|
+
set x(v) { this.data[0] = v; }
|
|
33
|
+
|
|
34
|
+
get y() { return this.data[1]; }
|
|
35
|
+
set y(v) { this.data[1] = v; }
|
|
36
|
+
|
|
37
|
+
get z() { return this.data[2]; }
|
|
38
|
+
set z(v) { this.data[2] = v; }
|
|
39
|
+
|
|
40
|
+
get w() { return this.data[3]; }
|
|
41
|
+
set w(v) { this.data[3] = v; }
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Create a Vec4 from an array
|
|
45
|
+
* @param {number[]|Float32Array} arr - Array with at least 4 elements
|
|
46
|
+
* @returns {Vec4}
|
|
47
|
+
*/
|
|
48
|
+
static fromArray(arr) {
|
|
49
|
+
return new Vec4(arr[0] || 0, arr[1] || 0, arr[2] || 0, arr[3] || 0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create a copy of this vector
|
|
54
|
+
* @returns {Vec4}
|
|
55
|
+
*/
|
|
56
|
+
clone() {
|
|
57
|
+
return new Vec4(this.x, this.y, this.z, this.w);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Copy values from another vector
|
|
62
|
+
* @param {Vec4} v - Source vector
|
|
63
|
+
* @returns {Vec4} this (for chaining)
|
|
64
|
+
*/
|
|
65
|
+
copy(v) {
|
|
66
|
+
this.data[0] = v.data[0];
|
|
67
|
+
this.data[1] = v.data[1];
|
|
68
|
+
this.data[2] = v.data[2];
|
|
69
|
+
this.data[3] = v.data[3];
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set all components
|
|
75
|
+
* @param {number} x
|
|
76
|
+
* @param {number} y
|
|
77
|
+
* @param {number} z
|
|
78
|
+
* @param {number} w
|
|
79
|
+
* @returns {Vec4} this
|
|
80
|
+
*/
|
|
81
|
+
set(x, y, z, w) {
|
|
82
|
+
this.data[0] = x;
|
|
83
|
+
this.data[1] = y;
|
|
84
|
+
this.data[2] = z;
|
|
85
|
+
this.data[3] = w;
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Add another vector (immutable)
|
|
91
|
+
* @param {Vec4} v
|
|
92
|
+
* @returns {Vec4} New vector
|
|
93
|
+
*/
|
|
94
|
+
add(v) {
|
|
95
|
+
return new Vec4(
|
|
96
|
+
this.x + v.x,
|
|
97
|
+
this.y + v.y,
|
|
98
|
+
this.z + v.z,
|
|
99
|
+
this.w + v.w
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Add another vector in place (mutable)
|
|
105
|
+
* @param {Vec4} v
|
|
106
|
+
* @returns {Vec4} this
|
|
107
|
+
*/
|
|
108
|
+
addInPlace(v) {
|
|
109
|
+
this.data[0] += v.data[0];
|
|
110
|
+
this.data[1] += v.data[1];
|
|
111
|
+
this.data[2] += v.data[2];
|
|
112
|
+
this.data[3] += v.data[3];
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Subtract another vector (immutable)
|
|
118
|
+
* @param {Vec4} v
|
|
119
|
+
* @returns {Vec4} New vector
|
|
120
|
+
*/
|
|
121
|
+
sub(v) {
|
|
122
|
+
return new Vec4(
|
|
123
|
+
this.x - v.x,
|
|
124
|
+
this.y - v.y,
|
|
125
|
+
this.z - v.z,
|
|
126
|
+
this.w - v.w
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Subtract another vector in place (mutable)
|
|
132
|
+
* @param {Vec4} v
|
|
133
|
+
* @returns {Vec4} this
|
|
134
|
+
*/
|
|
135
|
+
subInPlace(v) {
|
|
136
|
+
this.data[0] -= v.data[0];
|
|
137
|
+
this.data[1] -= v.data[1];
|
|
138
|
+
this.data[2] -= v.data[2];
|
|
139
|
+
this.data[3] -= v.data[3];
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Multiply by scalar (immutable)
|
|
145
|
+
* @param {number} s
|
|
146
|
+
* @returns {Vec4} New vector
|
|
147
|
+
*/
|
|
148
|
+
scale(s) {
|
|
149
|
+
return new Vec4(
|
|
150
|
+
this.x * s,
|
|
151
|
+
this.y * s,
|
|
152
|
+
this.z * s,
|
|
153
|
+
this.w * s
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Multiply by scalar in place (mutable)
|
|
159
|
+
* @param {number} s
|
|
160
|
+
* @returns {Vec4} this
|
|
161
|
+
*/
|
|
162
|
+
scaleInPlace(s) {
|
|
163
|
+
this.data[0] *= s;
|
|
164
|
+
this.data[1] *= s;
|
|
165
|
+
this.data[2] *= s;
|
|
166
|
+
this.data[3] *= s;
|
|
167
|
+
return this;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Component-wise multiply (Hadamard product)
|
|
172
|
+
* @param {Vec4} v
|
|
173
|
+
* @returns {Vec4} New vector
|
|
174
|
+
*/
|
|
175
|
+
multiply(v) {
|
|
176
|
+
return new Vec4(
|
|
177
|
+
this.x * v.x,
|
|
178
|
+
this.y * v.y,
|
|
179
|
+
this.z * v.z,
|
|
180
|
+
this.w * v.w
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Negate vector (immutable)
|
|
186
|
+
* @returns {Vec4} New vector
|
|
187
|
+
*/
|
|
188
|
+
negate() {
|
|
189
|
+
return new Vec4(-this.x, -this.y, -this.z, -this.w);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Negate vector in place (mutable)
|
|
194
|
+
* @returns {Vec4} this
|
|
195
|
+
*/
|
|
196
|
+
negateInPlace() {
|
|
197
|
+
this.data[0] = -this.data[0];
|
|
198
|
+
this.data[1] = -this.data[1];
|
|
199
|
+
this.data[2] = -this.data[2];
|
|
200
|
+
this.data[3] = -this.data[3];
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Dot product with another vector
|
|
206
|
+
* @param {Vec4} v
|
|
207
|
+
* @returns {number}
|
|
208
|
+
*/
|
|
209
|
+
dot(v) {
|
|
210
|
+
return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Squared length of vector (faster than length())
|
|
215
|
+
* @returns {number}
|
|
216
|
+
*/
|
|
217
|
+
lengthSquared() {
|
|
218
|
+
return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Length (magnitude) of vector
|
|
223
|
+
* @returns {number}
|
|
224
|
+
*/
|
|
225
|
+
length() {
|
|
226
|
+
return Math.sqrt(this.lengthSquared());
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Distance to another vector
|
|
231
|
+
* @param {Vec4} v
|
|
232
|
+
* @returns {number}
|
|
233
|
+
*/
|
|
234
|
+
distanceTo(v) {
|
|
235
|
+
return this.sub(v).length();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Squared distance to another vector (faster)
|
|
240
|
+
* @param {Vec4} v
|
|
241
|
+
* @returns {number}
|
|
242
|
+
*/
|
|
243
|
+
distanceToSquared(v) {
|
|
244
|
+
return this.sub(v).lengthSquared();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Normalize to unit length (immutable)
|
|
249
|
+
* @returns {Vec4} New normalized vector
|
|
250
|
+
*/
|
|
251
|
+
normalize() {
|
|
252
|
+
const len = this.length();
|
|
253
|
+
if (len < 1e-10) {
|
|
254
|
+
return new Vec4(0, 0, 0, 0);
|
|
255
|
+
}
|
|
256
|
+
return this.scale(1 / len);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Normalize in place (mutable)
|
|
261
|
+
* @returns {Vec4} this
|
|
262
|
+
*/
|
|
263
|
+
normalizeInPlace() {
|
|
264
|
+
const len = this.length();
|
|
265
|
+
if (len < 1e-10) {
|
|
266
|
+
this.set(0, 0, 0, 0);
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
return this.scaleInPlace(1 / len);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Linear interpolation to another vector
|
|
274
|
+
* @param {Vec4} v - Target vector
|
|
275
|
+
* @param {number} t - Interpolation factor (0-1)
|
|
276
|
+
* @returns {Vec4} New interpolated vector
|
|
277
|
+
*/
|
|
278
|
+
lerp(v, t) {
|
|
279
|
+
return new Vec4(
|
|
280
|
+
this.x + (v.x - this.x) * t,
|
|
281
|
+
this.y + (v.y - this.y) * t,
|
|
282
|
+
this.z + (v.z - this.z) * t,
|
|
283
|
+
this.w + (v.w - this.w) * t
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Check if approximately equal to another vector
|
|
289
|
+
* @param {Vec4} v
|
|
290
|
+
* @param {number} epsilon - Tolerance (default 1e-6)
|
|
291
|
+
* @returns {boolean}
|
|
292
|
+
*/
|
|
293
|
+
equals(v, epsilon = 1e-6) {
|
|
294
|
+
return (
|
|
295
|
+
Math.abs(this.x - v.x) < epsilon &&
|
|
296
|
+
Math.abs(this.y - v.y) < epsilon &&
|
|
297
|
+
Math.abs(this.z - v.z) < epsilon &&
|
|
298
|
+
Math.abs(this.w - v.w) < epsilon
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Check if zero vector
|
|
304
|
+
* @param {number} epsilon
|
|
305
|
+
* @returns {boolean}
|
|
306
|
+
*/
|
|
307
|
+
isZero(epsilon = 1e-10) {
|
|
308
|
+
return this.lengthSquared() < epsilon * epsilon;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Project 4D point to 3D using perspective projection
|
|
313
|
+
* Projects from 4D to 3D by dividing by (d - w)
|
|
314
|
+
* @param {number} d - Distance parameter (usually 2-5)
|
|
315
|
+
* @param {object} [options] - Projection options (epsilon, distance)
|
|
316
|
+
* @returns {Vec4} Projected point (w component is 0)
|
|
317
|
+
*/
|
|
318
|
+
projectPerspective(d = 2, options = {}) {
|
|
319
|
+
if (typeof d === 'object') {
|
|
320
|
+
options = d;
|
|
321
|
+
d = options.distance ?? options.d ?? 2;
|
|
322
|
+
}
|
|
323
|
+
const epsilon = options.epsilon ?? 1e-5;
|
|
324
|
+
const denom = d - this.w;
|
|
325
|
+
const clamped = Math.abs(denom) < epsilon ? (denom >= 0 ? epsilon : -epsilon) : denom;
|
|
326
|
+
const scale = 1 / clamped;
|
|
327
|
+
return new Vec4(this.x * scale, this.y * scale, this.z * scale, 0);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Project 4D point to 3D using stereographic projection
|
|
332
|
+
* Maps 4D hypersphere to 3D space
|
|
333
|
+
* @param {object} [options] - Projection options (epsilon)
|
|
334
|
+
* @returns {Vec4} Projected point (w component is 0)
|
|
335
|
+
*/
|
|
336
|
+
projectStereographic(options = {}) {
|
|
337
|
+
const epsilon = options.epsilon ?? 1e-5;
|
|
338
|
+
const denom = 1 - this.w;
|
|
339
|
+
const clamped = Math.abs(denom) < epsilon ? (denom >= 0 ? epsilon : -epsilon) : denom;
|
|
340
|
+
const scale = 1 / clamped;
|
|
341
|
+
return new Vec4(this.x * scale, this.y * scale, this.z * scale, 0);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Project 4D point to 3D using orthographic projection
|
|
346
|
+
* Simply drops the W component
|
|
347
|
+
* @returns {Vec4} Projected point (w component is 0)
|
|
348
|
+
*/
|
|
349
|
+
projectOrthographic() {
|
|
350
|
+
return new Vec4(this.x, this.y, this.z, 0);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Convert to array
|
|
355
|
+
* @returns {number[]}
|
|
356
|
+
*/
|
|
357
|
+
toArray() {
|
|
358
|
+
return [this.x, this.y, this.z, this.w];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Convert to Float32Array (for GPU upload)
|
|
363
|
+
* @returns {Float32Array}
|
|
364
|
+
*/
|
|
365
|
+
toFloat32Array() {
|
|
366
|
+
return new Float32Array(this.data);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Get XYZ components as a 3D array
|
|
371
|
+
* @returns {number[]}
|
|
372
|
+
*/
|
|
373
|
+
toArray3() {
|
|
374
|
+
return [this.x, this.y, this.z];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* String representation
|
|
379
|
+
* @param {number} precision - Decimal places
|
|
380
|
+
* @returns {string}
|
|
381
|
+
*/
|
|
382
|
+
toString(precision = 3) {
|
|
383
|
+
return `Vec4(${this.x.toFixed(precision)}, ${this.y.toFixed(precision)}, ${this.z.toFixed(precision)}, ${this.w.toFixed(precision)})`;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* JSON representation
|
|
388
|
+
* @returns {object}
|
|
389
|
+
*/
|
|
390
|
+
toJSON() {
|
|
391
|
+
return { x: this.x, y: this.y, z: this.z, w: this.w };
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Static factory methods for common vectors
|
|
395
|
+
|
|
396
|
+
/** Zero vector */
|
|
397
|
+
static zero() {
|
|
398
|
+
return new Vec4(0, 0, 0, 0);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/** Unit vector along X axis */
|
|
402
|
+
static unitX() {
|
|
403
|
+
return new Vec4(1, 0, 0, 0);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Unit vector along Y axis */
|
|
407
|
+
static unitY() {
|
|
408
|
+
return new Vec4(0, 1, 0, 0);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/** Unit vector along Z axis */
|
|
412
|
+
static unitZ() {
|
|
413
|
+
return new Vec4(0, 0, 1, 0);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** Unit vector along W axis */
|
|
417
|
+
static unitW() {
|
|
418
|
+
return new Vec4(0, 0, 0, 1);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/** Vector with all ones */
|
|
422
|
+
static one() {
|
|
423
|
+
return new Vec4(1, 1, 1, 1);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Create random unit vector on 4D hypersphere
|
|
428
|
+
* Uses Gaussian distribution for uniform distribution on sphere
|
|
429
|
+
* @returns {Vec4}
|
|
430
|
+
*/
|
|
431
|
+
static randomUnit() {
|
|
432
|
+
// Box-Muller transform for Gaussian random numbers
|
|
433
|
+
const u1 = Math.random();
|
|
434
|
+
const u2 = Math.random();
|
|
435
|
+
const u3 = Math.random();
|
|
436
|
+
const u4 = Math.random();
|
|
437
|
+
|
|
438
|
+
const r1 = Math.sqrt(-2 * Math.log(u1));
|
|
439
|
+
const r2 = Math.sqrt(-2 * Math.log(u3));
|
|
440
|
+
|
|
441
|
+
const x = r1 * Math.cos(2 * Math.PI * u2);
|
|
442
|
+
const y = r1 * Math.sin(2 * Math.PI * u2);
|
|
443
|
+
const z = r2 * Math.cos(2 * Math.PI * u4);
|
|
444
|
+
const w = r2 * Math.sin(2 * Math.PI * u4);
|
|
445
|
+
|
|
446
|
+
return new Vec4(x, y, z, w).normalizeInPlace();
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Create random vector with components in [0, 1]
|
|
451
|
+
* @returns {Vec4}
|
|
452
|
+
*/
|
|
453
|
+
static random() {
|
|
454
|
+
return new Vec4(
|
|
455
|
+
Math.random(),
|
|
456
|
+
Math.random(),
|
|
457
|
+
Math.random(),
|
|
458
|
+
Math.random()
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Create random vector with components in [-1, 1]
|
|
464
|
+
* @returns {Vec4}
|
|
465
|
+
*/
|
|
466
|
+
static randomSigned() {
|
|
467
|
+
return new Vec4(
|
|
468
|
+
Math.random() * 2 - 1,
|
|
469
|
+
Math.random() * 2 - 1,
|
|
470
|
+
Math.random() * 2 - 1,
|
|
471
|
+
Math.random() * 2 - 1
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export default Vec4;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mathematical Constants for 4D Geometry
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Basic constants
|
|
6
|
+
export const PI = Math.PI;
|
|
7
|
+
export const TAU = Math.PI * 2; // Full rotation (2π)
|
|
8
|
+
export const HALF_PI = Math.PI / 2; // Quarter rotation
|
|
9
|
+
export const QUARTER_PI = Math.PI / 4; // Eighth rotation
|
|
10
|
+
|
|
11
|
+
// Conversion factors
|
|
12
|
+
export const DEG_TO_RAD = Math.PI / 180;
|
|
13
|
+
export const RAD_TO_DEG = 180 / Math.PI;
|
|
14
|
+
|
|
15
|
+
// Numerical tolerance
|
|
16
|
+
export const EPSILON = 1e-10;
|
|
17
|
+
export const EPSILON_NORMAL = 1e-6; // For normalization checks
|
|
18
|
+
export const EPSILON_EQUAL = 1e-6; // For equality checks
|
|
19
|
+
|
|
20
|
+
// 4D Geometry constants
|
|
21
|
+
export const TESSERACT_VERTICES = 16;
|
|
22
|
+
export const TESSERACT_EDGES = 32;
|
|
23
|
+
export const TESSERACT_FACES = 24;
|
|
24
|
+
export const TESSERACT_CELLS = 8;
|
|
25
|
+
|
|
26
|
+
// 24-cell (Icositetrachoron)
|
|
27
|
+
export const CELL24_VERTICES = 24;
|
|
28
|
+
export const CELL24_EDGES = 96;
|
|
29
|
+
export const CELL24_FACES = 96;
|
|
30
|
+
export const CELL24_CELLS = 24;
|
|
31
|
+
|
|
32
|
+
// 120-cell (Hecatonicosachoron)
|
|
33
|
+
export const CELL120_VERTICES = 600;
|
|
34
|
+
export const CELL120_EDGES = 1200;
|
|
35
|
+
export const CELL120_FACES = 720;
|
|
36
|
+
export const CELL120_CELLS = 120;
|
|
37
|
+
|
|
38
|
+
// 600-cell (Hexacosichoron)
|
|
39
|
+
export const CELL600_VERTICES = 120;
|
|
40
|
+
export const CELL600_EDGES = 720;
|
|
41
|
+
export const CELL600_FACES = 1200;
|
|
42
|
+
export const CELL600_CELLS = 600;
|
|
43
|
+
|
|
44
|
+
// Golden ratio (used in many 4D polytopes)
|
|
45
|
+
export const PHI = (1 + Math.sqrt(5)) / 2; // ≈ 1.618
|
|
46
|
+
export const PHI_INV = 1 / PHI; // ≈ 0.618
|
|
47
|
+
|
|
48
|
+
// Rotation plane indices
|
|
49
|
+
export const PLANE_XY = 0;
|
|
50
|
+
export const PLANE_XZ = 1;
|
|
51
|
+
export const PLANE_YZ = 2;
|
|
52
|
+
export const PLANE_XW = 3;
|
|
53
|
+
export const PLANE_YW = 4;
|
|
54
|
+
export const PLANE_ZW = 5;
|
|
55
|
+
|
|
56
|
+
// Plane names
|
|
57
|
+
export const PLANE_NAMES = ['XY', 'XZ', 'YZ', 'XW', 'YW', 'ZW'];
|
|
58
|
+
|
|
59
|
+
// Geometry type indices (base geometries)
|
|
60
|
+
export const GEOMETRY_TETRAHEDRON = 0;
|
|
61
|
+
export const GEOMETRY_HYPERCUBE = 1;
|
|
62
|
+
export const GEOMETRY_SPHERE = 2;
|
|
63
|
+
export const GEOMETRY_TORUS = 3;
|
|
64
|
+
export const GEOMETRY_KLEIN = 4;
|
|
65
|
+
export const GEOMETRY_FRACTAL = 5;
|
|
66
|
+
export const GEOMETRY_WAVE = 6;
|
|
67
|
+
export const GEOMETRY_CRYSTAL = 7;
|
|
68
|
+
|
|
69
|
+
// Core type indices
|
|
70
|
+
export const CORE_BASE = 0;
|
|
71
|
+
export const CORE_HYPERSPHERE = 1;
|
|
72
|
+
export const CORE_HYPERTETRAHEDRON = 2;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Encode geometry index from base and core type
|
|
76
|
+
* @param {number} baseIndex - 0-7
|
|
77
|
+
* @param {number} coreIndex - 0-2
|
|
78
|
+
* @returns {number} - 0-23
|
|
79
|
+
*/
|
|
80
|
+
export function encodeGeometry(baseIndex, coreIndex) {
|
|
81
|
+
return coreIndex * 8 + baseIndex;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Decode geometry index to base and core type
|
|
86
|
+
* @param {number} geometryIndex - 0-23
|
|
87
|
+
* @returns {{baseIndex: number, coreIndex: number}}
|
|
88
|
+
*/
|
|
89
|
+
export function decodeGeometry(geometryIndex) {
|
|
90
|
+
return {
|
|
91
|
+
baseIndex: geometryIndex % 8,
|
|
92
|
+
coreIndex: Math.floor(geometryIndex / 8)
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Convert degrees to radians
|
|
98
|
+
* @param {number} degrees
|
|
99
|
+
* @returns {number}
|
|
100
|
+
*/
|
|
101
|
+
export function toRadians(degrees) {
|
|
102
|
+
return degrees * DEG_TO_RAD;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Convert radians to degrees
|
|
107
|
+
* @param {number} radians
|
|
108
|
+
* @returns {number}
|
|
109
|
+
*/
|
|
110
|
+
export function toDegrees(radians) {
|
|
111
|
+
return radians * RAD_TO_DEG;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Clamp value to range
|
|
116
|
+
* @param {number} value
|
|
117
|
+
* @param {number} min
|
|
118
|
+
* @param {number} max
|
|
119
|
+
* @returns {number}
|
|
120
|
+
*/
|
|
121
|
+
export function clamp(value, min, max) {
|
|
122
|
+
return Math.min(max, Math.max(min, value));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Linear interpolation
|
|
127
|
+
* @param {number} a - Start value
|
|
128
|
+
* @param {number} b - End value
|
|
129
|
+
* @param {number} t - Factor (0-1)
|
|
130
|
+
* @returns {number}
|
|
131
|
+
*/
|
|
132
|
+
export function lerp(a, b, t) {
|
|
133
|
+
return a + (b - a) * t;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Smooth step interpolation
|
|
138
|
+
* @param {number} t - Factor (0-1)
|
|
139
|
+
* @returns {number}
|
|
140
|
+
*/
|
|
141
|
+
export function smoothstep(t) {
|
|
142
|
+
return t * t * (3 - 2 * t);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Smoother step interpolation (quintic)
|
|
147
|
+
* @param {number} t - Factor (0-1)
|
|
148
|
+
* @returns {number}
|
|
149
|
+
*/
|
|
150
|
+
export function smootherstep(t) {
|
|
151
|
+
return t * t * t * (t * (t * 6 - 15) + 10);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default {
|
|
155
|
+
PI, TAU, HALF_PI, QUARTER_PI,
|
|
156
|
+
DEG_TO_RAD, RAD_TO_DEG,
|
|
157
|
+
EPSILON, EPSILON_NORMAL, EPSILON_EQUAL,
|
|
158
|
+
PHI, PHI_INV,
|
|
159
|
+
PLANE_XY, PLANE_XZ, PLANE_YZ, PLANE_XW, PLANE_YW, PLANE_ZW,
|
|
160
|
+
PLANE_NAMES,
|
|
161
|
+
encodeGeometry, decodeGeometry,
|
|
162
|
+
toRadians, toDegrees,
|
|
163
|
+
clamp, lerp, smoothstep, smootherstep
|
|
164
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIB3+ Math Module
|
|
3
|
+
*
|
|
4
|
+
* Complete 4D mathematics library for the VIB3+ visualization engine.
|
|
5
|
+
*
|
|
6
|
+
* Core Classes:
|
|
7
|
+
* - Vec4: 4D vectors with standard operations
|
|
8
|
+
* - Rotor4D: 8-component rotors for proper 4D rotations
|
|
9
|
+
* - Mat4x4: 4x4 matrices with all 6 rotation planes
|
|
10
|
+
* - Projection: 4D to 3D projection functions
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { Vec4, Rotor4D, Mat4x4, Projection } from '@vib3code/sdk/math';
|
|
14
|
+
*
|
|
15
|
+
* // Create a tesseract vertex
|
|
16
|
+
* const vertex = new Vec4(1, 1, 1, 1);
|
|
17
|
+
*
|
|
18
|
+
* // Rotate in XW plane (4D "inside-out" effect)
|
|
19
|
+
* const rotor = Rotor4D.fromPlaneAngle('XW', Math.PI / 4);
|
|
20
|
+
* const rotated = rotor.rotate(vertex);
|
|
21
|
+
*
|
|
22
|
+
* // Project to 3D for rendering
|
|
23
|
+
* const projected = Projection.perspective(rotated, 2.5);
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// Core classes
|
|
27
|
+
export { Vec4 } from './Vec4.js';
|
|
28
|
+
export { Rotor4D } from './Rotor4D.js';
|
|
29
|
+
export { Mat4x4 } from './Mat4x4.js';
|
|
30
|
+
|
|
31
|
+
// Projections
|
|
32
|
+
export { Projection, SliceProjection, AnimatedProjection } from './Projection.js';
|
|
33
|
+
|
|
34
|
+
// Constants and utilities
|
|
35
|
+
export {
|
|
36
|
+
// Basic constants
|
|
37
|
+
PI, TAU, HALF_PI, QUARTER_PI,
|
|
38
|
+
DEG_TO_RAD, RAD_TO_DEG,
|
|
39
|
+
EPSILON, EPSILON_NORMAL, EPSILON_EQUAL,
|
|
40
|
+
PHI, PHI_INV,
|
|
41
|
+
|
|
42
|
+
// Plane indices
|
|
43
|
+
PLANE_XY, PLANE_XZ, PLANE_YZ,
|
|
44
|
+
PLANE_XW, PLANE_YW, PLANE_ZW,
|
|
45
|
+
PLANE_NAMES,
|
|
46
|
+
|
|
47
|
+
// Geometry constants
|
|
48
|
+
GEOMETRY_TETRAHEDRON, GEOMETRY_HYPERCUBE, GEOMETRY_SPHERE, GEOMETRY_TORUS,
|
|
49
|
+
GEOMETRY_KLEIN, GEOMETRY_FRACTAL, GEOMETRY_WAVE, GEOMETRY_CRYSTAL,
|
|
50
|
+
CORE_BASE, CORE_HYPERSPHERE, CORE_HYPERTETRAHEDRON,
|
|
51
|
+
|
|
52
|
+
// Polytope constants
|
|
53
|
+
TESSERACT_VERTICES, TESSERACT_EDGES, TESSERACT_FACES, TESSERACT_CELLS,
|
|
54
|
+
CELL24_VERTICES, CELL24_EDGES, CELL24_FACES, CELL24_CELLS,
|
|
55
|
+
|
|
56
|
+
// Utility functions
|
|
57
|
+
encodeGeometry, decodeGeometry,
|
|
58
|
+
toRadians, toDegrees,
|
|
59
|
+
clamp, lerp, smoothstep, smootherstep
|
|
60
|
+
} from './constants.js';
|
|
61
|
+
|
|
62
|
+
// Default export for convenience
|
|
63
|
+
export default {
|
|
64
|
+
Vec4: (await import('./Vec4.js')).Vec4,
|
|
65
|
+
Rotor4D: (await import('./Rotor4D.js')).Rotor4D,
|
|
66
|
+
Mat4x4: (await import('./Mat4x4.js')).Mat4x4,
|
|
67
|
+
Projection: (await import('./Projection.js')).Projection
|
|
68
|
+
};
|