@onerjs/core 8.42.7 → 8.42.9
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/Animations/animatable.core.js +1 -1
- package/Animations/animatable.core.js.map +1 -1
- package/Animations/animatorAvatar.js +2 -2
- package/Animations/animatorAvatar.js.map +1 -1
- package/Animations/runtimeAnimation.js +1 -1
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.js +1 -2
- package/Audio/audioSceneComponent.js.map +1 -1
- package/AudioV2/audioUtils.d.ts +23 -0
- package/AudioV2/audioUtils.js +37 -0
- package/AudioV2/audioUtils.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +3 -3
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +1 -1
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +3 -2
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +10 -3
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Behaviors/Meshes/followBehavior.js +1 -1
- package/Behaviors/Meshes/followBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/boneLookController.js +1 -1
- package/Bones/boneLookController.js.map +1 -1
- package/Buffers/buffer.js +1 -1
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +2 -2
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/camera.js +2 -2
- package/Cameras/camera.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.renderPass.js +1 -0
- package/Engines/AbstractEngine/abstractEngine.renderPass.js.map +1 -1
- package/Engines/Extensions/engine.query.js +1 -1
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +2 -3
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.d.ts +87 -0
- package/Engines/WebGPU/Extensions/engine.debugging.js +123 -31
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +20 -6
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.common.js +2 -2
- package/Engines/engine.common.js.map +1 -1
- package/Engines/engine.js +0 -1
- package/Engines/engine.js.map +1 -1
- package/Engines/thinEngine.functions.js +1 -1
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +4 -5
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/thinNativeEngine.js +2 -5
- package/Engines/thinNativeEngine.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +6 -4
- package/Engines/thinWebGPUEngine.js +49 -25
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +2 -1
- package/Engines/webgpuEngine.js +18 -16
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/flowGraph.d.ts +1 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.d.ts +1 -0
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphContext.d.ts +1 -0
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +1 -0
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +12 -1
- package/FrameGraph/Node/nodeRenderGraph.js +36 -2
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +3 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +14 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +20 -14
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +3 -2
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +38 -14
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/Layers/glowLayer.js +1 -1
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +1 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/selectionOutlineLayer.js +8 -0
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.js +15 -0
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +0 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +28 -1
- package/Lights/Shadows/shadowGenerator.js +77 -11
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/lightingVolume.d.ts +1 -0
- package/Lights/lightingVolume.js +10 -2
- package/Lights/lightingVolume.js.map +1 -1
- package/Loading/sceneLoader.js +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +1 -1
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/curveBlock.js +2 -3
- package/Materials/Node/Blocks/curveBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +1 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.js +3 -5
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +2 -3
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +0 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +1 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.js +2 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js +1 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +13 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/effect.js +2 -1
- package/Materials/effect.js.map +1 -1
- package/Materials/materialHelper.functions.js +1 -1
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/multiMaterial.js +1 -1
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +1 -2
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.geospatial.d.ts +17 -2
- package/Maths/math.geospatial.functions.d.ts +16 -2
- package/Maths/math.geospatial.functions.js +37 -4
- package/Maths/math.geospatial.functions.js.map +1 -1
- package/Maths/math.geospatial.js.map +1 -1
- package/Maths/math.path.js +1 -1
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.scalar.functions.js +3 -3
- package/Maths/math.scalar.functions.js.map +1 -1
- package/Maths/math.vector.js +1 -1
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/boxBuilder.js +1 -2
- package/Meshes/Builders/boxBuilder.js.map +1 -1
- package/Meshes/Builders/cylinderBuilder.js +2 -2
- package/Meshes/Builders/cylinderBuilder.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +1 -2
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/latheBuilder.js +2 -2
- package/Meshes/Builders/latheBuilder.js.map +1 -1
- package/Meshes/Builders/linesBuilder.js +11 -15
- package/Meshes/Builders/linesBuilder.js.map +1 -1
- package/Meshes/Builders/polygonBuilder.js +6 -6
- package/Meshes/Builders/polygonBuilder.js.map +1 -1
- package/Meshes/Builders/polyhedronBuilder.js +2 -2
- package/Meshes/Builders/polyhedronBuilder.js.map +1 -1
- package/Meshes/Builders/ribbonBuilder.js +6 -6
- package/Meshes/Builders/ribbonBuilder.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.js +2 -3
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.js +1 -1
- package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +1 -2
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/extrudeGeometryBlock.d.ts +61 -0
- package/Meshes/Node/Blocks/extrudeGeometryBlock.js +297 -0
- package/Meshes/Node/Blocks/extrudeGeometryBlock.js.map +1 -0
- package/Meshes/Node/Blocks/mappingBlock.js +1 -1
- package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +4 -0
- package/Meshes/abstractMesh.js +14 -10
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +1 -1
- package/Meshes/csg.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/geodesicMesh.js +11 -13
- package/Meshes/geodesicMesh.js.map +1 -1
- package/Meshes/geometry.js +2 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/groundMesh.js +7 -7
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -0
- package/Meshes/mesh.js +21 -7
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js +22 -22
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/meshSimplification.js +1 -1
- package/Meshes/meshSimplification.js.map +1 -1
- package/Meshes/polygonMesh.js +1 -1
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/trailMesh.js +1 -1
- package/Meshes/trailMesh.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.js +4 -6
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
- package/Misc/basisWorker.js +1 -1
- package/Misc/basisWorker.js.map +1 -1
- package/Misc/environmentTextureTools.js +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/meshExploder.js +1 -2
- package/Misc/meshExploder.js.map +1 -1
- package/Misc/tga.js +2 -2
- package/Misc/tga.js.map +1 -1
- package/Misc/timer.js +4 -2
- package/Misc/timer.js.map +1 -1
- package/Misc/tools.d.ts +7 -0
- package/Misc/tools.js +25 -7
- package/Misc/tools.js.map +1 -1
- package/Misc/webRequest.d.ts +34 -3
- package/Misc/webRequest.js +107 -24
- package/Misc/webRequest.js.map +1 -1
- package/Morph/morphTargetManager.js +1 -1
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +11 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +25 -11
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +3 -3
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +1 -1
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/computeShaderParticleSystem.js +2 -0
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +14 -0
- package/Particles/gpuParticleSystem.js +94 -12
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +4 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/pointsCloudSystem.js +46 -47
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/solidParticleSystem.js +5 -6
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.js +3 -4
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.js +2 -1
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Physics/v1/Plugins/ammoJSPlugin.js +0 -8
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/v2/characterController.js +4 -8
- package/Physics/v2/characterController.js.map +1 -1
- package/Physics/v2/ragdoll.js +1 -2
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/postProcess.js +3 -3
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinDepthOfFieldEffect.js +2 -2
- package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -1
- package/Probes/reflectionProbe.js +0 -1
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -5
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/depthRenderer.js +0 -11
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/depthRendererSceneComponent.js +1 -1
- package/Rendering/depthRendererSceneComponent.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +0 -1
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/objectRenderer.js +7 -5
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.js +1 -1
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js +1 -1
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/screenSpaceRayTrace.js +18 -8
- package/Shaders/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.js +4 -0
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/gpuUpdateParticles.vertex.js +15 -3
- package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/screenSpaceRayTrace.js +18 -7
- package/ShadersWGSL/ShadersInclude/screenSpaceRayTrace.js.map +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +16 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.js +1 -1
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
- package/Sprites/spriteManager.js +4 -4
- package/Sprites/spriteManager.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +2 -2
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +1 -1
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +1 -1
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
- package/XR/motionController/webXROculusTouchMotionController.js +1 -1
- package/XR/motionController/webXROculusTouchMotionController.js.map +1 -1
- package/XR/webXRFeaturesManager.js +1 -1
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/assetContainer.js +1 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +16 -0
- package/scene.js +28 -0
- package/scene.js.map +1 -1
- package/sceneComponent.js +1 -1
- package/sceneComponent.js.map +1 -1
package/Maths/math.path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.path.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.path.ts"],"names":[],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AC;YACrC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAChG,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,cAAc,CAAC,IAA8B;QACjD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC;CACJ","sourcesContent":["import type { DeepImmutable, Nullable } from \"../types\";\r\nimport { Clamp, WithinEpsilon } from \"./math.scalar.functions\";\r\nimport type { Vector4 } from \"./math.vector\";\r\nimport { Matrix, Quaternion, Vector2, Vector3 } from \"./math.vector\";\r\nimport { Epsilon } from \"./math.constants\";\r\n\r\n/**\r\n * Defines potential orientation for back face culling\r\n */\r\nexport const enum Orientation {\r\n /**\r\n * Clockwise\r\n */\r\n CW = 0,\r\n /** Counter clockwise */\r\n CCW = 1,\r\n}\r\n\r\n/** Class used to represent a Bezier curve */\r\nexport class BezierCurve {\r\n /**\r\n * Returns the cubic Bezier interpolated value (float) at \"t\" (float) from the given x1, y1, x2, y2 floats\r\n * @param t defines the time\r\n * @param x1 defines the left coordinate on X axis\r\n * @param y1 defines the left coordinate on Y axis\r\n * @param x2 defines the right coordinate on X axis\r\n * @param y2 defines the right coordinate on Y axis\r\n * @returns the interpolated value\r\n */\r\n public static Interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number {\r\n if (t === 0) {\r\n return 0;\r\n }\r\n // Extract X (which is equal to time here)\r\n const f0 = 1 - 3 * x2 + 3 * x1;\r\n const f1 = 3 * x2 - 6 * x1;\r\n const f2 = 3 * x1;\r\n\r\n let refinedT = t;\r\n for (let i = 0; i < 5; i++) {\r\n const refinedT2 = refinedT * refinedT;\r\n const refinedT3 = refinedT2 * refinedT;\r\n\r\n const x = f0 * refinedT3 + f1 * refinedT2 + f2 * refinedT;\r\n const slope = 1.0 / (3.0 * f0 * refinedT2 + 2.0 * f1 * refinedT + f2);\r\n refinedT -= (x - t) * slope;\r\n refinedT = Math.min(1, Math.max(0, refinedT));\r\n }\r\n\r\n // Resolve cubic bezier for the given x\r\n return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 + 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 + Math.pow(refinedT, 3);\r\n }\r\n}\r\n\r\n/**\r\n * Defines angle representation\r\n */\r\nexport class Angle {\r\n private _radians: number;\r\n\r\n /**\r\n * Creates an Angle object of \"radians\" radians (float).\r\n * @param radians the angle in radians\r\n */\r\n constructor(radians: number) {\r\n this._radians = radians;\r\n if (this._radians < 0.0) {\r\n this._radians += 2.0 * Math.PI;\r\n }\r\n }\r\n\r\n /**\r\n * Get value in degrees\r\n * @returns the Angle value in degrees (float)\r\n */\r\n public degrees() {\r\n return (this._radians * 180.0) / Math.PI;\r\n }\r\n\r\n /**\r\n * Get value in radians\r\n * @returns the Angle value in radians (float)\r\n */\r\n public radians() {\r\n return this._radians;\r\n }\r\n\r\n /**\r\n * Gets a new Angle object with a value of the angle (in radians) between the line connecting the two points and the x-axis\r\n * @param a defines first point as the origin\r\n * @param b defines point\r\n * @returns a new Angle\r\n */\r\n public static BetweenTwoPoints(a: DeepImmutable<Vector2>, b: DeepImmutable<Vector2>): Angle {\r\n const delta = b.subtract(a);\r\n const theta = Math.atan2(delta.y, delta.x);\r\n return new Angle(theta);\r\n }\r\n\r\n /**\r\n * Gets the angle between the two vectors\r\n * @param a defines first vector\r\n * @param b defines vector\r\n * @returns Returns an new Angle between 0 and PI\r\n */\r\n public static BetweenTwoVectors<Vec extends Vector2 | Vector3 | Vector4>(a: DeepImmutable<Vec>, b: DeepImmutable<Vec>): Angle {\r\n let product = a.lengthSquared() * b.lengthSquared();\r\n if (product === 0) {\r\n return new Angle(Math.PI / 2);\r\n }\r\n product = Math.sqrt(product);\r\n let cosVal = a.dot(b as any) / product;\r\n cosVal = Clamp(cosVal, -1, 1);\r\n const angle = Math.acos(cosVal);\r\n return new Angle(angle);\r\n }\r\n\r\n /**\r\n * Gets a new Angle object from the given float in radians\r\n * @param radians defines the angle value in radians\r\n * @returns a new Angle\r\n */\r\n public static FromRadians(radians: number): Angle {\r\n return new Angle(radians);\r\n }\r\n /**\r\n * Gets a new Angle object from the given float in degrees\r\n * @param degrees defines the angle value in degrees\r\n * @returns a new Angle\r\n */\r\n public static FromDegrees(degrees: number): Angle {\r\n return new Angle((degrees * Math.PI) / 180.0);\r\n }\r\n}\r\n\r\n/**\r\n * This represents an arc in a 2d space.\r\n */\r\nexport class Arc2 {\r\n /**\r\n * Defines the center point of the arc.\r\n */\r\n public centerPoint: Vector2;\r\n /**\r\n * Defines the radius of the arc.\r\n */\r\n public radius: number;\r\n /**\r\n * Defines the angle of the arc (from mid point to end point).\r\n */\r\n public angle: Angle;\r\n /**\r\n * Defines the start angle of the arc (from start point to middle point).\r\n */\r\n public startAngle: Angle;\r\n /**\r\n * Defines the orientation of the arc (clock wise/counter clock wise).\r\n */\r\n public orientation: Orientation;\r\n\r\n /**\r\n * Creates an Arc object from the three given points : start, middle and end.\r\n * @param startPoint Defines the start point of the arc\r\n * @param midPoint Defines the middle point of the arc\r\n * @param endPoint Defines the end point of the arc\r\n */\r\n constructor(\r\n /** Defines the start point of the arc */\r\n public startPoint: Vector2,\r\n /** Defines the mid point of the arc */\r\n public midPoint: Vector2,\r\n /** Defines the end point of the arc */\r\n public endPoint: Vector2\r\n ) {\r\n const temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);\r\n const startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2;\r\n const midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2;\r\n const det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);\r\n\r\n this.centerPoint = new Vector2(\r\n (startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det,\r\n ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det\r\n );\r\n\r\n this.radius = this.centerPoint.subtract(this.startPoint).length();\r\n\r\n this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);\r\n\r\n const a1 = this.startAngle.degrees();\r\n let a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();\r\n let a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();\r\n\r\n // angles correction\r\n if (a2 - a1 > +180.0) {\r\n a2 -= 360.0;\r\n }\r\n if (a2 - a1 < -180.0) {\r\n a2 += 360.0;\r\n }\r\n if (a3 - a2 > +180.0) {\r\n a3 -= 360.0;\r\n }\r\n if (a3 - a2 < -180.0) {\r\n a3 += 360.0;\r\n }\r\n\r\n this.orientation = a2 - a1 < 0 ? Orientation.CW : Orientation.CCW;\r\n this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a 2D path made up of multiple 2D points\r\n */\r\nexport class Path2 {\r\n private _points = new Array<Vector2>();\r\n private _length = 0.0;\r\n\r\n /**\r\n * If the path start and end point are the same\r\n */\r\n public closed = false;\r\n\r\n /**\r\n * Creates a Path2 object from the starting 2D coordinates x and y.\r\n * @param x the starting points x value\r\n * @param y the starting points y value\r\n */\r\n constructor(x: number, y: number) {\r\n this._points.push(new Vector2(x, y));\r\n }\r\n\r\n /**\r\n * Adds a new segment until the given coordinates (x, y) to the current Path2.\r\n * @param x the added points x value\r\n * @param y the added points y value\r\n * @returns the updated Path2.\r\n */\r\n public addLineTo(x: number, y: number): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n const newPoint = new Vector2(x, y);\r\n const previousPoint = this._points[this._points.length - 1];\r\n this._points.push(newPoint);\r\n this._length += newPoint.subtract(previousPoint).length();\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.\r\n * @param midX middle point x value\r\n * @param midY middle point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n public addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments = 36): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n const startPoint = this._points[this._points.length - 1];\r\n const midPoint = new Vector2(midX, midY);\r\n const endPoint = new Vector2(endX, endY);\r\n\r\n const arc = new Arc2(startPoint, midPoint, endPoint);\r\n\r\n let increment = arc.angle.radians() / numberOfSegments;\r\n if (arc.orientation === Orientation.CW) {\r\n increment *= -1;\r\n }\r\n let currentAngle = arc.startAngle.radians() + increment;\r\n\r\n for (let i = 0; i < numberOfSegments; i++) {\r\n const x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;\r\n const y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;\r\n this.addLineTo(x, y);\r\n currentAngle += increment;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds _numberOfSegments_ segments according to the quadratic curve definition to the current Path2.\r\n * @param controlX control point x value\r\n * @param controlY control point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n public addQuadraticCurveTo(controlX: number, controlY: number, endX: number, endY: number, numberOfSegments = 36): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n\r\n const equation = (t: number, val0: number, val1: number, val2: number) => {\r\n const res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n return res;\r\n };\r\n const startPoint = this._points[this._points.length - 1];\r\n for (let i = 0; i <= numberOfSegments; i++) {\r\n const step = i / numberOfSegments;\r\n const x = equation(step, startPoint.x, controlX, endX);\r\n const y = equation(step, startPoint.y, controlY, endY);\r\n this.addLineTo(x, y);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds _numberOfSegments_ segments according to the bezier curve definition to the current Path2.\r\n * @param originTangentX tangent vector at the origin point x value\r\n * @param originTangentY tangent vector at the origin point y value\r\n * @param destinationTangentX tangent vector at the destination point x value\r\n * @param destinationTangentY tangent vector at the destination point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n public addBezierCurveTo(\r\n originTangentX: number,\r\n originTangentY: number,\r\n destinationTangentX: number,\r\n destinationTangentY: number,\r\n endX: number,\r\n endY: number,\r\n numberOfSegments = 36\r\n ): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n\r\n const equation = (t: number, val0: number, val1: number, val2: number, val3: number) => {\r\n const res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n const startPoint = this._points[this._points.length - 1];\r\n for (let i = 0; i <= numberOfSegments; i++) {\r\n const step = i / numberOfSegments;\r\n const x = equation(step, startPoint.x, originTangentX, destinationTangentX, endX);\r\n const y = equation(step, startPoint.y, originTangentY, destinationTangentY, endY);\r\n this.addLineTo(x, y);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Defines if a given point is inside the polygon defines by the path\r\n * @param point defines the point to test\r\n * @returns true if the point is inside\r\n */\r\n public isPointInside(point: Vector2) {\r\n let isInside = false;\r\n const count = this._points.length;\r\n for (let p = count - 1, q = 0; q < count; p = q++) {\r\n let edgeLow = this._points[p];\r\n let edgeHigh = this._points[q];\r\n\r\n let edgeDx = edgeHigh.x - edgeLow.x;\r\n let edgeDy = edgeHigh.y - edgeLow.y;\r\n\r\n if (Math.abs(edgeDy) > Number.EPSILON) {\r\n // Not parallel\r\n if (edgeDy < 0) {\r\n edgeLow = this._points[q];\r\n edgeDx = -edgeDx;\r\n edgeHigh = this._points[p];\r\n edgeDy = -edgeDy;\r\n }\r\n\r\n if (point.y < edgeLow.y || point.y > edgeHigh.y) {\r\n continue;\r\n }\r\n\r\n if (point.y === edgeLow.y && point.x === edgeLow.x) {\r\n return true;\r\n } else {\r\n const perpEdge = edgeDy * (point.x - edgeLow.x) - edgeDx * (point.y - edgeLow.y);\r\n if (perpEdge === 0) {\r\n return true;\r\n }\r\n if (perpEdge < 0) {\r\n continue;\r\n }\r\n isInside = !isInside;\r\n }\r\n } else {\r\n // parallel or collinear\r\n if (point.y !== edgeLow.y) {\r\n continue;\r\n }\r\n\r\n if ((edgeHigh.x <= point.x && point.x <= edgeLow.x) || (edgeLow.x <= point.x && point.x <= edgeHigh.x)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return isInside;\r\n }\r\n\r\n /**\r\n * Closes the Path2.\r\n * @returns the Path2.\r\n */\r\n public close(): Path2 {\r\n this.closed = true;\r\n return this;\r\n }\r\n /**\r\n * Gets the sum of the distance between each sequential point in the path\r\n * @returns the Path2 total length (float).\r\n */\r\n public length(): number {\r\n let result = this._length;\r\n\r\n if (this.closed) {\r\n const lastPoint = this._points[this._points.length - 1];\r\n const firstPoint = this._points[0];\r\n result += firstPoint.subtract(lastPoint).length();\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * Gets the area of the polygon defined by the path\r\n * @returns area value\r\n */\r\n public area(): number {\r\n const n = this._points.length;\r\n let value = 0.0;\r\n\r\n for (let p = n - 1, q = 0; q < n; p = q++) {\r\n value += this._points[p].x * this._points[q].y - this._points[q].x * this._points[p].y;\r\n }\r\n\r\n return value * 0.5;\r\n }\r\n\r\n /**\r\n * Gets the points which construct the path\r\n * @returns the Path2 internal array of points.\r\n */\r\n public getPoints(): Vector2[] {\r\n return this._points;\r\n }\r\n\r\n /**\r\n * Retrieves the point at the distance aways from the starting point\r\n * @param normalizedLengthPosition the length along the path to retrieve the point from\r\n * @returns a new Vector2 located at a percentage of the Path2 total length on this path.\r\n */\r\n public getPointAtLengthPosition(normalizedLengthPosition: number): Vector2 {\r\n if (normalizedLengthPosition < 0 || normalizedLengthPosition > 1) {\r\n return Vector2.Zero();\r\n }\r\n\r\n const lengthPosition = normalizedLengthPosition * this.length();\r\n\r\n let previousOffset = 0;\r\n for (let i = 0; i < this._points.length; i++) {\r\n const j = (i + 1) % this._points.length;\r\n\r\n const a = this._points[i];\r\n const b = this._points[j];\r\n const bToA = b.subtract(a);\r\n\r\n const nextOffset = bToA.length() + previousOffset;\r\n if (lengthPosition >= previousOffset && lengthPosition <= nextOffset) {\r\n const dir = bToA.normalize();\r\n const localOffset = lengthPosition - previousOffset;\r\n\r\n return new Vector2(a.x + dir.x * localOffset, a.y + dir.y * localOffset);\r\n }\r\n previousOffset = nextOffset;\r\n }\r\n\r\n return Vector2.Zero();\r\n }\r\n\r\n /**\r\n * Creates a new path starting from an x and y position\r\n * @param x starting x value\r\n * @param y starting y value\r\n * @returns a new Path2 starting at the coordinates (x, y).\r\n */\r\n public static StartingAt(x: number, y: number): Path2 {\r\n return new Path2(x, y);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a 3D path made up of multiple 3D points\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/path3D\r\n */\r\nexport class Path3D {\r\n private _curve = new Array<Vector3>();\r\n private _distances = new Array<number>();\r\n private _tangents = new Array<Vector3>();\r\n private _normals = new Array<Vector3>();\r\n private _binormals = new Array<Vector3>();\r\n private _raw: boolean;\r\n private _alignTangentsWithPath: boolean;\r\n\r\n // holds interpolated point data\r\n private readonly _pointAtData = {\r\n id: 0,\r\n point: Vector3.Zero(),\r\n previousPointArrayIndex: 0,\r\n\r\n position: 0,\r\n subPosition: 0,\r\n\r\n interpolateReady: false,\r\n interpolationMatrix: Matrix.Identity(),\r\n };\r\n\r\n /**\r\n * new Path3D(path, normal, raw)\r\n * Creates a Path3D. A Path3D is a logical math object, so not a mesh.\r\n * please read the description in the tutorial : https://doc.babylonjs.com/features/featuresDeepDive/mesh/path3D\r\n * @param path an array of Vector3, the curve axis of the Path3D\r\n * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.\r\n * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path.\r\n */\r\n constructor(\r\n /**\r\n * an array of Vector3, the curve axis of the Path3D\r\n */\r\n public path: Vector3[],\r\n firstNormal: Nullable<Vector3> = null,\r\n raw?: boolean,\r\n alignTangentsWithPath = false\r\n ) {\r\n for (let p = 0; p < path.length; p++) {\r\n this._curve[p] = path[p].clone(); // hard copy\r\n }\r\n this._raw = raw || false;\r\n this._alignTangentsWithPath = alignTangentsWithPath;\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n }\r\n\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n public getCurve(): Vector3[] {\r\n return this._curve;\r\n }\r\n\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n public getPoints(): Vector3[] {\r\n return this._curve;\r\n }\r\n\r\n /**\r\n * @returns the computed length (float) of the path.\r\n */\r\n public length() {\r\n return this._distances[this._distances.length - 1];\r\n }\r\n\r\n /**\r\n * Returns an array populated with tangent vectors on each Path3D curve point.\r\n * @returns an array populated with tangent vectors on each Path3D curve point.\r\n */\r\n public getTangents(): Vector3[] {\r\n return this._tangents;\r\n }\r\n\r\n /**\r\n * Returns an array populated with normal vectors on each Path3D curve point.\r\n * @returns an array populated with normal vectors on each Path3D curve point.\r\n */\r\n public getNormals(): Vector3[] {\r\n return this._normals;\r\n }\r\n\r\n /**\r\n * Returns an array populated with binormal vectors on each Path3D curve point.\r\n * @returns an array populated with binormal vectors on each Path3D curve point.\r\n */\r\n public getBinormals(): Vector3[] {\r\n return this._binormals;\r\n }\r\n\r\n /**\r\n * Returns an array populated with distances (float) of the i-th point from the first curve point.\r\n * @returns an array populated with distances (float) of the i-th point from the first curve point.\r\n */\r\n public getDistances(): number[] {\r\n return this._distances;\r\n }\r\n\r\n /**\r\n * Returns an interpolated point along this path\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns a new Vector3 as the point\r\n */\r\n public getPointAt(position: number): Vector3 {\r\n return this._updatePointAtData(position).point;\r\n }\r\n\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated tangent instead of the tangent of the previous path point.\r\n * @returns a tangent vector corresponding to the interpolated Path3D curve point, if not interpolated, the tangent is taken from the precomputed tangents array.\r\n */\r\n public getTangentAt(position: number, interpolated = false): Vector3 {\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Forward(), this._pointAtData.interpolationMatrix) : this._tangents[this._pointAtData.previousPointArrayIndex];\r\n }\r\n\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated normal instead of the normal of the previous path point.\r\n * @returns a normal vector corresponding to the interpolated Path3D curve point, if not interpolated, the normal is taken from the precomputed normals array.\r\n */\r\n public getNormalAt(position: number, interpolated = false): Vector3 {\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Right(), this._pointAtData.interpolationMatrix) : this._normals[this._pointAtData.previousPointArrayIndex];\r\n }\r\n\r\n /**\r\n * Returns the binormal vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated binormal instead of the binormal of the previous path point.\r\n * @returns a binormal vector corresponding to the interpolated Path3D curve point, if not interpolated, the binormal is taken from the precomputed binormals array.\r\n */\r\n public getBinormalAt(position: number, interpolated = false): Vector3 {\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.UpReadOnly, this._pointAtData.interpolationMatrix) : this._binormals[this._pointAtData.previousPointArrayIndex];\r\n }\r\n\r\n /**\r\n * Returns the distance (float) of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns the distance of the interpolated Path3D curve point at the specified position along this path.\r\n */\r\n public getDistanceAt(position: number): number {\r\n return this.length() * position;\r\n }\r\n\r\n /**\r\n * Returns the array index of the previous point of an interpolated point along this path\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the array index\r\n */\r\n public getPreviousPointIndexAt(position: number) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.previousPointArrayIndex;\r\n }\r\n\r\n /**\r\n * Returns the position of an interpolated point relative to the two path points it lies between, from 0.0 (point A) to 1.0 (point B)\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the sub position\r\n */\r\n public getSubPositionAt(position: number) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.subPosition;\r\n }\r\n\r\n /**\r\n * Returns the position of the closest virtual point on this path to an arbitrary Vector3, from 0.0 to 1.0\r\n * @param target the vector of which to get the closest position to\r\n * @returns the position of the closest virtual point on this path to the target vector\r\n */\r\n public getClosestPositionTo(target: Vector3) {\r\n let smallestDistance = Number.MAX_VALUE;\r\n let closestPosition = 0.0;\r\n for (let i = 0; i < this._curve.length - 1; i++) {\r\n const point = this._curve[i + 0];\r\n const tangent = this._curve[i + 1].subtract(point).normalize();\r\n const subLength = this._distances[i + 1] - this._distances[i + 0];\r\n const subPosition = Math.min((Math.max(Vector3.Dot(tangent, target.subtract(point).normalize()), 0.0) * Vector3.Distance(point, target)) / subLength, 1.0);\r\n const distance = Vector3.Distance(point.add(tangent.scale(subPosition * subLength)), target);\r\n\r\n if (distance < smallestDistance) {\r\n smallestDistance = distance;\r\n closestPosition = (this._distances[i + 0] + subLength * subPosition) / this.length();\r\n }\r\n }\r\n return closestPosition;\r\n }\r\n\r\n /**\r\n * Returns a sub path (slice) of this path\r\n * @param start the position of the fist path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @param end the position of the last path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @returns a sub path (slice) of this path\r\n */\r\n public slice(start: number = 0.0, end: number = 1.0) {\r\n if (start < 0.0) {\r\n start = 1 - ((start * -1.0) % 1.0);\r\n }\r\n if (end < 0.0) {\r\n end = 1 - ((end * -1.0) % 1.0);\r\n }\r\n if (start > end) {\r\n const _start = start;\r\n start = end;\r\n end = _start;\r\n }\r\n const curvePoints = this.getCurve();\r\n\r\n const startPoint = this.getPointAt(start);\r\n let startIndex = this.getPreviousPointIndexAt(start);\r\n\r\n const endPoint = this.getPointAt(end);\r\n const endIndex = this.getPreviousPointIndexAt(end) + 1;\r\n\r\n const slicePoints: Vector3[] = [];\r\n if (start !== 0.0) {\r\n startIndex++;\r\n slicePoints.push(startPoint);\r\n }\r\n\r\n slicePoints.push(...curvePoints.slice(startIndex, endIndex));\r\n if (end !== 1.0 || start === 1.0) {\r\n slicePoints.push(endPoint);\r\n }\r\n return new Path3D(slicePoints, this.getNormalAt(start), this._raw, this._alignTangentsWithPath);\r\n }\r\n\r\n /**\r\n * Forces the Path3D tangent, normal, binormal and distance recomputation.\r\n * @param path path which all values are copied into the curves points\r\n * @param firstNormal which should be projected onto the curve\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path\r\n * @returns the same object updated.\r\n */\r\n public update(path: Vector3[], firstNormal: Nullable<Vector3> = null, alignTangentsWithPath = false): Path3D {\r\n for (let p = 0; p < path.length; p++) {\r\n if (!this._curve[p]) {\r\n this._curve[p] = path[p].clone();\r\n } else {\r\n this._curve[p].x = path[p].x;\r\n this._curve[p].y = path[p].y;\r\n this._curve[p].z = path[p].z;\r\n }\r\n }\r\n this._curve.length = path.length;\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n return this;\r\n }\r\n\r\n // private function compute() : computes tangents, normals and binormals\r\n private _compute(firstNormal: Nullable<Vector3>, alignTangentsWithPath = false): void {\r\n const l = this._curve.length;\r\n\r\n if (l < 2) {\r\n return;\r\n }\r\n\r\n // first and last tangents\r\n this._tangents[0] = this._getFirstNonNullVector(0);\r\n if (!this._raw) {\r\n this._tangents[0].normalize();\r\n }\r\n this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);\r\n if (!this._raw) {\r\n this._tangents[l - 1].normalize();\r\n }\r\n\r\n // normals and binormals at first point : arbitrary vector with _normalVector()\r\n const tg0 = this._tangents[0];\r\n const pp0 = this._normalVector(tg0, firstNormal);\r\n this._normals[0] = pp0;\r\n if (!this._raw) {\r\n this._normals[0].normalize();\r\n }\r\n this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);\r\n if (!this._raw) {\r\n this._binormals[0].normalize();\r\n }\r\n this._distances[0] = 0.0;\r\n\r\n // normals and binormals : next points\r\n let prev: Vector3; // previous vector (segment)\r\n let cur: Vector3; // current vector (segment)\r\n let curTang: Vector3; // current tangent\r\n // previous normal\r\n let prevNor: Vector3; // previous normal\r\n let prevBinor: Vector3; // previous binormal\r\n\r\n for (let i = 1; i < l; i++) {\r\n // tangents\r\n prev = this._getLastNonNullVector(i);\r\n if (i < l - 1) {\r\n cur = this._getFirstNonNullVector(i);\r\n this._tangents[i] = alignTangentsWithPath ? cur : prev.add(cur);\r\n this._tangents[i].normalize();\r\n }\r\n this._distances[i] = this._distances[i - 1] + this._curve[i].subtract(this._curve[i - 1]).length();\r\n\r\n // normals and binormals\r\n // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html\r\n curTang = this._tangents[i];\r\n prevBinor = this._binormals[i - 1];\r\n this._normals[i] = Vector3.Cross(prevBinor, curTang);\r\n if (!this._raw) {\r\n if (this._normals[i].length() === 0) {\r\n prevNor = this._normals[i - 1];\r\n this._normals[i] = prevNor.clone();\r\n } else {\r\n this._normals[i].normalize();\r\n }\r\n }\r\n this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);\r\n if (!this._raw) {\r\n this._binormals[i].normalize();\r\n }\r\n }\r\n this._pointAtData.id = NaN;\r\n }\r\n\r\n // private function getFirstNonNullVector(index)\r\n // returns the first non null vector from index : curve[index + N].subtract(curve[index])\r\n private _getFirstNonNullVector(index: number): Vector3 {\r\n let i = 1;\r\n let nNVector: Vector3 = this._curve[index + i].subtract(this._curve[index]);\r\n while (nNVector.length() === 0 && index + i + 1 < this._curve.length) {\r\n i++;\r\n nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n }\r\n return nNVector;\r\n }\r\n\r\n // private function getLastNonNullVector(index)\r\n // returns the last non null vector from index : curve[index].subtract(curve[index - N])\r\n private _getLastNonNullVector(index: number): Vector3 {\r\n let i = 1;\r\n let nLVector: Vector3 = this._curve[index].subtract(this._curve[index - i]);\r\n while (nLVector.length() === 0 && index > i + 1) {\r\n i++;\r\n nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n }\r\n return nLVector;\r\n }\r\n\r\n // private function normalVector(v0, vt, va) :\r\n // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane\r\n // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0\r\n private _normalVector(vt: Vector3, va: Nullable<Vector3>): Vector3 {\r\n let normal0: Vector3;\r\n let tgl = vt.length();\r\n if (tgl === 0.0) {\r\n tgl = 1.0;\r\n }\r\n\r\n if (va === undefined || va === null) {\r\n let point: Vector3;\r\n if (!WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, Epsilon)) {\r\n // search for a point in the plane\r\n point = new Vector3(0.0, -1.0, 0.0);\r\n } else if (!WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(1.0, 0.0, 0.0);\r\n } else if (!WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(0.0, 0.0, 1.0);\r\n } else {\r\n point = Vector3.Zero();\r\n }\r\n normal0 = Vector3.Cross(vt, point);\r\n } else {\r\n normal0 = Vector3.Cross(vt, va);\r\n Vector3.CrossToRef(normal0, vt, normal0);\r\n }\r\n normal0.normalize();\r\n return normal0;\r\n }\r\n\r\n /**\r\n * Updates the point at data for an interpolated point along this curve\r\n * @param position the position of the point along this curve, from 0.0 to 1.0\r\n * @param interpolateTNB\r\n * @interpolateTNB whether to compute the interpolated tangent, normal and binormal\r\n * @returns the (updated) point at data\r\n */\r\n private _updatePointAtData(position: number, interpolateTNB: boolean = false) {\r\n // set an id for caching the result\r\n if (this._pointAtData.id === position) {\r\n if (!this._pointAtData.interpolateReady) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n } else {\r\n this._pointAtData.id = position;\r\n }\r\n const curvePoints = this.getPoints();\r\n\r\n // clamp position between 0.0 and 1.0\r\n if (position <= 0.0) {\r\n return this._setPointAtData(0.0, 0.0, curvePoints[0], 0, interpolateTNB);\r\n } else if (position >= 1.0) {\r\n return this._setPointAtData(1.0, 1.0, curvePoints[curvePoints.length - 1], curvePoints.length - 1, interpolateTNB);\r\n }\r\n\r\n let previousPoint: Vector3 = curvePoints[0];\r\n let currentPoint: Vector3;\r\n let currentLength = 0.0;\r\n const targetLength = position * this.length();\r\n\r\n for (let i = 1; i < curvePoints.length; i++) {\r\n currentPoint = curvePoints[i];\r\n const distance = Vector3.Distance(previousPoint, currentPoint);\r\n currentLength += distance;\r\n if (currentLength === targetLength) {\r\n return this._setPointAtData(position, 1.0, currentPoint, i, interpolateTNB);\r\n } else if (currentLength > targetLength) {\r\n const toLength = currentLength - targetLength;\r\n const diff = toLength / distance;\r\n const dir = previousPoint.subtract(currentPoint);\r\n const point = currentPoint.add(dir.scaleInPlace(diff));\r\n return this._setPointAtData(position, 1 - diff, point, i - 1, interpolateTNB);\r\n }\r\n previousPoint = currentPoint;\r\n }\r\n return this._pointAtData;\r\n }\r\n\r\n /**\r\n * Updates the point at data from the specified parameters\r\n * @param position where along the path the interpolated point is, from 0.0 to 1.0\r\n * @param subPosition\r\n * @param point the interpolated point\r\n * @param parentIndex the index of an existing curve point that is on, or else positionally the first behind, the interpolated point\r\n * @param interpolateTNB whether to compute the interpolated tangent, normal and binormal\r\n * @returns the (updated) point at data\r\n */\r\n private _setPointAtData(position: number, subPosition: number, point: Vector3, parentIndex: number, interpolateTNB: boolean) {\r\n this._pointAtData.point = point;\r\n this._pointAtData.position = position;\r\n this._pointAtData.subPosition = subPosition;\r\n this._pointAtData.previousPointArrayIndex = parentIndex;\r\n this._pointAtData.interpolateReady = interpolateTNB;\r\n\r\n if (interpolateTNB) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n }\r\n\r\n /**\r\n * Updates the point at interpolation matrix for the tangents, normals and binormals\r\n */\r\n private _updateInterpolationMatrix() {\r\n this._pointAtData.interpolationMatrix = Matrix.Identity();\r\n const parentIndex = this._pointAtData.previousPointArrayIndex;\r\n\r\n if (parentIndex !== this._tangents.length - 1) {\r\n const index = parentIndex + 1;\r\n\r\n const tangentFrom = this._tangents[parentIndex].clone();\r\n const normalFrom = this._normals[parentIndex].clone();\r\n const binormalFrom = this._binormals[parentIndex].clone();\r\n\r\n const tangentTo = this._tangents[index].clone();\r\n const normalTo = this._normals[index].clone();\r\n const binormalTo = this._binormals[index].clone();\r\n\r\n const quatFrom = Quaternion.RotationQuaternionFromAxis(normalFrom, binormalFrom, tangentFrom);\r\n const quatTo = Quaternion.RotationQuaternionFromAxis(normalTo, binormalTo, tangentTo);\r\n const quatAt = Quaternion.Slerp(quatFrom, quatTo, this._pointAtData.subPosition);\r\n\r\n quatAt.toRotationMatrix(this._pointAtData.interpolationMatrix);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves\r\n */\r\nexport class Curve3 {\r\n private _points: Vector3[];\r\n private _length: number = 0.0;\r\n\r\n /**\r\n * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#quadratic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Quadratic Bezier\r\n * @param v1 (Vector3) the control point\r\n * @param v2 (Vector3) the end point of the Quadratic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateQuadraticBezier(v0: DeepImmutable<Vector3>, v1: DeepImmutable<Vector3>, v2: DeepImmutable<Vector3>, nbPoints: number, ref?: Curve3): Curve3 {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n const bez: Vector3[] = ref ? ref.getPoints() : [];\r\n const equation = (t: number, val0: number, val1: number, val2: number) => {\r\n return (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n };\r\n for (let i = 0; i <= nbPoints; i++) {\r\n const x = equation(i / nbPoints, v0.x, v1.x, v2.x);\r\n const y = equation(i / nbPoints, v0.y, v1.y, v2.y);\r\n const z = equation(i / nbPoints, v0.z, v1.z, v2.z);\r\n if (bez[i]) {\r\n bez[i].copyFromFloats(x, y, z);\r\n } else {\r\n bez.push(new Vector3(x, y, z));\r\n }\r\n }\r\n bez.length = nbPoints + 1;\r\n return ref || new Curve3(bez);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#cubic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Cubic Bezier\r\n * @param v1 (Vector3) the first control point\r\n * @param v2 (Vector3) the second control point\r\n * @param v3 (Vector3) the end point of the Cubic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateCubicBezier(\r\n v0: DeepImmutable<Vector3>,\r\n v1: DeepImmutable<Vector3>,\r\n v2: DeepImmutable<Vector3>,\r\n v3: DeepImmutable<Vector3>,\r\n nbPoints: number,\r\n ref?: Curve3\r\n ): Curve3 {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n const bez: Vector3[] = ref ? ref.getPoints() : [];\r\n const equation = (t: number, val0: number, val1: number, val2: number, val3: number) => {\r\n const res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n for (let i = 0; i <= nbPoints; i++) {\r\n const x = equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x);\r\n const y = equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y);\r\n const z = equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z);\r\n if (bez[i]) {\r\n bez[i].copyFromFloats(x, y, z);\r\n } else {\r\n bez.push(new Vector3(x, y, z));\r\n }\r\n }\r\n bez.length = nbPoints + 1;\r\n return ref || new Curve3(bez);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#hermite-spline\r\n * @param p1 (Vector3) the origin point of the Hermite Spline\r\n * @param t1 (Vector3) the tangent vector at the origin point\r\n * @param p2 (Vector3) the end point of the Hermite Spline\r\n * @param t2 (Vector3) the tangent vector at the end point\r\n * @param nSeg (integer) the number of curve segments or nSeg + 1 points in the array\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateHermiteSpline(\r\n p1: DeepImmutable<Vector3>,\r\n t1: DeepImmutable<Vector3>,\r\n p2: DeepImmutable<Vector3>,\r\n t2: DeepImmutable<Vector3>,\r\n nSeg: number,\r\n ref?: Curve3\r\n ): Curve3 {\r\n const hermite: Vector3[] = ref ? ref.getPoints() : [];\r\n const step = 1.0 / nSeg;\r\n for (let i = 0; i <= nSeg; i++) {\r\n if (hermite[i]) {\r\n Vector3.HermiteToRef(p1, t1, p2, t2, i * step, hermite[i]);\r\n } else {\r\n hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n }\r\n hermite.length = nSeg + 1;\r\n return ref || new Curve3(hermite);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along a CatmullRom Spline curve :\r\n * @param points (array of Vector3) the points the spline must pass through. At least, four points required\r\n * @param nbPoints (integer) the wanted number of points between each curve control points\r\n * @param closed (boolean) optional with default false, when true forms a closed loop from the points\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateCatmullRomSpline(points: DeepImmutable<Vector3[]>, nbPoints: number, closed?: boolean, ref?: Curve3): Curve3 {\r\n const catmullRom: Vector3[] = ref ? ref.getPoints() : [];\r\n const step = 1.0 / nbPoints;\r\n let amount = 0.0;\r\n if (closed) {\r\n const pointsCount = points.length;\r\n for (let i = 0; i < pointsCount; i++) {\r\n amount = 0;\r\n for (let c = 0; c < nbPoints; c++) {\r\n if (catmullRom[i]) {\r\n Vector3.CatmullRomToRef(\r\n points[i % pointsCount],\r\n points[(i + 1) % pointsCount],\r\n points[(i + 2) % pointsCount],\r\n points[(i + 3) % pointsCount],\r\n amount,\r\n catmullRom[i]\r\n );\r\n } else {\r\n catmullRom.push(\r\n Vector3.CatmullRom(points[i % pointsCount], points[(i + 1) % pointsCount], points[(i + 2) % pointsCount], points[(i + 3) % pointsCount], amount)\r\n );\r\n }\r\n amount += step;\r\n }\r\n }\r\n if (catmullRom[pointsCount]) {\r\n catmullRom[pointsCount].copyFrom(catmullRom[0]);\r\n } else {\r\n catmullRom.push(catmullRom[0]);\r\n }\r\n } else {\r\n const totalPoints: Vector3[] = [];\r\n totalPoints.push(points[0].clone());\r\n Array.prototype.push.apply(totalPoints, points);\r\n totalPoints.push(points[points.length - 1].clone());\r\n let i = 0;\r\n let index = 0;\r\n const pushPoint = () => {\r\n if (catmullRom[index]) {\r\n Vector3.CatmullRomToRef(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount, catmullRom[index]);\r\n } else {\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n };\r\n for (; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (let c = 0; c < nbPoints; c++) {\r\n pushPoint();\r\n amount += step;\r\n index++;\r\n }\r\n }\r\n i--;\r\n pushPoint();\r\n index++;\r\n catmullRom.length = index;\r\n }\r\n return ref || new Curve3(catmullRom);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along an arc through three vector3 points:\r\n * The three points should not be colinear. When they are the Curve3 is empty.\r\n * @param first (Vector3) the first point the arc must pass through.\r\n * @param second (Vector3) the second point the arc must pass through.\r\n * @param third (Vector3) the third point the arc must pass through.\r\n * @param steps (number) the larger the number of steps the more detailed the arc.\r\n * @param closed (boolean) optional with default false, when true forms the chord from the first and third point\r\n * @param fullCircle Circle (boolean) optional with default false, when true forms the complete circle through the three points\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static ArcThru3Points(first: Vector3, second: Vector3, third: Vector3, steps: number = 32, closed: boolean = false, fullCircle: boolean = false, ref?: Curve3): Curve3 {\r\n const arc: Vector3[] = ref ? ref.getPoints() : [];\r\n const vec1 = second.subtract(first);\r\n const vec2 = third.subtract(second);\r\n const vec3 = first.subtract(third);\r\n const zAxis = Vector3.Cross(vec1, vec2);\r\n const len4 = zAxis.length();\r\n if (len4 < Math.pow(10, -8)) {\r\n if (ref) {\r\n arc.length = 0;\r\n return ref;\r\n }\r\n return new Curve3(arc); // colinear points arc is empty\r\n }\r\n const len1Sq = vec1.lengthSquared();\r\n const len2Sq = vec2.lengthSquared();\r\n const len3Sq = vec3.lengthSquared();\r\n const len4Sq = zAxis.lengthSquared();\r\n const len1 = vec1.length();\r\n const len2 = vec2.length();\r\n const len3 = vec3.length();\r\n const radius = (0.5 * len1 * len2 * len3) / len4;\r\n const dot1 = Vector3.Dot(vec1, vec3);\r\n const dot2 = Vector3.Dot(vec1, vec2);\r\n const dot3 = Vector3.Dot(vec2, vec3);\r\n const a = (-0.5 * len2Sq * dot1) / len4Sq;\r\n const b = (-0.5 * len3Sq * dot2) / len4Sq;\r\n const c = (-0.5 * len1Sq * dot3) / len4Sq;\r\n const center = first.scale(a).add(second.scale(b)).add(third.scale(c));\r\n const radiusVec = first.subtract(center);\r\n const xAxis = radiusVec.normalize();\r\n const yAxis = Vector3.Cross(zAxis, xAxis).normalize();\r\n let length = 0;\r\n const copyOrPush = (point: Vector3) => {\r\n if (!arc[length]) {\r\n arc.push(point);\r\n } else {\r\n arc[length].copyFrom(point);\r\n }\r\n };\r\n if (fullCircle) {\r\n const dStep = (2 * Math.PI) / steps;\r\n for (let theta = 0; theta <= 2 * Math.PI; theta += dStep) {\r\n const point = center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta))));\r\n copyOrPush(point);\r\n length++;\r\n }\r\n copyOrPush(first);\r\n length++;\r\n } else {\r\n const dStep = 1 / steps;\r\n let theta = 0;\r\n let point = Vector3.Zero();\r\n do {\r\n point = center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta))));\r\n copyOrPush(point);\r\n length++;\r\n theta += dStep;\r\n } while (!point.equalsWithEpsilon(third, radius * dStep * 1.1));\r\n copyOrPush(third);\r\n length++;\r\n if (closed) {\r\n copyOrPush(first);\r\n length++;\r\n }\r\n }\r\n arc.length = length;\r\n return ref || new Curve3(arc);\r\n }\r\n\r\n /**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * Tuto : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#curve3-object\r\n * @param points points which make up the curve\r\n */\r\n constructor(points: Vector3[]) {\r\n this._points = points;\r\n this._length = this._computeLength(points);\r\n }\r\n\r\n /**\r\n * @returns the Curve3 stored array of successive Vector3\r\n */\r\n public getPoints() {\r\n return this._points;\r\n }\r\n\r\n /**\r\n * @returns the computed length (float) of the curve.\r\n */\r\n public length() {\r\n return this._length;\r\n }\r\n\r\n /**\r\n * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);\r\n * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.\r\n * curveA and curveB keep unchanged.\r\n * @param curve the curve to continue from this curve\r\n * @returns the newly constructed curve\r\n */\r\n public continue(curve: DeepImmutable<Curve3>): Curve3 {\r\n const lastPoint = this._points[this._points.length - 1];\r\n const continuedPoints = this._points.slice();\r\n const curvePoints = curve.getPoints();\r\n for (let i = 1; i < curvePoints.length; i++) {\r\n continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));\r\n }\r\n const continuedCurve = new Curve3(continuedPoints);\r\n return continuedCurve;\r\n }\r\n\r\n /**\r\n * @param curve\r\n * @returns\r\n */\r\n public copyFrom(curve: Curve3) {\r\n const points = curve.getPoints();\r\n this._points.length = points.length;\r\n for (let i = 0; i < points.length; i++) {\r\n this._points[i] = this._points[i] ? this._points[i].copyFrom(points[i]) : points[i].clone();\r\n }\r\n return this;\r\n }\r\n\r\n private _computeLength(path: DeepImmutable<Vector3[]>): number {\r\n let l = 0;\r\n for (let i = 1; i < path.length; i++) {\r\n l += path[i].subtract(path[i - 1]).length();\r\n }\r\n return l;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"math.path.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.path.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAN,IAAkB,WAOjB;AAPD,WAAkB,WAAW;IACzB;;OAEG;IACH,yCAAM,CAAA;IACN,wBAAwB;IACxB,2CAAO,CAAA;AACX,CAAC,EAPiB,WAAW,KAAX,WAAW,QAO5B;AAED,6CAA6C;AAC7C,MAAM,OAAO,WAAW;IACpB;;;;;;;;OAQG;IACI,MAAM,CAAC,WAAW,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;QAC/E,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACV,OAAO,CAAC,CAAC;QACb,CAAC;QACD,0CAA0C;QAC1C,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;QAElB,IAAI,QAAQ,GAAG,CAAC,CAAC;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzB,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;YACtC,MA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G,KAAK,CAAC,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAChG,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,cAAc,CAAC,IAA8B;QACjD,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC;CACJ","sourcesContent":["import type { DeepImmutable, Nullable } from \"../types\";\r\nimport { Clamp, WithinEpsilon } from \"./math.scalar.functions\";\r\nimport type { Vector4 } from \"./math.vector\";\r\nimport { Matrix, Quaternion, Vector2, Vector3 } from \"./math.vector\";\r\nimport { Epsilon } from \"./math.constants\";\r\n\r\n/**\r\n * Defines potential orientation for back face culling\r\n */\r\nexport const enum Orientation {\r\n /**\r\n * Clockwise\r\n */\r\n CW = 0,\r\n /** Counter clockwise */\r\n CCW = 1,\r\n}\r\n\r\n/** Class used to represent a Bezier curve */\r\nexport class BezierCurve {\r\n /**\r\n * Returns the cubic Bezier interpolated value (float) at \"t\" (float) from the given x1, y1, x2, y2 floats\r\n * @param t defines the time\r\n * @param x1 defines the left coordinate on X axis\r\n * @param y1 defines the left coordinate on Y axis\r\n * @param x2 defines the right coordinate on X axis\r\n * @param y2 defines the right coordinate on Y axis\r\n * @returns the interpolated value\r\n */\r\n public static Interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number {\r\n if (t === 0) {\r\n return 0;\r\n }\r\n // Extract X (which is equal to time here)\r\n const f0 = 1 - 3 * x2 + 3 * x1;\r\n const f1 = 3 * x2 - 6 * x1;\r\n const f2 = 3 * x1;\r\n\r\n let refinedT = t;\r\n for (let i = 0; i < 5; i++) {\r\n const refinedT2 = refinedT * refinedT;\r\n const refinedT3 = refinedT2 * refinedT;\r\n\r\n const x = f0 * refinedT3 + f1 * refinedT2 + f2 * refinedT;\r\n const slope = 1.0 / (3.0 * f0 * refinedT2 + 2.0 * f1 * refinedT + f2);\r\n refinedT -= (x - t) * slope;\r\n refinedT = Math.min(1, Math.max(0, refinedT));\r\n }\r\n\r\n // Resolve cubic bezier for the given x\r\n return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 + 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 + Math.pow(refinedT, 3);\r\n }\r\n}\r\n\r\n/**\r\n * Defines angle representation\r\n */\r\nexport class Angle {\r\n private _radians: number;\r\n\r\n /**\r\n * Creates an Angle object of \"radians\" radians (float).\r\n * @param radians the angle in radians\r\n */\r\n constructor(radians: number) {\r\n this._radians = radians;\r\n if (this._radians < 0.0) {\r\n this._radians += 2.0 * Math.PI;\r\n }\r\n }\r\n\r\n /**\r\n * Get value in degrees\r\n * @returns the Angle value in degrees (float)\r\n */\r\n public degrees() {\r\n return (this._radians * 180.0) / Math.PI;\r\n }\r\n\r\n /**\r\n * Get value in radians\r\n * @returns the Angle value in radians (float)\r\n */\r\n public radians() {\r\n return this._radians;\r\n }\r\n\r\n /**\r\n * Gets a new Angle object with a value of the angle (in radians) between the line connecting the two points and the x-axis\r\n * @param a defines first point as the origin\r\n * @param b defines point\r\n * @returns a new Angle\r\n */\r\n public static BetweenTwoPoints(a: DeepImmutable<Vector2>, b: DeepImmutable<Vector2>): Angle {\r\n const delta = b.subtract(a);\r\n const theta = Math.atan2(delta.y, delta.x);\r\n return new Angle(theta);\r\n }\r\n\r\n /**\r\n * Gets the angle between the two vectors\r\n * @param a defines first vector\r\n * @param b defines vector\r\n * @returns Returns an new Angle between 0 and PI\r\n */\r\n public static BetweenTwoVectors<Vec extends Vector2 | Vector3 | Vector4>(a: DeepImmutable<Vec>, b: DeepImmutable<Vec>): Angle {\r\n let product = a.lengthSquared() * b.lengthSquared();\r\n if (product === 0) {\r\n return new Angle(Math.PI / 2);\r\n }\r\n product = Math.sqrt(product);\r\n let cosVal = a.dot(b as any) / product;\r\n cosVal = Clamp(cosVal, -1, 1);\r\n const angle = Math.acos(cosVal);\r\n return new Angle(angle);\r\n }\r\n\r\n /**\r\n * Gets a new Angle object from the given float in radians\r\n * @param radians defines the angle value in radians\r\n * @returns a new Angle\r\n */\r\n public static FromRadians(radians: number): Angle {\r\n return new Angle(radians);\r\n }\r\n /**\r\n * Gets a new Angle object from the given float in degrees\r\n * @param degrees defines the angle value in degrees\r\n * @returns a new Angle\r\n */\r\n public static FromDegrees(degrees: number): Angle {\r\n return new Angle((degrees * Math.PI) / 180.0);\r\n }\r\n}\r\n\r\n/**\r\n * This represents an arc in a 2d space.\r\n */\r\nexport class Arc2 {\r\n /**\r\n * Defines the center point of the arc.\r\n */\r\n public centerPoint: Vector2;\r\n /**\r\n * Defines the radius of the arc.\r\n */\r\n public radius: number;\r\n /**\r\n * Defines the angle of the arc (from mid point to end point).\r\n */\r\n public angle: Angle;\r\n /**\r\n * Defines the start angle of the arc (from start point to middle point).\r\n */\r\n public startAngle: Angle;\r\n /**\r\n * Defines the orientation of the arc (clock wise/counter clock wise).\r\n */\r\n public orientation: Orientation;\r\n\r\n /**\r\n * Creates an Arc object from the three given points : start, middle and end.\r\n * @param startPoint Defines the start point of the arc\r\n * @param midPoint Defines the middle point of the arc\r\n * @param endPoint Defines the end point of the arc\r\n */\r\n constructor(\r\n /** Defines the start point of the arc */\r\n public startPoint: Vector2,\r\n /** Defines the mid point of the arc */\r\n public midPoint: Vector2,\r\n /** Defines the end point of the arc */\r\n public endPoint: Vector2\r\n ) {\r\n const temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);\r\n const startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2;\r\n const midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2;\r\n const det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);\r\n\r\n this.centerPoint = new Vector2(\r\n (startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det,\r\n ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det\r\n );\r\n\r\n this.radius = this.centerPoint.subtract(this.startPoint).length();\r\n\r\n this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);\r\n\r\n const a1 = this.startAngle.degrees();\r\n let a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();\r\n let a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();\r\n\r\n // angles correction\r\n if (a2 - a1 > +180.0) {\r\n a2 -= 360.0;\r\n }\r\n if (a2 - a1 < -180.0) {\r\n a2 += 360.0;\r\n }\r\n if (a3 - a2 > +180.0) {\r\n a3 -= 360.0;\r\n }\r\n if (a3 - a2 < -180.0) {\r\n a3 += 360.0;\r\n }\r\n\r\n this.orientation = a2 - a1 < 0 ? Orientation.CW : Orientation.CCW;\r\n this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a 2D path made up of multiple 2D points\r\n */\r\nexport class Path2 {\r\n private _points = new Array<Vector2>();\r\n private _length = 0.0;\r\n\r\n /**\r\n * If the path start and end point are the same\r\n */\r\n public closed = false;\r\n\r\n /**\r\n * Creates a Path2 object from the starting 2D coordinates x and y.\r\n * @param x the starting points x value\r\n * @param y the starting points y value\r\n */\r\n constructor(x: number, y: number) {\r\n this._points.push(new Vector2(x, y));\r\n }\r\n\r\n /**\r\n * Adds a new segment until the given coordinates (x, y) to the current Path2.\r\n * @param x the added points x value\r\n * @param y the added points y value\r\n * @returns the updated Path2.\r\n */\r\n public addLineTo(x: number, y: number): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n const newPoint = new Vector2(x, y);\r\n const previousPoint = this._points[this._points.length - 1];\r\n this._points.push(newPoint);\r\n this._length += newPoint.subtract(previousPoint).length();\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.\r\n * @param midX middle point x value\r\n * @param midY middle point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n public addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments = 36): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n const startPoint = this._points[this._points.length - 1];\r\n const midPoint = new Vector2(midX, midY);\r\n const endPoint = new Vector2(endX, endY);\r\n\r\n const arc = new Arc2(startPoint, midPoint, endPoint);\r\n\r\n let increment = arc.angle.radians() / numberOfSegments;\r\n if (arc.orientation === Orientation.CW) {\r\n increment *= -1;\r\n }\r\n let currentAngle = arc.startAngle.radians() + increment;\r\n\r\n for (let i = 0; i < numberOfSegments; i++) {\r\n const x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;\r\n const y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;\r\n this.addLineTo(x, y);\r\n currentAngle += increment;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds _numberOfSegments_ segments according to the quadratic curve definition to the current Path2.\r\n * @param controlX control point x value\r\n * @param controlY control point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n public addQuadraticCurveTo(controlX: number, controlY: number, endX: number, endY: number, numberOfSegments = 36): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n\r\n const equation = (t: number, val0: number, val1: number, val2: number) => {\r\n const res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n return res;\r\n };\r\n const startPoint = this._points[this._points.length - 1];\r\n for (let i = 0; i <= numberOfSegments; i++) {\r\n const step = i / numberOfSegments;\r\n const x = equation(step, startPoint.x, controlX, endX);\r\n const y = equation(step, startPoint.y, controlY, endY);\r\n this.addLineTo(x, y);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds _numberOfSegments_ segments according to the bezier curve definition to the current Path2.\r\n * @param originTangentX tangent vector at the origin point x value\r\n * @param originTangentY tangent vector at the origin point y value\r\n * @param destinationTangentX tangent vector at the destination point x value\r\n * @param destinationTangentY tangent vector at the destination point y value\r\n * @param endX end point x value\r\n * @param endY end point y value\r\n * @param numberOfSegments (default: 36)\r\n * @returns the updated Path2.\r\n */\r\n public addBezierCurveTo(\r\n originTangentX: number,\r\n originTangentY: number,\r\n destinationTangentX: number,\r\n destinationTangentY: number,\r\n endX: number,\r\n endY: number,\r\n numberOfSegments = 36\r\n ): Path2 {\r\n if (this.closed) {\r\n return this;\r\n }\r\n\r\n const equation = (t: number, val0: number, val1: number, val2: number, val3: number) => {\r\n const res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n const startPoint = this._points[this._points.length - 1];\r\n for (let i = 0; i <= numberOfSegments; i++) {\r\n const step = i / numberOfSegments;\r\n const x = equation(step, startPoint.x, originTangentX, destinationTangentX, endX);\r\n const y = equation(step, startPoint.y, originTangentY, destinationTangentY, endY);\r\n this.addLineTo(x, y);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Defines if a given point is inside the polygon defines by the path\r\n * @param point defines the point to test\r\n * @returns true if the point is inside\r\n */\r\n public isPointInside(point: Vector2) {\r\n let isInside = false;\r\n const count = this._points.length;\r\n for (let p = count - 1, q = 0; q < count; p = q++) {\r\n let edgeLow = this._points[p];\r\n let edgeHigh = this._points[q];\r\n\r\n let edgeDx = edgeHigh.x - edgeLow.x;\r\n let edgeDy = edgeHigh.y - edgeLow.y;\r\n\r\n if (Math.abs(edgeDy) > Number.EPSILON) {\r\n // Not parallel\r\n if (edgeDy < 0) {\r\n edgeLow = this._points[q];\r\n edgeDx = -edgeDx;\r\n edgeHigh = this._points[p];\r\n edgeDy = -edgeDy;\r\n }\r\n\r\n if (point.y < edgeLow.y || point.y > edgeHigh.y) {\r\n continue;\r\n }\r\n\r\n if (point.y === edgeLow.y && point.x === edgeLow.x) {\r\n return true;\r\n } else {\r\n const perpEdge = edgeDy * (point.x - edgeLow.x) - edgeDx * (point.y - edgeLow.y);\r\n if (perpEdge === 0) {\r\n return true;\r\n }\r\n if (perpEdge < 0) {\r\n continue;\r\n }\r\n isInside = !isInside;\r\n }\r\n } else {\r\n // parallel or collinear\r\n if (point.y !== edgeLow.y) {\r\n continue;\r\n }\r\n\r\n if ((edgeHigh.x <= point.x && point.x <= edgeLow.x) || (edgeLow.x <= point.x && point.x <= edgeHigh.x)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return isInside;\r\n }\r\n\r\n /**\r\n * Closes the Path2.\r\n * @returns the Path2.\r\n */\r\n public close(): Path2 {\r\n this.closed = true;\r\n return this;\r\n }\r\n /**\r\n * Gets the sum of the distance between each sequential point in the path\r\n * @returns the Path2 total length (float).\r\n */\r\n public length(): number {\r\n let result = this._length;\r\n\r\n if (this.closed) {\r\n const lastPoint = this._points[this._points.length - 1];\r\n const firstPoint = this._points[0];\r\n result += firstPoint.subtract(lastPoint).length();\r\n }\r\n return result;\r\n }\r\n\r\n /**\r\n * Gets the area of the polygon defined by the path\r\n * @returns area value\r\n */\r\n public area(): number {\r\n const n = this._points.length;\r\n let value = 0.0;\r\n\r\n for (let p = n - 1, q = 0; q < n; p = q++) {\r\n value += this._points[p].x * this._points[q].y - this._points[q].x * this._points[p].y;\r\n }\r\n\r\n return value * 0.5;\r\n }\r\n\r\n /**\r\n * Gets the points which construct the path\r\n * @returns the Path2 internal array of points.\r\n */\r\n public getPoints(): Vector2[] {\r\n return this._points;\r\n }\r\n\r\n /**\r\n * Retrieves the point at the distance aways from the starting point\r\n * @param normalizedLengthPosition the length along the path to retrieve the point from\r\n * @returns a new Vector2 located at a percentage of the Path2 total length on this path.\r\n */\r\n public getPointAtLengthPosition(normalizedLengthPosition: number): Vector2 {\r\n if (normalizedLengthPosition < 0 || normalizedLengthPosition > 1) {\r\n return Vector2.Zero();\r\n }\r\n\r\n const lengthPosition = normalizedLengthPosition * this.length();\r\n\r\n let previousOffset = 0;\r\n for (let i = 0; i < this._points.length; i++) {\r\n const j = (i + 1) % this._points.length;\r\n\r\n const a = this._points[i];\r\n const b = this._points[j];\r\n const bToA = b.subtract(a);\r\n\r\n const nextOffset = bToA.length() + previousOffset;\r\n if (lengthPosition >= previousOffset && lengthPosition <= nextOffset) {\r\n const dir = bToA.normalize();\r\n const localOffset = lengthPosition - previousOffset;\r\n\r\n return new Vector2(a.x + dir.x * localOffset, a.y + dir.y * localOffset);\r\n }\r\n previousOffset = nextOffset;\r\n }\r\n\r\n return Vector2.Zero();\r\n }\r\n\r\n /**\r\n * Creates a new path starting from an x and y position\r\n * @param x starting x value\r\n * @param y starting y value\r\n * @returns a new Path2 starting at the coordinates (x, y).\r\n */\r\n public static StartingAt(x: number, y: number): Path2 {\r\n return new Path2(x, y);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a 3D path made up of multiple 3D points\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/path3D\r\n */\r\nexport class Path3D {\r\n private _curve = new Array<Vector3>();\r\n private _distances = new Array<number>();\r\n private _tangents = new Array<Vector3>();\r\n private _normals = new Array<Vector3>();\r\n private _binormals = new Array<Vector3>();\r\n private _raw: boolean;\r\n private _alignTangentsWithPath: boolean;\r\n\r\n // holds interpolated point data\r\n private readonly _pointAtData = {\r\n id: 0,\r\n point: Vector3.Zero(),\r\n previousPointArrayIndex: 0,\r\n\r\n position: 0,\r\n subPosition: 0,\r\n\r\n interpolateReady: false,\r\n interpolationMatrix: Matrix.Identity(),\r\n };\r\n\r\n /**\r\n * new Path3D(path, normal, raw)\r\n * Creates a Path3D. A Path3D is a logical math object, so not a mesh.\r\n * please read the description in the tutorial : https://doc.babylonjs.com/features/featuresDeepDive/mesh/path3D\r\n * @param path an array of Vector3, the curve axis of the Path3D\r\n * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.\r\n * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path.\r\n */\r\n constructor(\r\n /**\r\n * an array of Vector3, the curve axis of the Path3D\r\n */\r\n public path: Vector3[],\r\n firstNormal: Nullable<Vector3> = null,\r\n raw?: boolean,\r\n alignTangentsWithPath = false\r\n ) {\r\n for (let p = 0; p < path.length; p++) {\r\n this._curve[p] = path[p].clone(); // hard copy\r\n }\r\n this._raw = raw || false;\r\n this._alignTangentsWithPath = alignTangentsWithPath;\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n }\r\n\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n public getCurve(): Vector3[] {\r\n return this._curve;\r\n }\r\n\r\n /**\r\n * Returns the Path3D array of successive Vector3 designing its curve.\r\n * @returns the Path3D array of successive Vector3 designing its curve.\r\n */\r\n public getPoints(): Vector3[] {\r\n return this._curve;\r\n }\r\n\r\n /**\r\n * @returns the computed length (float) of the path.\r\n */\r\n public length() {\r\n return this._distances[this._distances.length - 1];\r\n }\r\n\r\n /**\r\n * Returns an array populated with tangent vectors on each Path3D curve point.\r\n * @returns an array populated with tangent vectors on each Path3D curve point.\r\n */\r\n public getTangents(): Vector3[] {\r\n return this._tangents;\r\n }\r\n\r\n /**\r\n * Returns an array populated with normal vectors on each Path3D curve point.\r\n * @returns an array populated with normal vectors on each Path3D curve point.\r\n */\r\n public getNormals(): Vector3[] {\r\n return this._normals;\r\n }\r\n\r\n /**\r\n * Returns an array populated with binormal vectors on each Path3D curve point.\r\n * @returns an array populated with binormal vectors on each Path3D curve point.\r\n */\r\n public getBinormals(): Vector3[] {\r\n return this._binormals;\r\n }\r\n\r\n /**\r\n * Returns an array populated with distances (float) of the i-th point from the first curve point.\r\n * @returns an array populated with distances (float) of the i-th point from the first curve point.\r\n */\r\n public getDistances(): number[] {\r\n return this._distances;\r\n }\r\n\r\n /**\r\n * Returns an interpolated point along this path\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns a new Vector3 as the point\r\n */\r\n public getPointAt(position: number): Vector3 {\r\n return this._updatePointAtData(position).point;\r\n }\r\n\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated tangent instead of the tangent of the previous path point.\r\n * @returns a tangent vector corresponding to the interpolated Path3D curve point, if not interpolated, the tangent is taken from the precomputed tangents array.\r\n */\r\n public getTangentAt(position: number, interpolated = false): Vector3 {\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Forward(), this._pointAtData.interpolationMatrix) : this._tangents[this._pointAtData.previousPointArrayIndex];\r\n }\r\n\r\n /**\r\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated normal instead of the normal of the previous path point.\r\n * @returns a normal vector corresponding to the interpolated Path3D curve point, if not interpolated, the normal is taken from the precomputed normals array.\r\n */\r\n public getNormalAt(position: number, interpolated = false): Vector3 {\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.Right(), this._pointAtData.interpolationMatrix) : this._normals[this._pointAtData.previousPointArrayIndex];\r\n }\r\n\r\n /**\r\n * Returns the binormal vector of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated binormal instead of the binormal of the previous path point.\r\n * @returns a binormal vector corresponding to the interpolated Path3D curve point, if not interpolated, the binormal is taken from the precomputed binormals array.\r\n */\r\n public getBinormalAt(position: number, interpolated = false): Vector3 {\r\n this._updatePointAtData(position, interpolated);\r\n return interpolated ? Vector3.TransformCoordinates(Vector3.UpReadOnly, this._pointAtData.interpolationMatrix) : this._binormals[this._pointAtData.previousPointArrayIndex];\r\n }\r\n\r\n /**\r\n * Returns the distance (float) of an interpolated Path3D curve point at the specified position along this path.\r\n * @param position the position of the point along this path, from 0.0 to 1.0\r\n * @returns the distance of the interpolated Path3D curve point at the specified position along this path.\r\n */\r\n public getDistanceAt(position: number): number {\r\n return this.length() * position;\r\n }\r\n\r\n /**\r\n * Returns the array index of the previous point of an interpolated point along this path\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the array index\r\n */\r\n public getPreviousPointIndexAt(position: number) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.previousPointArrayIndex;\r\n }\r\n\r\n /**\r\n * Returns the position of an interpolated point relative to the two path points it lies between, from 0.0 (point A) to 1.0 (point B)\r\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\r\n * @returns the sub position\r\n */\r\n public getSubPositionAt(position: number) {\r\n this._updatePointAtData(position);\r\n return this._pointAtData.subPosition;\r\n }\r\n\r\n /**\r\n * Returns the position of the closest virtual point on this path to an arbitrary Vector3, from 0.0 to 1.0\r\n * @param target the vector of which to get the closest position to\r\n * @returns the position of the closest virtual point on this path to the target vector\r\n */\r\n public getClosestPositionTo(target: Vector3) {\r\n let smallestDistance = Number.MAX_VALUE;\r\n let closestPosition = 0.0;\r\n for (let i = 0; i < this._curve.length - 1; i++) {\r\n const point = this._curve[i + 0];\r\n const tangent = this._curve[i + 1].subtract(point).normalize();\r\n const subLength = this._distances[i + 1] - this._distances[i + 0];\r\n const subPosition = Math.min((Math.max(Vector3.Dot(tangent, target.subtract(point).normalize()), 0.0) * Vector3.Distance(point, target)) / subLength, 1.0);\r\n const distance = Vector3.Distance(point.add(tangent.scale(subPosition * subLength)), target);\r\n\r\n if (distance < smallestDistance) {\r\n smallestDistance = distance;\r\n closestPosition = (this._distances[i + 0] + subLength * subPosition) / this.length();\r\n }\r\n }\r\n return closestPosition;\r\n }\r\n\r\n /**\r\n * Returns a sub path (slice) of this path\r\n * @param start the position of the fist path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @param end the position of the last path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\r\n * @returns a sub path (slice) of this path\r\n */\r\n public slice(start: number = 0.0, end: number = 1.0) {\r\n if (start < 0.0) {\r\n start = 1 - ((start * -1.0) % 1.0);\r\n }\r\n if (end < 0.0) {\r\n end = 1 - ((end * -1.0) % 1.0);\r\n }\r\n if (start > end) {\r\n const _start = start;\r\n start = end;\r\n end = _start;\r\n }\r\n const curvePoints = this.getCurve();\r\n\r\n const startPoint = this.getPointAt(start);\r\n let startIndex = this.getPreviousPointIndexAt(start);\r\n\r\n const endPoint = this.getPointAt(end);\r\n const endIndex = this.getPreviousPointIndexAt(end) + 1;\r\n\r\n const slicePoints: Vector3[] = [];\r\n if (start !== 0.0) {\r\n startIndex++;\r\n slicePoints.push(startPoint);\r\n }\r\n\r\n slicePoints.push(...curvePoints.slice(startIndex, endIndex));\r\n if (end !== 1.0 || start === 1.0) {\r\n slicePoints.push(endPoint);\r\n }\r\n return new Path3D(slicePoints, this.getNormalAt(start), this._raw, this._alignTangentsWithPath);\r\n }\r\n\r\n /**\r\n * Forces the Path3D tangent, normal, binormal and distance recomputation.\r\n * @param path path which all values are copied into the curves points\r\n * @param firstNormal which should be projected onto the curve\r\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path\r\n * @returns the same object updated.\r\n */\r\n public update(path: Vector3[], firstNormal: Nullable<Vector3> = null, alignTangentsWithPath = false): Path3D {\r\n for (let p = 0; p < path.length; p++) {\r\n if (!this._curve[p]) {\r\n this._curve[p] = path[p].clone();\r\n } else {\r\n this._curve[p].x = path[p].x;\r\n this._curve[p].y = path[p].y;\r\n this._curve[p].z = path[p].z;\r\n }\r\n }\r\n this._curve.length = path.length;\r\n this._compute(firstNormal, alignTangentsWithPath);\r\n return this;\r\n }\r\n\r\n // private function compute() : computes tangents, normals and binormals\r\n private _compute(firstNormal: Nullable<Vector3>, alignTangentsWithPath = false): void {\r\n const l = this._curve.length;\r\n\r\n if (l < 2) {\r\n return;\r\n }\r\n\r\n // first and last tangents\r\n this._tangents[0] = this._getFirstNonNullVector(0);\r\n if (!this._raw) {\r\n this._tangents[0].normalize();\r\n }\r\n this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);\r\n if (!this._raw) {\r\n this._tangents[l - 1].normalize();\r\n }\r\n\r\n // normals and binormals at first point : arbitrary vector with _normalVector()\r\n const tg0 = this._tangents[0];\r\n const pp0 = this._normalVector(tg0, firstNormal);\r\n this._normals[0] = pp0;\r\n if (!this._raw) {\r\n this._normals[0].normalize();\r\n }\r\n this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);\r\n if (!this._raw) {\r\n this._binormals[0].normalize();\r\n }\r\n this._distances[0] = 0.0;\r\n\r\n // normals and binormals : next points\r\n let prev: Vector3; // previous vector (segment)\r\n let cur: Vector3; // current vector (segment)\r\n let curTang: Vector3; // current tangent\r\n // previous normal\r\n let prevNor: Vector3; // previous normal\r\n let prevBinor: Vector3; // previous binormal\r\n\r\n for (let i = 1; i < l; i++) {\r\n // tangents\r\n prev = this._getLastNonNullVector(i);\r\n if (i < l - 1) {\r\n cur = this._getFirstNonNullVector(i);\r\n this._tangents[i] = alignTangentsWithPath ? cur : prev.add(cur);\r\n this._tangents[i].normalize();\r\n }\r\n this._distances[i] = this._distances[i - 1] + this._curve[i].subtract(this._curve[i - 1]).length();\r\n\r\n // normals and binormals\r\n // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html\r\n curTang = this._tangents[i];\r\n prevBinor = this._binormals[i - 1];\r\n this._normals[i] = Vector3.Cross(prevBinor, curTang);\r\n if (!this._raw) {\r\n if (this._normals[i].length() === 0) {\r\n prevNor = this._normals[i - 1];\r\n this._normals[i] = prevNor.clone();\r\n } else {\r\n this._normals[i].normalize();\r\n }\r\n }\r\n this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);\r\n if (!this._raw) {\r\n this._binormals[i].normalize();\r\n }\r\n }\r\n this._pointAtData.id = NaN;\r\n }\r\n\r\n // private function getFirstNonNullVector(index)\r\n // returns the first non null vector from index : curve[index + N].subtract(curve[index])\r\n private _getFirstNonNullVector(index: number): Vector3 {\r\n let i = 1;\r\n let nNVector: Vector3 = this._curve[index + i].subtract(this._curve[index]);\r\n while (nNVector.length() === 0 && index + i + 1 < this._curve.length) {\r\n i++;\r\n nNVector = this._curve[index + i].subtract(this._curve[index]);\r\n }\r\n return nNVector;\r\n }\r\n\r\n // private function getLastNonNullVector(index)\r\n // returns the last non null vector from index : curve[index].subtract(curve[index - N])\r\n private _getLastNonNullVector(index: number): Vector3 {\r\n let i = 1;\r\n let nLVector: Vector3 = this._curve[index].subtract(this._curve[index - i]);\r\n while (nLVector.length() === 0 && index > i + 1) {\r\n i++;\r\n nLVector = this._curve[index].subtract(this._curve[index - i]);\r\n }\r\n return nLVector;\r\n }\r\n\r\n // private function normalVector(v0, vt, va) :\r\n // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane\r\n // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0\r\n private _normalVector(vt: Vector3, va: Nullable<Vector3>): Vector3 {\r\n let normal0: Vector3;\r\n let tgl = vt.length();\r\n if (tgl === 0.0) {\r\n tgl = 1.0;\r\n }\r\n\r\n if (va === undefined || va === null) {\r\n let point: Vector3;\r\n if (!WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, Epsilon)) {\r\n // search for a point in the plane\r\n point = new Vector3(0.0, -1.0, 0.0);\r\n } else if (!WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(1.0, 0.0, 0.0);\r\n } else if (!WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(0.0, 0.0, 1.0);\r\n } else {\r\n point = Vector3.Zero();\r\n }\r\n normal0 = Vector3.Cross(vt, point);\r\n } else {\r\n normal0 = Vector3.Cross(vt, va);\r\n Vector3.CrossToRef(normal0, vt, normal0);\r\n }\r\n normal0.normalize();\r\n return normal0;\r\n }\r\n\r\n /**\r\n * Updates the point at data for an interpolated point along this curve\r\n * @param position the position of the point along this curve, from 0.0 to 1.0\r\n * @param interpolateTNB\r\n * @interpolateTNB whether to compute the interpolated tangent, normal and binormal\r\n * @returns the (updated) point at data\r\n */\r\n private _updatePointAtData(position: number, interpolateTNB: boolean = false) {\r\n // set an id for caching the result\r\n if (this._pointAtData.id === position) {\r\n if (!this._pointAtData.interpolateReady) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n } else {\r\n this._pointAtData.id = position;\r\n }\r\n const curvePoints = this.getPoints();\r\n\r\n // clamp position between 0.0 and 1.0\r\n if (position <= 0.0) {\r\n return this._setPointAtData(0.0, 0.0, curvePoints[0], 0, interpolateTNB);\r\n } else if (position >= 1.0) {\r\n return this._setPointAtData(1.0, 1.0, curvePoints[curvePoints.length - 1], curvePoints.length - 1, interpolateTNB);\r\n }\r\n\r\n let previousPoint: Vector3 = curvePoints[0];\r\n let currentPoint: Vector3;\r\n let currentLength = 0.0;\r\n const targetLength = position * this.length();\r\n\r\n for (let i = 1; i < curvePoints.length; i++) {\r\n currentPoint = curvePoints[i];\r\n const distance = Vector3.Distance(previousPoint, currentPoint);\r\n currentLength += distance;\r\n if (currentLength === targetLength) {\r\n return this._setPointAtData(position, 1.0, currentPoint, i, interpolateTNB);\r\n } else if (currentLength > targetLength) {\r\n const toLength = currentLength - targetLength;\r\n const diff = toLength / distance;\r\n const dir = previousPoint.subtract(currentPoint);\r\n const point = currentPoint.add(dir.scaleInPlace(diff));\r\n return this._setPointAtData(position, 1 - diff, point, i - 1, interpolateTNB);\r\n }\r\n previousPoint = currentPoint;\r\n }\r\n return this._pointAtData;\r\n }\r\n\r\n /**\r\n * Updates the point at data from the specified parameters\r\n * @param position where along the path the interpolated point is, from 0.0 to 1.0\r\n * @param subPosition\r\n * @param point the interpolated point\r\n * @param parentIndex the index of an existing curve point that is on, or else positionally the first behind, the interpolated point\r\n * @param interpolateTNB whether to compute the interpolated tangent, normal and binormal\r\n * @returns the (updated) point at data\r\n */\r\n private _setPointAtData(position: number, subPosition: number, point: Vector3, parentIndex: number, interpolateTNB: boolean) {\r\n this._pointAtData.point = point;\r\n this._pointAtData.position = position;\r\n this._pointAtData.subPosition = subPosition;\r\n this._pointAtData.previousPointArrayIndex = parentIndex;\r\n this._pointAtData.interpolateReady = interpolateTNB;\r\n\r\n if (interpolateTNB) {\r\n this._updateInterpolationMatrix();\r\n }\r\n return this._pointAtData;\r\n }\r\n\r\n /**\r\n * Updates the point at interpolation matrix for the tangents, normals and binormals\r\n */\r\n private _updateInterpolationMatrix() {\r\n this._pointAtData.interpolationMatrix = Matrix.Identity();\r\n const parentIndex = this._pointAtData.previousPointArrayIndex;\r\n\r\n if (parentIndex !== this._tangents.length - 1) {\r\n const index = parentIndex + 1;\r\n\r\n const tangentFrom = this._tangents[parentIndex].clone();\r\n const normalFrom = this._normals[parentIndex].clone();\r\n const binormalFrom = this._binormals[parentIndex].clone();\r\n\r\n const tangentTo = this._tangents[index].clone();\r\n const normalTo = this._normals[index].clone();\r\n const binormalTo = this._binormals[index].clone();\r\n\r\n const quatFrom = Quaternion.RotationQuaternionFromAxis(normalFrom, binormalFrom, tangentFrom);\r\n const quatTo = Quaternion.RotationQuaternionFromAxis(normalTo, binormalTo, tangentTo);\r\n const quatAt = Quaternion.Slerp(quatFrom, quatTo, this._pointAtData.subPosition);\r\n\r\n quatAt.toRotationMatrix(this._pointAtData.interpolationMatrix);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves\r\n */\r\nexport class Curve3 {\r\n private _points: Vector3[];\r\n private _length: number = 0.0;\r\n\r\n /**\r\n * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#quadratic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Quadratic Bezier\r\n * @param v1 (Vector3) the control point\r\n * @param v2 (Vector3) the end point of the Quadratic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateQuadraticBezier(v0: DeepImmutable<Vector3>, v1: DeepImmutable<Vector3>, v2: DeepImmutable<Vector3>, nbPoints: number, ref?: Curve3): Curve3 {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n const bez: Vector3[] = ref ? ref.getPoints() : [];\r\n const equation = (t: number, val0: number, val1: number, val2: number) => {\r\n return (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\r\n };\r\n for (let i = 0; i <= nbPoints; i++) {\r\n const x = equation(i / nbPoints, v0.x, v1.x, v2.x);\r\n const y = equation(i / nbPoints, v0.y, v1.y, v2.y);\r\n const z = equation(i / nbPoints, v0.z, v1.z, v2.z);\r\n if (bez[i]) {\r\n bez[i].copyFromFloats(x, y, z);\r\n } else {\r\n bez.push(new Vector3(x, y, z));\r\n }\r\n }\r\n bez.length = nbPoints + 1;\r\n return ref || new Curve3(bez);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#cubic-bezier-curve\r\n * @param v0 (Vector3) the origin point of the Cubic Bezier\r\n * @param v1 (Vector3) the first control point\r\n * @param v2 (Vector3) the second control point\r\n * @param v3 (Vector3) the end point of the Cubic Bezier\r\n * @param nbPoints (integer) the wanted number of points in the curve\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateCubicBezier(\r\n v0: DeepImmutable<Vector3>,\r\n v1: DeepImmutable<Vector3>,\r\n v2: DeepImmutable<Vector3>,\r\n v3: DeepImmutable<Vector3>,\r\n nbPoints: number,\r\n ref?: Curve3\r\n ): Curve3 {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n const bez: Vector3[] = ref ? ref.getPoints() : [];\r\n const equation = (t: number, val0: number, val1: number, val2: number, val3: number) => {\r\n const res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\r\n return res;\r\n };\r\n for (let i = 0; i <= nbPoints; i++) {\r\n const x = equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x);\r\n const y = equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y);\r\n const z = equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z);\r\n if (bez[i]) {\r\n bez[i].copyFromFloats(x, y, z);\r\n } else {\r\n bez.push(new Vector3(x, y, z));\r\n }\r\n }\r\n bez.length = nbPoints + 1;\r\n return ref || new Curve3(bez);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#hermite-spline\r\n * @param p1 (Vector3) the origin point of the Hermite Spline\r\n * @param t1 (Vector3) the tangent vector at the origin point\r\n * @param p2 (Vector3) the end point of the Hermite Spline\r\n * @param t2 (Vector3) the tangent vector at the end point\r\n * @param nSeg (integer) the number of curve segments or nSeg + 1 points in the array\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateHermiteSpline(\r\n p1: DeepImmutable<Vector3>,\r\n t1: DeepImmutable<Vector3>,\r\n p2: DeepImmutable<Vector3>,\r\n t2: DeepImmutable<Vector3>,\r\n nSeg: number,\r\n ref?: Curve3\r\n ): Curve3 {\r\n const hermite: Vector3[] = ref ? ref.getPoints() : [];\r\n const step = 1.0 / nSeg;\r\n for (let i = 0; i <= nSeg; i++) {\r\n if (hermite[i]) {\r\n Vector3.HermiteToRef(p1, t1, p2, t2, i * step, hermite[i]);\r\n } else {\r\n hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n }\r\n hermite.length = nSeg + 1;\r\n return ref || new Curve3(hermite);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along a CatmullRom Spline curve :\r\n * @param points (array of Vector3) the points the spline must pass through. At least, four points required\r\n * @param nbPoints (integer) the wanted number of points between each curve control points\r\n * @param closed (boolean) optional with default false, when true forms a closed loop from the points\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static CreateCatmullRomSpline(points: DeepImmutable<Vector3[]>, nbPoints: number, closed?: boolean, ref?: Curve3): Curve3 {\r\n const catmullRom: Vector3[] = ref ? ref.getPoints() : [];\r\n const step = 1.0 / nbPoints;\r\n let amount = 0.0;\r\n if (closed) {\r\n const pointsCount = points.length;\r\n for (let i = 0; i < pointsCount; i++) {\r\n amount = 0;\r\n for (let c = 0; c < nbPoints; c++) {\r\n if (catmullRom[i]) {\r\n Vector3.CatmullRomToRef(\r\n points[i % pointsCount],\r\n points[(i + 1) % pointsCount],\r\n points[(i + 2) % pointsCount],\r\n points[(i + 3) % pointsCount],\r\n amount,\r\n catmullRom[i]\r\n );\r\n } else {\r\n catmullRom.push(\r\n Vector3.CatmullRom(points[i % pointsCount], points[(i + 1) % pointsCount], points[(i + 2) % pointsCount], points[(i + 3) % pointsCount], amount)\r\n );\r\n }\r\n amount += step;\r\n }\r\n }\r\n if (catmullRom[pointsCount]) {\r\n catmullRom[pointsCount].copyFrom(catmullRom[0]);\r\n } else {\r\n catmullRom.push(catmullRom[0]);\r\n }\r\n } else {\r\n const totalPoints: Vector3[] = [];\r\n totalPoints.push(points[0].clone());\r\n Array.prototype.push.apply(totalPoints, points);\r\n totalPoints.push(points[points.length - 1].clone());\r\n let i = 0;\r\n let index = 0;\r\n const pushPoint = () => {\r\n if (catmullRom[index]) {\r\n Vector3.CatmullRomToRef(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount, catmullRom[index]);\r\n } else {\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n };\r\n for (; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (let c = 0; c < nbPoints; c++) {\r\n pushPoint();\r\n amount += step;\r\n index++;\r\n }\r\n }\r\n i--;\r\n pushPoint();\r\n index++;\r\n catmullRom.length = index;\r\n }\r\n return ref || new Curve3(catmullRom);\r\n }\r\n\r\n /**\r\n * Returns a Curve3 object along an arc through three vector3 points:\r\n * The three points should not be colinear. When they are the Curve3 is empty.\r\n * @param first (Vector3) the first point the arc must pass through.\r\n * @param second (Vector3) the second point the arc must pass through.\r\n * @param third (Vector3) the third point the arc must pass through.\r\n * @param steps (number) the larger the number of steps the more detailed the arc.\r\n * @param closed (boolean) optional with default false, when true forms the chord from the first and third point\r\n * @param fullCircle Circle (boolean) optional with default false, when true forms the complete circle through the three points\r\n * @param ref (Curve3) the updated Curve3 ref\r\n * @returns the created Curve3\r\n */\r\n public static ArcThru3Points(first: Vector3, second: Vector3, third: Vector3, steps: number = 32, closed: boolean = false, fullCircle: boolean = false, ref?: Curve3): Curve3 {\r\n const arc: Vector3[] = ref ? ref.getPoints() : [];\r\n const vec1 = second.subtract(first);\r\n const vec2 = third.subtract(second);\r\n const vec3 = first.subtract(third);\r\n const zAxis = Vector3.Cross(vec1, vec2);\r\n const len4 = zAxis.length();\r\n if (len4 < Math.pow(10, -8)) {\r\n if (ref) {\r\n arc.length = 0;\r\n return ref;\r\n }\r\n return new Curve3(arc); // colinear points arc is empty\r\n }\r\n const len1Sq = vec1.lengthSquared();\r\n const len2Sq = vec2.lengthSquared();\r\n const len3Sq = vec3.lengthSquared();\r\n const len4Sq = zAxis.lengthSquared();\r\n const len1 = vec1.length();\r\n const len2 = vec2.length();\r\n const len3 = vec3.length();\r\n const radius = (0.5 * len1 * len2 * len3) / len4;\r\n const dot1 = Vector3.Dot(vec1, vec3);\r\n const dot2 = Vector3.Dot(vec1, vec2);\r\n const dot3 = Vector3.Dot(vec2, vec3);\r\n const a = (-0.5 * len2Sq * dot1) / len4Sq;\r\n const b = (-0.5 * len3Sq * dot2) / len4Sq;\r\n const c = (-0.5 * len1Sq * dot3) / len4Sq;\r\n const center = first.scale(a).add(second.scale(b)).add(third.scale(c));\r\n const radiusVec = first.subtract(center);\r\n const xAxis = radiusVec.normalize();\r\n const yAxis = Vector3.Cross(zAxis, xAxis).normalize();\r\n let length = 0;\r\n const copyOrPush = (point: Vector3) => {\r\n if (!arc[length]) {\r\n arc.push(point);\r\n } else {\r\n arc[length].copyFrom(point);\r\n }\r\n };\r\n if (fullCircle) {\r\n const dStep = (2 * Math.PI) / steps;\r\n for (let theta = 0; theta <= 2 * Math.PI; theta += dStep) {\r\n const point = center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta))));\r\n copyOrPush(point);\r\n length++;\r\n }\r\n copyOrPush(first);\r\n length++;\r\n } else {\r\n const dStep = 1 / steps;\r\n let theta = 0;\r\n let point: Vector3;\r\n do {\r\n point = center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta))));\r\n copyOrPush(point);\r\n length++;\r\n theta += dStep;\r\n } while (!point.equalsWithEpsilon(third, radius * dStep * 1.1));\r\n copyOrPush(third);\r\n length++;\r\n if (closed) {\r\n copyOrPush(first);\r\n length++;\r\n }\r\n }\r\n arc.length = length;\r\n return ref || new Curve3(arc);\r\n }\r\n\r\n /**\r\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\r\n * A Curve3 is designed from a series of successive Vector3.\r\n * Tuto : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#curve3-object\r\n * @param points points which make up the curve\r\n */\r\n constructor(points: Vector3[]) {\r\n this._points = points;\r\n this._length = this._computeLength(points);\r\n }\r\n\r\n /**\r\n * @returns the Curve3 stored array of successive Vector3\r\n */\r\n public getPoints() {\r\n return this._points;\r\n }\r\n\r\n /**\r\n * @returns the computed length (float) of the curve.\r\n */\r\n public length() {\r\n return this._length;\r\n }\r\n\r\n /**\r\n * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);\r\n * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.\r\n * curveA and curveB keep unchanged.\r\n * @param curve the curve to continue from this curve\r\n * @returns the newly constructed curve\r\n */\r\n public continue(curve: DeepImmutable<Curve3>): Curve3 {\r\n const lastPoint = this._points[this._points.length - 1];\r\n const continuedPoints = this._points.slice();\r\n const curvePoints = curve.getPoints();\r\n for (let i = 1; i < curvePoints.length; i++) {\r\n continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));\r\n }\r\n const continuedCurve = new Curve3(continuedPoints);\r\n return continuedCurve;\r\n }\r\n\r\n /**\r\n * @param curve\r\n * @returns\r\n */\r\n public copyFrom(curve: Curve3) {\r\n const points = curve.getPoints();\r\n this._points.length = points.length;\r\n for (let i = 0; i < points.length; i++) {\r\n this._points[i] = this._points[i] ? this._points[i].copyFrom(points[i]) : points[i].clone();\r\n }\r\n return this;\r\n }\r\n\r\n private _computeLength(path: DeepImmutable<Vector3[]>): number {\r\n let l = 0;\r\n for (let i = 1; i < path.length; i++) {\r\n l += path[i].subtract(path[i - 1]).length();\r\n }\r\n return l;\r\n }\r\n}\r\n"]}
|
|
@@ -72,7 +72,7 @@ export function LerpAngle(start, end, amount) {
|
|
|
72
72
|
* @returns the inverseLerp value
|
|
73
73
|
*/
|
|
74
74
|
export function InverseLerp(a, b, value) {
|
|
75
|
-
let result
|
|
75
|
+
let result;
|
|
76
76
|
if (a != b) {
|
|
77
77
|
result = Clamp((value - a) / (b - a));
|
|
78
78
|
}
|
|
@@ -267,7 +267,7 @@ export function SmoothStep(from, to, tx) {
|
|
|
267
267
|
* @returns resulting value
|
|
268
268
|
*/
|
|
269
269
|
export function MoveTowards(current, target, maxDelta) {
|
|
270
|
-
let result
|
|
270
|
+
let result;
|
|
271
271
|
if (Math.abs(target - current) <= maxDelta) {
|
|
272
272
|
result = target;
|
|
273
273
|
}
|
|
@@ -288,7 +288,7 @@ export function MoveTowards(current, target, maxDelta) {
|
|
|
288
288
|
*/
|
|
289
289
|
export function MoveTowardsAngle(current, target, maxDelta) {
|
|
290
290
|
const num = DeltaAngle(current, target);
|
|
291
|
-
let result
|
|
291
|
+
let result;
|
|
292
292
|
if (-maxDelta < num && num < maxDelta) {
|
|
293
293
|
result = target;
|
|
294
294
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.scalar.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.scalar.functions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACtC,OAAO,QAAQ,CAA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E,MAAM,GAAG,GAAW,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,IAAI,MAAM,GAAW,CAAC,CAAC;IACvB,IAAI,CAAC,QAAQ,GAAG,GAAG,IAAI,GAAG,GAAG,QAAQ,EAAE,CAAC;QACpC,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC;SAAM,CAAC;QACJ,MAAM,GAAG,OAAO,GAAG,GAAG,CAAC;QACvB,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,GAAW,EAAE,GAAW;IACnE,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,GAAW,EAAE,GAAW;IACpE,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAS,EAAE,CAAS;IACpD,MAAM,CAAC,GAAW,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,CAAC","sourcesContent":["/**\r\n * Extract int value\r\n * @param value number value\r\n * @returns int value\r\n */\r\nexport function ExtractAsInt(value: number) {\r\n return parseInt(value.toString().replace(/\\W/g, \"\"));\r\n}\r\n\r\n/**\r\n * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n * @param a number\r\n * @param b number\r\n * @param epsilon (default = 1.401298E-45)\r\n * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n */\r\nexport function WithinEpsilon(a: number, b: number, epsilon: number = 1.401298e-45): boolean {\r\n return Math.abs(a - b) <= epsilon;\r\n}\r\n\r\n/**\r\n * Boolean : true if the number is outside a range\r\n * @param num number\r\n * @param min min value\r\n * @param max max value\r\n * @param epsilon (default = Number.EPSILON)\r\n * @returns true if the number is between min and max values\r\n */\r\nexport function OutsideRange(num: number, min: number, max: number, epsilon: number = 1.401298e-45): boolean {\r\n return num < min - epsilon || num > max + epsilon;\r\n}\r\n\r\n/**\r\n * Returns a random float number between and min and max values\r\n * @param min min value of random\r\n * @param max max value of random\r\n * @returns random value\r\n */\r\nexport function RandomRange(min: number, max: number): number {\r\n if (min === max) {\r\n return min;\r\n }\r\n return Math.random() * (max - min) + min;\r\n}\r\n\r\n/**\r\n * Creates a new scalar with values linearly interpolated of \"amount\" between the start scalar and the end scalar.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\nexport function Lerp(start: number, end: number, amount: number): number {\r\n return start + (end - start) * amount;\r\n}\r\n\r\n/**\r\n * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\nexport function LerpAngle(start: number, end: number, amount: number): number {\r\n let num: number = Repeat(end - start, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return start + num * Clamp(amount);\r\n}\r\n\r\n/**\r\n * Calculates the linear parameter t that produces the interpolant value within the range [a, b].\r\n * @param a start value\r\n * @param b target value\r\n * @param value value between a and b\r\n * @returns the inverseLerp value\r\n */\r\nexport function InverseLerp(a: number, b: number, value: number): number {\r\n let result: number = 0;\r\n if (a != b) {\r\n result = Clamp((value - a) / (b - a));\r\n } else {\r\n result = 0.0;\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a new scalar located for \"amount\" (float) on the Hermite spline defined by the scalars \"value1\", \"value3\", \"tangent1\", \"tangent2\".\r\n * @see http://mathworld.wolfram.com/HermitePolynomial.html\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent\r\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\r\n * @returns hermite result\r\n */\r\nexport function Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number {\r\n const squared = amount * amount;\r\n const cubed = amount * squared;\r\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\r\n const part2 = -2.0 * cubed + 3.0 * squared;\r\n const part3 = cubed - 2.0 * squared + amount;\r\n const part4 = cubed - squared;\r\n\r\n return value1 * part1 + value2 * part2 + tangent1 * part3 + tangent2 * part4;\r\n}\r\n\r\n/**\r\n * Returns a new scalar which is the 1st derivative of the Hermite spline defined by the scalars \"value1\", \"value2\", \"tangent1\", \"tangent2\".\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent\r\n * @param time define where the derivative must be done\r\n * @returns 1st derivative\r\n */\r\nexport function Hermite1stDerivative(value1: number, tangent1: number, value2: number, tangent2: number, time: number): number {\r\n const t2 = time * time;\r\n return (t2 - time) * 6 * value1 + (3 * t2 - 4 * time + 1) * tangent1 + (-t2 + time) * 6 * value2 + (3 * t2 - 2 * time) * tangent2;\r\n}\r\n\r\n/**\r\n * Returns the value itself if it's between min and max.\r\n * Returns min if the value is lower than min.\r\n * Returns max if the value is greater than max.\r\n * @param value the value to clmap\r\n * @param min the min value to clamp to (default: 0)\r\n * @param max the max value to clamp to (default: 1)\r\n * @returns the clamped value\r\n */\r\nexport function Clamp(value: number, min = 0, max = 1): number {\r\n return Math.min(max, Math.max(min, value));\r\n}\r\n\r\n/**\r\n * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.\r\n * @param angle The angle to normalize in radian.\r\n * @returns The converted angle.\r\n */\r\nexport function NormalizeRadians(angle: number): number {\r\n // More precise but slower version kept for reference.\r\n // angle = angle % Tools.TwoPi;\r\n // angle = (angle + Tools.TwoPi) % Tools.TwoPi;\r\n\r\n //if (angle > Math.PI) {\r\n //\tangle -= Tools.TwoPi;\r\n //}\r\n\r\n angle -= Math.PI * 2 * Math.floor((angle + Math.PI) / (Math.PI * 2));\r\n\r\n return angle;\r\n}\r\n\r\n/**\r\n * Returns a string : the upper case translation of the number i to hexadecimal.\r\n * @param i number\r\n * @returns the upper case translation of the number i to hexadecimal.\r\n */\r\nexport function ToHex(i: number): string {\r\n const str = i.toString(16);\r\n\r\n if (i <= 15) {\r\n return (\"0\" + str).toUpperCase();\r\n }\r\n\r\n return str.toUpperCase();\r\n}\r\n\r\n/**\r\n * the floor part of a log2 value.\r\n * @param value the value to compute log2 of\r\n * @returns the log2 of value.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function ILog2(value: number): number {\r\n if (Math.log2) {\r\n return Math.floor(Math.log2(value));\r\n }\r\n\r\n if (value < 0) {\r\n return NaN;\r\n } else if (value === 0) {\r\n return -Infinity;\r\n }\r\n\r\n let n = 0;\r\n if (value < 1) {\r\n while (value < 1) {\r\n n++;\r\n value = value * 2;\r\n }\r\n n = -n;\r\n } else if (value > 1) {\r\n while (value > 1) {\r\n n++;\r\n value = Math.floor(value / 2);\r\n }\r\n }\r\n\r\n return n;\r\n}\r\n\r\n/**\r\n * Loops the value, so that it is never larger than length and never smaller than 0.\r\n *\r\n * This is similar to the modulo operator but it works with floating point numbers.\r\n * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.\r\n * With t = 5 and length = 2.5, the result would be 0.0.\r\n * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator\r\n * @param value the value\r\n * @param length the length\r\n * @returns the looped value\r\n */\r\nexport function Repeat(value: number, length: number): number {\r\n return value - Math.floor(value / length) * length;\r\n}\r\n\r\n/**\r\n * Normalize the value between 0.0 and 1.0 using min and max values\r\n * @param value value to normalize\r\n * @param min max to normalize between\r\n * @param max min to normalize between\r\n * @returns the normalized value\r\n */\r\nexport function Normalize(value: number, min: number, max: number): number {\r\n return (value - min) / (max - min);\r\n}\r\n\r\n/**\r\n * Denormalize the value from 0.0 and 1.0 using min and max values\r\n * @param normalized value to denormalize\r\n * @param min max to denormalize between\r\n * @param max min to denormalize between\r\n * @returns the denormalized value\r\n */\r\nexport function Denormalize(normalized: number, min: number, max: number): number {\r\n return normalized * (max - min) + min;\r\n}\r\n\r\n/**\r\n * Calculates the shortest difference between two given angles given in degrees.\r\n * @param current current angle in degrees\r\n * @param target target angle in degrees\r\n * @returns the delta\r\n */\r\nexport function DeltaAngle(current: number, target: number): number {\r\n let num: number = Repeat(target - current, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return num;\r\n}\r\n\r\n/**\r\n * PingPongs the value t, so that it is never larger than length and never smaller than 0.\r\n * @param tx value\r\n * @param length length\r\n * @returns The returned value will move back and forth between 0 and length\r\n */\r\nexport function PingPong(tx: number, length: number): number {\r\n const t: number = Repeat(tx, length * 2.0);\r\n return length - Math.abs(t - length);\r\n}\r\n\r\n/**\r\n * Interpolates between min and max with smoothing at the limits.\r\n *\r\n * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up\r\n * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.\r\n * @param from from\r\n * @param to to\r\n * @param tx value\r\n * @returns the smooth stepped value\r\n */\r\nexport function SmoothStep(from: number, to: number, tx: number): number {\r\n let t: number = Clamp(tx);\r\n t = -2.0 * t * t * t + 3.0 * t * t;\r\n return to * t + from * (1.0 - t);\r\n}\r\n\r\n/**\r\n * Moves a value current towards target.\r\n *\r\n * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.\r\n * Negative values of maxDelta pushes the value away from target.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting value\r\n */\r\nexport function MoveTowards(current: number, target: number, maxDelta: number): number {\r\n let result: number = 0;\r\n if (Math.abs(target - current) <= maxDelta) {\r\n result = target;\r\n } else {\r\n result = current + Math.sign(target - current) * maxDelta;\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n *\r\n * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta\r\n * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting angle\r\n */\r\nexport function MoveTowardsAngle(current: number, target: number, maxDelta: number): number {\r\n const num: number = DeltaAngle(current, target);\r\n let result: number = 0;\r\n if (-maxDelta < num && num < maxDelta) {\r\n result = target;\r\n } else {\r\n target = current + num;\r\n result = MoveTowards(current, target, maxDelta);\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * This function returns percentage of a number in a given range.\r\n *\r\n * RangeToPercent(40,20,60) will return 0.5 (50%)\r\n * RangeToPercent(34,0,100) will return 0.34 (34%)\r\n * @param number to convert to percentage\r\n * @param min min range\r\n * @param max max range\r\n * @returns the percentage\r\n */\r\nexport function RangeToPercent(number: number, min: number, max: number): number {\r\n return (number - min) / (max - min);\r\n}\r\n\r\n/**\r\n * This function returns number that corresponds to the percentage in a given range.\r\n *\r\n * PercentToRange(0.34,0,100) will return 34.\r\n * @param percent to convert to number\r\n * @param min min range\r\n * @param max max range\r\n * @returns the number\r\n */\r\nexport function PercentToRange(percent: number, min: number, max: number): number {\r\n return (max - min) * percent + min;\r\n}\r\n\r\n/**\r\n * Returns the highest common factor of two integers.\r\n * @param a first parameter\r\n * @param b second parameter\r\n * @returns HCF of a and b\r\n */\r\nexport function HighestCommonFactor(a: number, b: number): number {\r\n const r: number = a % b;\r\n if (r === 0) {\r\n return b;\r\n }\r\n return HighestCommonFactor(b, r);\r\n}\r\n"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AAG,QAAQ,CAAC;IAC9D,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,MAAc,EAAE,QAAgB;IAC9E,MAAM,GAAG,GAAW,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAChD,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC,QAAQ,GAAG,GAAG,IAAI,GAAG,GAAG,QAAQ,EAAE,CAAC;QACpC,MAAM,GAAG,MAAM,CAAC;IACpB,CAAC;SAAM,CAAC;QACJ,MAAM,GAAG,OAAO,GAAG,GAAG,CAAC;QACvB,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,GAAW,EAAE,GAAW;IACnE,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,GAAW,EAAE,GAAW;IACpE,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,OAAO,GAAG,GAAG,CAAC;AACvC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAS,EAAE,CAAS;IACpD,MAAM,CAAC,GAAW,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrC,CAAC","sourcesContent":["/**\r\n * Extract int value\r\n * @param value number value\r\n * @returns int value\r\n */\r\nexport function ExtractAsInt(value: number) {\r\n return parseInt(value.toString().replace(/\\W/g, \"\"));\r\n}\r\n\r\n/**\r\n * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n * @param a number\r\n * @param b number\r\n * @param epsilon (default = 1.401298E-45)\r\n * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\r\n */\r\nexport function WithinEpsilon(a: number, b: number, epsilon: number = 1.401298e-45): boolean {\r\n return Math.abs(a - b) <= epsilon;\r\n}\r\n\r\n/**\r\n * Boolean : true if the number is outside a range\r\n * @param num number\r\n * @param min min value\r\n * @param max max value\r\n * @param epsilon (default = Number.EPSILON)\r\n * @returns true if the number is between min and max values\r\n */\r\nexport function OutsideRange(num: number, min: number, max: number, epsilon: number = 1.401298e-45): boolean {\r\n return num < min - epsilon || num > max + epsilon;\r\n}\r\n\r\n/**\r\n * Returns a random float number between and min and max values\r\n * @param min min value of random\r\n * @param max max value of random\r\n * @returns random value\r\n */\r\nexport function RandomRange(min: number, max: number): number {\r\n if (min === max) {\r\n return min;\r\n }\r\n return Math.random() * (max - min) + min;\r\n}\r\n\r\n/**\r\n * Creates a new scalar with values linearly interpolated of \"amount\" between the start scalar and the end scalar.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\nexport function Lerp(start: number, end: number, amount: number): number {\r\n return start + (end - start) * amount;\r\n}\r\n\r\n/**\r\n * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.\r\n * @param start start value\r\n * @param end target value\r\n * @param amount amount to lerp between\r\n * @returns the lerped value\r\n */\r\nexport function LerpAngle(start: number, end: number, amount: number): number {\r\n let num: number = Repeat(end - start, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return start + num * Clamp(amount);\r\n}\r\n\r\n/**\r\n * Calculates the linear parameter t that produces the interpolant value within the range [a, b].\r\n * @param a start value\r\n * @param b target value\r\n * @param value value between a and b\r\n * @returns the inverseLerp value\r\n */\r\nexport function InverseLerp(a: number, b: number, value: number): number {\r\n let result: number;\r\n if (a != b) {\r\n result = Clamp((value - a) / (b - a));\r\n } else {\r\n result = 0.0;\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Returns a new scalar located for \"amount\" (float) on the Hermite spline defined by the scalars \"value1\", \"value3\", \"tangent1\", \"tangent2\".\r\n * @see http://mathworld.wolfram.com/HermitePolynomial.html\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent\r\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\r\n * @returns hermite result\r\n */\r\nexport function Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number {\r\n const squared = amount * amount;\r\n const cubed = amount * squared;\r\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\r\n const part2 = -2.0 * cubed + 3.0 * squared;\r\n const part3 = cubed - 2.0 * squared + amount;\r\n const part4 = cubed - squared;\r\n\r\n return value1 * part1 + value2 * part2 + tangent1 * part3 + tangent2 * part4;\r\n}\r\n\r\n/**\r\n * Returns a new scalar which is the 1st derivative of the Hermite spline defined by the scalars \"value1\", \"value2\", \"tangent1\", \"tangent2\".\r\n * @param value1 defines the first control point\r\n * @param tangent1 defines the first tangent\r\n * @param value2 defines the second control point\r\n * @param tangent2 defines the second tangent\r\n * @param time define where the derivative must be done\r\n * @returns 1st derivative\r\n */\r\nexport function Hermite1stDerivative(value1: number, tangent1: number, value2: number, tangent2: number, time: number): number {\r\n const t2 = time * time;\r\n return (t2 - time) * 6 * value1 + (3 * t2 - 4 * time + 1) * tangent1 + (-t2 + time) * 6 * value2 + (3 * t2 - 2 * time) * tangent2;\r\n}\r\n\r\n/**\r\n * Returns the value itself if it's between min and max.\r\n * Returns min if the value is lower than min.\r\n * Returns max if the value is greater than max.\r\n * @param value the value to clmap\r\n * @param min the min value to clamp to (default: 0)\r\n * @param max the max value to clamp to (default: 1)\r\n * @returns the clamped value\r\n */\r\nexport function Clamp(value: number, min = 0, max = 1): number {\r\n return Math.min(max, Math.max(min, value));\r\n}\r\n\r\n/**\r\n * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.\r\n * @param angle The angle to normalize in radian.\r\n * @returns The converted angle.\r\n */\r\nexport function NormalizeRadians(angle: number): number {\r\n // More precise but slower version kept for reference.\r\n // angle = angle % Tools.TwoPi;\r\n // angle = (angle + Tools.TwoPi) % Tools.TwoPi;\r\n\r\n //if (angle > Math.PI) {\r\n //\tangle -= Tools.TwoPi;\r\n //}\r\n\r\n angle -= Math.PI * 2 * Math.floor((angle + Math.PI) / (Math.PI * 2));\r\n\r\n return angle;\r\n}\r\n\r\n/**\r\n * Returns a string : the upper case translation of the number i to hexadecimal.\r\n * @param i number\r\n * @returns the upper case translation of the number i to hexadecimal.\r\n */\r\nexport function ToHex(i: number): string {\r\n const str = i.toString(16);\r\n\r\n if (i <= 15) {\r\n return (\"0\" + str).toUpperCase();\r\n }\r\n\r\n return str.toUpperCase();\r\n}\r\n\r\n/**\r\n * the floor part of a log2 value.\r\n * @param value the value to compute log2 of\r\n * @returns the log2 of value.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function ILog2(value: number): number {\r\n if (Math.log2) {\r\n return Math.floor(Math.log2(value));\r\n }\r\n\r\n if (value < 0) {\r\n return NaN;\r\n } else if (value === 0) {\r\n return -Infinity;\r\n }\r\n\r\n let n = 0;\r\n if (value < 1) {\r\n while (value < 1) {\r\n n++;\r\n value = value * 2;\r\n }\r\n n = -n;\r\n } else if (value > 1) {\r\n while (value > 1) {\r\n n++;\r\n value = Math.floor(value / 2);\r\n }\r\n }\r\n\r\n return n;\r\n}\r\n\r\n/**\r\n * Loops the value, so that it is never larger than length and never smaller than 0.\r\n *\r\n * This is similar to the modulo operator but it works with floating point numbers.\r\n * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.\r\n * With t = 5 and length = 2.5, the result would be 0.0.\r\n * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator\r\n * @param value the value\r\n * @param length the length\r\n * @returns the looped value\r\n */\r\nexport function Repeat(value: number, length: number): number {\r\n return value - Math.floor(value / length) * length;\r\n}\r\n\r\n/**\r\n * Normalize the value between 0.0 and 1.0 using min and max values\r\n * @param value value to normalize\r\n * @param min max to normalize between\r\n * @param max min to normalize between\r\n * @returns the normalized value\r\n */\r\nexport function Normalize(value: number, min: number, max: number): number {\r\n return (value - min) / (max - min);\r\n}\r\n\r\n/**\r\n * Denormalize the value from 0.0 and 1.0 using min and max values\r\n * @param normalized value to denormalize\r\n * @param min max to denormalize between\r\n * @param max min to denormalize between\r\n * @returns the denormalized value\r\n */\r\nexport function Denormalize(normalized: number, min: number, max: number): number {\r\n return normalized * (max - min) + min;\r\n}\r\n\r\n/**\r\n * Calculates the shortest difference between two given angles given in degrees.\r\n * @param current current angle in degrees\r\n * @param target target angle in degrees\r\n * @returns the delta\r\n */\r\nexport function DeltaAngle(current: number, target: number): number {\r\n let num: number = Repeat(target - current, 360.0);\r\n if (num > 180.0) {\r\n num -= 360.0;\r\n }\r\n return num;\r\n}\r\n\r\n/**\r\n * PingPongs the value t, so that it is never larger than length and never smaller than 0.\r\n * @param tx value\r\n * @param length length\r\n * @returns The returned value will move back and forth between 0 and length\r\n */\r\nexport function PingPong(tx: number, length: number): number {\r\n const t: number = Repeat(tx, length * 2.0);\r\n return length - Math.abs(t - length);\r\n}\r\n\r\n/**\r\n * Interpolates between min and max with smoothing at the limits.\r\n *\r\n * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up\r\n * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.\r\n * @param from from\r\n * @param to to\r\n * @param tx value\r\n * @returns the smooth stepped value\r\n */\r\nexport function SmoothStep(from: number, to: number, tx: number): number {\r\n let t: number = Clamp(tx);\r\n t = -2.0 * t * t * t + 3.0 * t * t;\r\n return to * t + from * (1.0 - t);\r\n}\r\n\r\n/**\r\n * Moves a value current towards target.\r\n *\r\n * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.\r\n * Negative values of maxDelta pushes the value away from target.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting value\r\n */\r\nexport function MoveTowards(current: number, target: number, maxDelta: number): number {\r\n let result: number;\r\n if (Math.abs(target - current) <= maxDelta) {\r\n result = target;\r\n } else {\r\n result = current + Math.sign(target - current) * maxDelta;\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.\r\n *\r\n * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta\r\n * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.\r\n * @param current current value\r\n * @param target target value\r\n * @param maxDelta max distance to move\r\n * @returns resulting angle\r\n */\r\nexport function MoveTowardsAngle(current: number, target: number, maxDelta: number): number {\r\n const num: number = DeltaAngle(current, target);\r\n let result: number;\r\n if (-maxDelta < num && num < maxDelta) {\r\n result = target;\r\n } else {\r\n target = current + num;\r\n result = MoveTowards(current, target, maxDelta);\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * This function returns percentage of a number in a given range.\r\n *\r\n * RangeToPercent(40,20,60) will return 0.5 (50%)\r\n * RangeToPercent(34,0,100) will return 0.34 (34%)\r\n * @param number to convert to percentage\r\n * @param min min range\r\n * @param max max range\r\n * @returns the percentage\r\n */\r\nexport function RangeToPercent(number: number, min: number, max: number): number {\r\n return (number - min) / (max - min);\r\n}\r\n\r\n/**\r\n * This function returns number that corresponds to the percentage in a given range.\r\n *\r\n * PercentToRange(0.34,0,100) will return 34.\r\n * @param percent to convert to number\r\n * @param min min range\r\n * @param max max range\r\n * @returns the number\r\n */\r\nexport function PercentToRange(percent: number, min: number, max: number): number {\r\n return (max - min) * percent + min;\r\n}\r\n\r\n/**\r\n * Returns the highest common factor of two integers.\r\n * @param a first parameter\r\n * @param b second parameter\r\n * @returns HCF of a and b\r\n */\r\nexport function HighestCommonFactor(a: number, b: number): number {\r\n const r: number = a % b;\r\n if (r === 0) {\r\n return b;\r\n }\r\n return HighestCommonFactor(b, r);\r\n}\r\n"]}
|
package/Maths/math.vector.js
CHANGED
|
@@ -4645,7 +4645,7 @@ export class Quaternion {
|
|
|
4645
4645
|
* @returns the angle in radians
|
|
4646
4646
|
*/
|
|
4647
4647
|
toAxisAngleToRef(axis) {
|
|
4648
|
-
let angle
|
|
4648
|
+
let angle;
|
|
4649
4649
|
const sinHalfAngle = Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z);
|
|
4650
4650
|
const cosHalfAngle = this._w;
|
|
4651
4651
|
if (sinHalfAngle > 0) {
|