@babylonjs/core 6.29.1 → 6.29.2

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.
Files changed (127) hide show
  1. package/Debug/axesViewer.d.ts +3 -1
  2. package/Debug/axesViewer.js +14 -11
  3. package/Debug/axesViewer.js.map +1 -1
  4. package/Engines/Processors/shaderCodeInliner.js +1 -1
  5. package/Engines/Processors/shaderCodeInliner.js.map +1 -1
  6. package/Engines/WebGPU/Extensions/engine.computeShader.js +2 -10
  7. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  8. package/Engines/WebGPU/Extensions/engine.debugging.js +3 -6
  9. package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
  10. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -1
  11. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  12. package/Engines/WebGPU/Extensions/engine.multiRender.js +1 -6
  13. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  14. package/Engines/WebGPU/Extensions/engine.query.js +2 -6
  15. package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
  16. package/Engines/WebGPU/Extensions/engine.renderTarget.js +6 -10
  17. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  18. package/Engines/WebGPU/Extensions/engine.storageBuffer.js +1 -1
  19. package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.videoTexture.js +2 -2
  21. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  22. package/Engines/WebGPU/webgpuBundleList.js +2 -1
  23. package/Engines/WebGPU/webgpuBundleList.js.map +1 -1
  24. package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -1
  25. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  26. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -1
  27. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +4 -7
  28. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  29. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.d.ts +1 -1
  30. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +2 -2
  31. package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
  32. package/Engines/WebGPU/webgpuCacheSampler.d.ts +1 -1
  33. package/Engines/WebGPU/webgpuCacheSampler.js +5 -5
  34. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  35. package/Engines/WebGPU/webgpuClearQuad.js +2 -2
  36. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  37. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +0 -12
  38. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  39. package/Engines/WebGPU/webgpuMaterialContext.d.ts +3 -3
  40. package/Engines/WebGPU/webgpuMaterialContext.js +14 -10
  41. package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
  42. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -12
  43. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  44. package/Engines/WebGPU/webgpuSnapshotRendering.d.ts +5 -8
  45. package/Engines/WebGPU/webgpuSnapshotRendering.js +24 -33
  46. package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
  47. package/Engines/WebGPU/webgpuTextureHelper.d.ts +2 -1
  48. package/Engines/WebGPU/webgpuTextureHelper.js +11 -16
  49. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  50. package/Engines/constants.d.ts +2 -0
  51. package/Engines/constants.js +2 -0
  52. package/Engines/constants.js.map +1 -1
  53. package/Engines/engineCapabilities.d.ts +2 -0
  54. package/Engines/engineCapabilities.js.map +1 -1
  55. package/Engines/nativeEngine.js +1 -0
  56. package/Engines/nativeEngine.js.map +1 -1
  57. package/Engines/nullEngine.js +1 -0
  58. package/Engines/nullEngine.js.map +1 -1
  59. package/Engines/thinEngine.js +6 -2
  60. package/Engines/thinEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.d.ts +27 -32
  62. package/Engines/webgpuEngine.js +237 -317
  63. package/Engines/webgpuEngine.js.map +1 -1
  64. package/Materials/GreasedLine/greasedLineMaterialDefaults.d.ts +2 -2
  65. package/Materials/GreasedLine/greasedLineMaterialDefaults.js.map +1 -1
  66. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +4 -1
  67. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  68. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
  69. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  70. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
  71. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  72. package/Materials/Textures/externalTexture.d.ts +4 -0
  73. package/Materials/Textures/externalTexture.js +4 -0
  74. package/Materials/Textures/externalTexture.js.map +1 -1
  75. package/Materials/Textures/internalTexture.d.ts +0 -4
  76. package/Materials/Textures/internalTexture.js.map +1 -1
  77. package/Materials/Textures/textureSampler.d.ts +4 -0
  78. package/Materials/Textures/textureSampler.js.map +1 -1
  79. package/Maths/math.path.d.ts +9 -1
  80. package/Maths/math.path.js +17 -1
  81. package/Maths/math.path.js.map +1 -1
  82. package/Maths/math.vector.d.ts +93 -0
  83. package/Maths/math.vector.js +155 -24
  84. package/Maths/math.vector.js.map +1 -1
  85. package/Meshes/Node/Blocks/Sources/boxBlock.js +1 -0
  86. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  87. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +1 -0
  88. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  89. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +1 -0
  90. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  91. package/Meshes/Node/Blocks/Sources/discBlock.js +1 -0
  92. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  93. package/Meshes/Node/Blocks/Sources/gridBlock.js +1 -0
  94. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  95. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +1 -0
  96. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  97. package/Meshes/Node/Blocks/Sources/planeBlock.js +1 -0
  98. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  99. package/Meshes/Node/Blocks/Sources/sphereBlock.js +1 -0
  100. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  101. package/Meshes/Node/Blocks/Sources/torusBlock.js +1 -0
  102. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  103. package/Meshes/Node/nodeGeometryBlock.js +1 -0
  104. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  105. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +14 -0
  106. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +30 -3
  107. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  108. package/Meshes/mesh.js +5 -1
  109. package/Meshes/mesh.js.map +1 -1
  110. package/Misc/codeStringParsingTools.d.ts +2 -1
  111. package/Misc/codeStringParsingTools.js +3 -2
  112. package/Misc/codeStringParsingTools.js.map +1 -1
  113. package/Misc/greasedLineTools.d.ts +2 -1
  114. package/Misc/greasedLineTools.js +2 -0
  115. package/Misc/greasedLineTools.js.map +1 -1
  116. package/Physics/v2/Plugins/havokPlugin.js +3 -1
  117. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  118. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +2 -1
  119. package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
  120. package/Rendering/prePassRenderer.js +8 -4
  121. package/Rendering/prePassRenderer.js.map +1 -1
  122. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -1
  123. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  124. package/package.json +1 -1
  125. package/Engines/WebGPU/webgpuRenderPassWrapper.d.ts +0 -13
  126. package/Engines/WebGPU/webgpuRenderPassWrapper.js +0 -18
  127. package/Engines/WebGPU/webgpuRenderPassWrapper.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"math.path.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.path.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB;;OAEG;IACH,yCAAM,CAAA;IACN,wBAAwB;IACxB,2CAAO,CAAA;AACX,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB;AAED,6CAA6C;AAC7C,MAAM,OAAO,WAAW;IACpB;;;;;;;;OAQG;IACI,MAAM,CAAC,WAAW,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;QAC/E,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;YACxB,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;YACtC,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;YAEvC,MA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,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;SAChF;QACD,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;QACnD,OAAO,cAAc,CAAC;IAC1B,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;YAClC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SAC/C;QACD,OAAO,CAAC,CAAC;IACb,CAAC;CACJ","sourcesContent":["import type { DeepImmutable, Nullable } from \"../types\";\r\nimport { Scalar } from \"./math.scalar\";\r\nimport { Vector2, Vector3, Quaternion, Matrix } 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 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 // 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 valued with the gradient angle, in radians, of the line joining two points\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 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 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 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 (!Scalar.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 (!Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(1.0, 0.0, 0.0);\r\n } else if (!Scalar.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\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 * @returns the created Curve3\r\n */\r\n public static CreateQuadraticBezier(v0: DeepImmutable<Vector3>, v1: DeepImmutable<Vector3>, v2: DeepImmutable<Vector3>, nbPoints: number): Curve3 {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n const bez: Vector3[] = [];\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 for (let i = 0; i <= nbPoints; i++) {\r\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x), equation(i / nbPoints, v0.y, v1.y, v2.y), equation(i / nbPoints, v0.z, v1.z, v2.z)));\r\n }\r\n return 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 * @returns the created Curve3\r\n */\r\n public static CreateCubicBezier(v0: DeepImmutable<Vector3>, v1: DeepImmutable<Vector3>, v2: DeepImmutable<Vector3>, v3: DeepImmutable<Vector3>, nbPoints: number): Curve3 {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n const bez: Vector3[] = [];\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 bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x), equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y), equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z)));\r\n }\r\n return 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 * @returns the created Curve3\r\n */\r\n public static CreateHermiteSpline(p1: DeepImmutable<Vector3>, t1: DeepImmutable<Vector3>, p2: DeepImmutable<Vector3>, t2: DeepImmutable<Vector3>, nSeg: number): Curve3 {\r\n const hermite: Vector3[] = [];\r\n const step = 1.0 / nSeg;\r\n for (let i = 0; i <= nSeg; i++) {\r\n hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n return 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 * @returns the created Curve3\r\n */\r\n public static CreateCatmullRomSpline(points: DeepImmutable<Vector3[]>, nbPoints: number, closed?: boolean): Curve3 {\r\n const catmullRom: Vector3[] = [];\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 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 amount += step;\r\n }\r\n }\r\n catmullRom.push(catmullRom[0]);\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 for (; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (let c = 0; c < nbPoints; c++) {\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n amount += step;\r\n }\r\n }\r\n i--;\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n return 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 * @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): Curve3 {\r\n const arc: Vector3[] = [];\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 return new Curve3(arc); // colinear points arc is empty\r\n }\r\n const len1_sq = vec1.lengthSquared();\r\n const len2_sq = vec2.lengthSquared();\r\n const len3_sq = vec3.lengthSquared();\r\n const len4_sq = 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 * len2_sq * dot1) / len4_sq;\r\n const b = (-0.5 * len3_sq * dot2) / len4_sq;\r\n const c = (-0.5 * len1_sq * dot3) / len4_sq;\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 if (fullCircle) {\r\n const dStep = (2 * Math.PI) / steps;\r\n for (let theta = 0; theta <= 2 * Math.PI; theta += dStep) {\r\n arc.push(center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta)))));\r\n }\r\n arc.push(first);\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 arc.push(point);\r\n theta += dStep;\r\n } while (!point.equalsWithEpsilon(third, radius * dStep * 1.1));\r\n arc.push(third);\r\n if (closed) {\r\n arc.push(first);\r\n }\r\n }\r\n return 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 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,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACnB;;OAEG;IACH,yCAAM,CAAA;IACN,wBAAwB;IACxB,2CAAO,CAAA;AACX,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB;AAED,6CAA6C;AAC7C,MAAM,OAAO,WAAW;IACpB;;;;;;;;OAQG;IACI,MAAM,CAAC,WAAW,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU;QAC/E,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,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CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SAC/C;QACD,OAAO,CAAC,CAAC;IACb,CAAC;CACJ","sourcesContent":["import type { DeepImmutable, Nullable } from \"../types\";\r\nimport { Scalar } from \"./math.scalar\";\r\nimport { Vector2, Vector3, Quaternion, Matrix } from \"./math.vector\";\r\nimport type { Vector4 } 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 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 // 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) return new Angle(Math.PI / 2);\r\n product = Math.sqrt(product);\r\n let cosVal = a.dot(b as any) / product;\r\n cosVal = Scalar.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 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 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 (!Scalar.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 (!Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {\r\n point = new Vector3(1.0, 0.0, 0.0);\r\n } else if (!Scalar.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\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 * @returns the created Curve3\r\n */\r\n public static CreateQuadraticBezier(v0: DeepImmutable<Vector3>, v1: DeepImmutable<Vector3>, v2: DeepImmutable<Vector3>, nbPoints: number): Curve3 {\r\n nbPoints = nbPoints > 2 ? nbPoints : 3;\r\n const bez: Vector3[] = [];\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 for (let i = 0; i <= nbPoints; i++) {\r\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x), equation(i / nbPoints, v0.y, v1.y, v2.y), equation(i / nbPoints, v0.z, v1.z, v2.z)));\r\n }\r\n return 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 * @returns the created Curve3\r\n */\r\n public static CreateCubicBezier(v0: DeepImmutable<Vector3>, v1: DeepImmutable<Vector3>, v2: DeepImmutable<Vector3>, v3: DeepImmutable<Vector3>, nbPoints: number): Curve3 {\r\n nbPoints = nbPoints > 3 ? nbPoints : 4;\r\n const bez: Vector3[] = [];\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 bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x), equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y), equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z)));\r\n }\r\n return 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 * @returns the created Curve3\r\n */\r\n public static CreateHermiteSpline(p1: DeepImmutable<Vector3>, t1: DeepImmutable<Vector3>, p2: DeepImmutable<Vector3>, t2: DeepImmutable<Vector3>, nSeg: number): Curve3 {\r\n const hermite: Vector3[] = [];\r\n const step = 1.0 / nSeg;\r\n for (let i = 0; i <= nSeg; i++) {\r\n hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));\r\n }\r\n return 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 * @returns the created Curve3\r\n */\r\n public static CreateCatmullRomSpline(points: DeepImmutable<Vector3[]>, nbPoints: number, closed?: boolean): Curve3 {\r\n const catmullRom: Vector3[] = [];\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 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 amount += step;\r\n }\r\n }\r\n catmullRom.push(catmullRom[0]);\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 for (; i < totalPoints.length - 3; i++) {\r\n amount = 0;\r\n for (let c = 0; c < nbPoints; c++) {\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n amount += step;\r\n }\r\n }\r\n i--;\r\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\r\n }\r\n return 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 * @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): Curve3 {\r\n const arc: Vector3[] = [];\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 return new Curve3(arc); // colinear points arc is empty\r\n }\r\n const len1_sq = vec1.lengthSquared();\r\n const len2_sq = vec2.lengthSquared();\r\n const len3_sq = vec3.lengthSquared();\r\n const len4_sq = 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 * len2_sq * dot1) / len4_sq;\r\n const b = (-0.5 * len3_sq * dot2) / len4_sq;\r\n const c = (-0.5 * len1_sq * dot3) / len4_sq;\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 if (fullCircle) {\r\n const dStep = (2 * Math.PI) / steps;\r\n for (let theta = 0; theta <= 2 * Math.PI; theta += dStep) {\r\n arc.push(center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta)))));\r\n }\r\n arc.push(first);\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 arc.push(point);\r\n theta += dStep;\r\n } while (!point.equalsWithEpsilon(third, radius * dStep * 1.1));\r\n arc.push(third);\r\n if (closed) {\r\n arc.push(first);\r\n }\r\n }\r\n return 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 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"]}
@@ -293,12 +293,36 @@ export declare class Vector2 {
293
293
  * @returns the current updated Vector2
294
294
  */
295
295
  normalize(): this;
296
+ /**
297
+ * Normalize the current Vector2 with the given input length.
298
+ * Please note that this is an in place operation.
299
+ * @param len the length of the vector
300
+ * @returns the current updated Vector2
301
+ */
302
+ normalizeFromLength(len: number): this;
303
+ /**
304
+ * Normalize the current Vector2 to a new vector
305
+ * @returns the new Vector2
306
+ */
307
+ normalizeToNew(): this;
308
+ /**
309
+ * Normalize the current Vector2 to the reference
310
+ * @param reference define the Vector2 to update
311
+ * @returns the updated Vector2
312
+ */
313
+ normalizeToRef<T extends Vector2>(reference: T): T;
296
314
  /**
297
315
  * Gets a new Vector2 copied from the Vector2
298
316
  * Example Playground https://playground.babylonjs.com/#QYBWV4#20
299
317
  * @returns a new Vector2
300
318
  */
301
319
  clone(): this;
320
+ /**
321
+ * Gets the dot product of the current vector and the vector "otherVector"
322
+ * @param otherVector defines second vector
323
+ * @returns the dot product (float)
324
+ */
325
+ dot(otherVector: DeepImmutable<this>): number;
302
326
  /**
303
327
  * Gets a new Vector2(0, 0)
304
328
  * @returns a new Vector2
@@ -1387,6 +1411,12 @@ export declare class Vector3 {
1387
1411
  * @returns the dot product
1388
1412
  */
1389
1413
  static Dot(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>): number;
1414
+ /**
1415
+ * Returns the dot product (float) between the current vectors and "otherVector"
1416
+ * @param otherVector defines the right operand
1417
+ * @returns the dot product
1418
+ */
1419
+ dot(otherVector: DeepImmutable<this>): number;
1390
1420
  /**
1391
1421
  * Returns a new Vector3 as the cross product of the vectors "left" and "right"
1392
1422
  * The cross product is then orthogonal to both "left" and "right"
@@ -1870,6 +1900,24 @@ export declare class Vector4 {
1870
1900
  * @returns the updated Vector4.
1871
1901
  */
1872
1902
  normalize(): this;
1903
+ /**
1904
+ * Normalize the current Vector4 with the given input length.
1905
+ * Please note that this is an in place operation.
1906
+ * @param len the length of the vector
1907
+ * @returns the current updated Vector4
1908
+ */
1909
+ normalizeFromLength(len: number): this;
1910
+ /**
1911
+ * Normalize the current Vector4 to a new vector
1912
+ * @returns the new Vector4
1913
+ */
1914
+ normalizeToNew(): this;
1915
+ /**
1916
+ * Normalize the current Vector4 to the reference
1917
+ * @param reference define the Vector4 to update
1918
+ * @returns the updated Vector4
1919
+ */
1920
+ normalizeToRef<T extends Vector4>(reference: T): T;
1873
1921
  /**
1874
1922
  * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.
1875
1923
  * @returns this converted to a new vector3
@@ -1910,6 +1958,12 @@ export declare class Vector4 {
1910
1958
  * @returns the current updated Vector3
1911
1959
  */
1912
1960
  setAll(v: number): this;
1961
+ /**
1962
+ * Returns the dot product (float) between the current vectors and "otherVector"
1963
+ * @param otherVector defines the right operand
1964
+ * @returns the dot product
1965
+ */
1966
+ dot(otherVector: DeepImmutable<this>): number;
1913
1967
  /**
1914
1968
  * Returns a new Vector4 set from the starting index of the given array.
1915
1969
  * @param array the array to pull values from
@@ -2087,6 +2141,13 @@ export declare class Vector4 {
2087
2141
  * @returns a new Vector4
2088
2142
  */
2089
2143
  static FromVector3(source: Vector3, w?: number): Vector4;
2144
+ /**
2145
+ * Returns the dot product (float) between the vectors "left" and "right"
2146
+ * @param left defines the left operand
2147
+ * @param right defines the right operand
2148
+ * @returns the dot product
2149
+ */
2150
+ static Dot(left: DeepImmutable<Vector4>, right: DeepImmutable<Vector4>): number;
2090
2151
  }
2091
2152
  /**
2092
2153
  * Class used to store quaternion data
@@ -2331,12 +2392,25 @@ export declare class Quaternion {
2331
2392
  * @returns the current updated quaternion
2332
2393
  */
2333
2394
  normalize(): this;
2395
+ /**
2396
+ * Normalize the current quaternion with the given input length.
2397
+ * Please note that this is an in place operation.
2398
+ * @param len the length of the quaternion
2399
+ * @returns the current updated Quaternion
2400
+ */
2401
+ normalizeFromLength(len: number): this;
2334
2402
  /**
2335
2403
  * Normalize a copy of the current quaternion
2336
2404
  * Example Playground https://playground.babylonjs.com/#L49EJ7#55
2337
2405
  * @returns the normalized quaternion
2338
2406
  */
2339
2407
  normalizeToNew(): this;
2408
+ /**
2409
+ * Normalize the current Quaternion to the reference
2410
+ * @param reference define the Quaternion to update
2411
+ * @returns the updated Quaternion
2412
+ */
2413
+ normalizeToRef<T extends Quaternion>(reference: T): T;
2340
2414
  /**
2341
2415
  * Returns a new Vector3 set with the Euler angles translated from the current quaternion
2342
2416
  * Example Playground https://playground.babylonjs.com/#L49EJ7#32
@@ -2366,6 +2440,12 @@ export declare class Quaternion {
2366
2440
  * @returns the current updated quaternion
2367
2441
  */
2368
2442
  fromRotationMatrix(matrix: DeepImmutable<Matrix>): this;
2443
+ /**
2444
+ * Returns the dot product (float) between the current quaternions and "other"
2445
+ * @param other defines the right operand
2446
+ * @returns the dot product
2447
+ */
2448
+ dot(other: DeepImmutable<this>): number;
2369
2449
  /**
2370
2450
  * Creates a new quaternion from a rotation matrix
2371
2451
  * Example Playground https://playground.babylonjs.com/#L49EJ7#101
@@ -2666,6 +2746,19 @@ export declare class Quaternion {
2666
2746
  * @returns result input
2667
2747
  */
2668
2748
  static Hermite1stDerivativeToRef<T extends Quaternion>(value1: DeepImmutable<Quaternion>, tangent1: DeepImmutable<Quaternion>, value2: DeepImmutable<Quaternion>, tangent2: DeepImmutable<Quaternion>, time: number, result: T): T;
2749
+ /**
2750
+ * Returns a new Quaternion as the normalization of the given Quaternion
2751
+ * @param quat defines the Quaternion to normalize
2752
+ * @returns the new Quaternion
2753
+ */
2754
+ static Normalize(quat: DeepImmutable<Quaternion>): Quaternion;
2755
+ /**
2756
+ * Sets the given Quaternion "result" with the normalization of the given first Quaternion
2757
+ * @param quat defines the Quaternion to normalize
2758
+ * @param result defines the Quaternion where to store the result
2759
+ * @returns result input
2760
+ */
2761
+ static NormalizeToRef<T extends Quaternion>(quat: DeepImmutable<Quaternion>, result: T): T;
2669
2762
  }
2670
2763
  /**
2671
2764
  * Class used to store matrix data (4x4)