@itwin/core-geometry 4.3.0-dev.13 → 4.3.0-dev.14

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 (149) hide show
  1. package/lib/cjs/bspline/BSpline1dNd.d.ts +12 -2
  2. package/lib/cjs/bspline/BSpline1dNd.d.ts.map +1 -1
  3. package/lib/cjs/bspline/BSpline1dNd.js +27 -17
  4. package/lib/cjs/bspline/BSpline1dNd.js.map +1 -1
  5. package/lib/cjs/bspline/BSplineCurve.d.ts +30 -16
  6. package/lib/cjs/bspline/BSplineCurve.d.ts.map +1 -1
  7. package/lib/cjs/bspline/BSplineCurve.js +68 -44
  8. package/lib/cjs/bspline/BSplineCurve.js.map +1 -1
  9. package/lib/cjs/bspline/BSplineCurve3dH.d.ts +27 -20
  10. package/lib/cjs/bspline/BSplineCurve3dH.d.ts.map +1 -1
  11. package/lib/cjs/bspline/BSplineCurve3dH.js +136 -87
  12. package/lib/cjs/bspline/BSplineCurve3dH.js.map +1 -1
  13. package/lib/cjs/bspline/BSplineSurface.d.ts +138 -74
  14. package/lib/cjs/bspline/BSplineSurface.d.ts.map +1 -1
  15. package/lib/cjs/bspline/BSplineSurface.js +242 -119
  16. package/lib/cjs/bspline/BSplineSurface.js.map +1 -1
  17. package/lib/cjs/bspline/Bezier1dNd.d.ts +18 -4
  18. package/lib/cjs/bspline/Bezier1dNd.d.ts.map +1 -1
  19. package/lib/cjs/bspline/Bezier1dNd.js +19 -5
  20. package/lib/cjs/bspline/Bezier1dNd.js.map +1 -1
  21. package/lib/cjs/bspline/BezierCurve3dH.d.ts.map +1 -1
  22. package/lib/cjs/bspline/BezierCurve3dH.js +2 -1
  23. package/lib/cjs/bspline/BezierCurve3dH.js.map +1 -1
  24. package/lib/cjs/bspline/KnotVector.d.ts +30 -33
  25. package/lib/cjs/bspline/KnotVector.d.ts.map +1 -1
  26. package/lib/cjs/bspline/KnotVector.js +76 -69
  27. package/lib/cjs/bspline/KnotVector.js.map +1 -1
  28. package/lib/cjs/geometry3d/Matrix3d.d.ts +20 -13
  29. package/lib/cjs/geometry3d/Matrix3d.d.ts.map +1 -1
  30. package/lib/cjs/geometry3d/Matrix3d.js +28 -21
  31. package/lib/cjs/geometry3d/Matrix3d.js.map +1 -1
  32. package/lib/cjs/geometry3d/Point3dVector3d.d.ts +3 -2
  33. package/lib/cjs/geometry3d/Point3dVector3d.d.ts.map +1 -1
  34. package/lib/cjs/geometry3d/Point3dVector3d.js +6 -5
  35. package/lib/cjs/geometry3d/Point3dVector3d.js.map +1 -1
  36. package/lib/cjs/geometry3d/PointHelpers.d.ts +58 -20
  37. package/lib/cjs/geometry3d/PointHelpers.d.ts.map +1 -1
  38. package/lib/cjs/geometry3d/PointHelpers.js +213 -62
  39. package/lib/cjs/geometry3d/PointHelpers.js.map +1 -1
  40. package/lib/cjs/geometry3d/Transform.d.ts +2 -3
  41. package/lib/cjs/geometry3d/Transform.d.ts.map +1 -1
  42. package/lib/cjs/geometry3d/Transform.js +2 -3
  43. package/lib/cjs/geometry3d/Transform.js.map +1 -1
  44. package/lib/cjs/geometry4d/Point4d.d.ts +13 -0
  45. package/lib/cjs/geometry4d/Point4d.d.ts.map +1 -1
  46. package/lib/cjs/geometry4d/Point4d.js +21 -0
  47. package/lib/cjs/geometry4d/Point4d.js.map +1 -1
  48. package/lib/cjs/numerics/BezierPolynomials.d.ts +88 -64
  49. package/lib/cjs/numerics/BezierPolynomials.d.ts.map +1 -1
  50. package/lib/cjs/numerics/BezierPolynomials.js +92 -73
  51. package/lib/cjs/numerics/BezierPolynomials.js.map +1 -1
  52. package/lib/cjs/numerics/PascalCoefficients.d.ts +8 -12
  53. package/lib/cjs/numerics/PascalCoefficients.d.ts.map +1 -1
  54. package/lib/cjs/numerics/PascalCoefficients.js +10 -12
  55. package/lib/cjs/numerics/PascalCoefficients.js.map +1 -1
  56. package/lib/cjs/serialization/BGFBReader.d.ts +10 -10
  57. package/lib/cjs/serialization/BGFBReader.d.ts.map +1 -1
  58. package/lib/cjs/serialization/BGFBReader.js +69 -42
  59. package/lib/cjs/serialization/BGFBReader.js.map +1 -1
  60. package/lib/cjs/serialization/BGFBWriter.d.ts +8 -8
  61. package/lib/cjs/serialization/BGFBWriter.d.ts.map +1 -1
  62. package/lib/cjs/serialization/BGFBWriter.js +80 -55
  63. package/lib/cjs/serialization/BGFBWriter.js.map +1 -1
  64. package/lib/cjs/serialization/GeometrySamples.d.ts.map +1 -1
  65. package/lib/cjs/serialization/GeometrySamples.js +6 -8
  66. package/lib/cjs/serialization/GeometrySamples.js.map +1 -1
  67. package/lib/cjs/serialization/IModelJsonSchema.d.ts +6 -14
  68. package/lib/cjs/serialization/IModelJsonSchema.d.ts.map +1 -1
  69. package/lib/cjs/serialization/IModelJsonSchema.js +84 -262
  70. package/lib/cjs/serialization/IModelJsonSchema.js.map +1 -1
  71. package/lib/cjs/serialization/SerializationHelpers.d.ts +109 -0
  72. package/lib/cjs/serialization/SerializationHelpers.d.ts.map +1 -0
  73. package/lib/cjs/serialization/SerializationHelpers.js +591 -0
  74. package/lib/cjs/serialization/SerializationHelpers.js.map +1 -0
  75. package/lib/esm/bspline/BSpline1dNd.d.ts +12 -2
  76. package/lib/esm/bspline/BSpline1dNd.d.ts.map +1 -1
  77. package/lib/esm/bspline/BSpline1dNd.js +27 -17
  78. package/lib/esm/bspline/BSpline1dNd.js.map +1 -1
  79. package/lib/esm/bspline/BSplineCurve.d.ts +30 -16
  80. package/lib/esm/bspline/BSplineCurve.d.ts.map +1 -1
  81. package/lib/esm/bspline/BSplineCurve.js +68 -44
  82. package/lib/esm/bspline/BSplineCurve.js.map +1 -1
  83. package/lib/esm/bspline/BSplineCurve3dH.d.ts +27 -20
  84. package/lib/esm/bspline/BSplineCurve3dH.d.ts.map +1 -1
  85. package/lib/esm/bspline/BSplineCurve3dH.js +137 -88
  86. package/lib/esm/bspline/BSplineCurve3dH.js.map +1 -1
  87. package/lib/esm/bspline/BSplineSurface.d.ts +138 -74
  88. package/lib/esm/bspline/BSplineSurface.d.ts.map +1 -1
  89. package/lib/esm/bspline/BSplineSurface.js +242 -119
  90. package/lib/esm/bspline/BSplineSurface.js.map +1 -1
  91. package/lib/esm/bspline/Bezier1dNd.d.ts +18 -4
  92. package/lib/esm/bspline/Bezier1dNd.d.ts.map +1 -1
  93. package/lib/esm/bspline/Bezier1dNd.js +19 -5
  94. package/lib/esm/bspline/Bezier1dNd.js.map +1 -1
  95. package/lib/esm/bspline/BezierCurve3dH.d.ts.map +1 -1
  96. package/lib/esm/bspline/BezierCurve3dH.js +2 -1
  97. package/lib/esm/bspline/BezierCurve3dH.js.map +1 -1
  98. package/lib/esm/bspline/KnotVector.d.ts +30 -33
  99. package/lib/esm/bspline/KnotVector.d.ts.map +1 -1
  100. package/lib/esm/bspline/KnotVector.js +76 -69
  101. package/lib/esm/bspline/KnotVector.js.map +1 -1
  102. package/lib/esm/geometry3d/Matrix3d.d.ts +20 -13
  103. package/lib/esm/geometry3d/Matrix3d.d.ts.map +1 -1
  104. package/lib/esm/geometry3d/Matrix3d.js +28 -21
  105. package/lib/esm/geometry3d/Matrix3d.js.map +1 -1
  106. package/lib/esm/geometry3d/Point3dVector3d.d.ts +3 -2
  107. package/lib/esm/geometry3d/Point3dVector3d.d.ts.map +1 -1
  108. package/lib/esm/geometry3d/Point3dVector3d.js +6 -5
  109. package/lib/esm/geometry3d/Point3dVector3d.js.map +1 -1
  110. package/lib/esm/geometry3d/PointHelpers.d.ts +58 -20
  111. package/lib/esm/geometry3d/PointHelpers.d.ts.map +1 -1
  112. package/lib/esm/geometry3d/PointHelpers.js +213 -62
  113. package/lib/esm/geometry3d/PointHelpers.js.map +1 -1
  114. package/lib/esm/geometry3d/Transform.d.ts +2 -3
  115. package/lib/esm/geometry3d/Transform.d.ts.map +1 -1
  116. package/lib/esm/geometry3d/Transform.js +2 -3
  117. package/lib/esm/geometry3d/Transform.js.map +1 -1
  118. package/lib/esm/geometry4d/Point4d.d.ts +13 -0
  119. package/lib/esm/geometry4d/Point4d.d.ts.map +1 -1
  120. package/lib/esm/geometry4d/Point4d.js +21 -0
  121. package/lib/esm/geometry4d/Point4d.js.map +1 -1
  122. package/lib/esm/numerics/BezierPolynomials.d.ts +88 -64
  123. package/lib/esm/numerics/BezierPolynomials.d.ts.map +1 -1
  124. package/lib/esm/numerics/BezierPolynomials.js +92 -73
  125. package/lib/esm/numerics/BezierPolynomials.js.map +1 -1
  126. package/lib/esm/numerics/PascalCoefficients.d.ts +8 -12
  127. package/lib/esm/numerics/PascalCoefficients.d.ts.map +1 -1
  128. package/lib/esm/numerics/PascalCoefficients.js +10 -12
  129. package/lib/esm/numerics/PascalCoefficients.js.map +1 -1
  130. package/lib/esm/serialization/BGFBReader.d.ts +10 -10
  131. package/lib/esm/serialization/BGFBReader.d.ts.map +1 -1
  132. package/lib/esm/serialization/BGFBReader.js +69 -42
  133. package/lib/esm/serialization/BGFBReader.js.map +1 -1
  134. package/lib/esm/serialization/BGFBWriter.d.ts +8 -8
  135. package/lib/esm/serialization/BGFBWriter.d.ts.map +1 -1
  136. package/lib/esm/serialization/BGFBWriter.js +80 -55
  137. package/lib/esm/serialization/BGFBWriter.js.map +1 -1
  138. package/lib/esm/serialization/GeometrySamples.d.ts.map +1 -1
  139. package/lib/esm/serialization/GeometrySamples.js +7 -9
  140. package/lib/esm/serialization/GeometrySamples.js.map +1 -1
  141. package/lib/esm/serialization/IModelJsonSchema.d.ts +6 -14
  142. package/lib/esm/serialization/IModelJsonSchema.d.ts.map +1 -1
  143. package/lib/esm/serialization/IModelJsonSchema.js +85 -263
  144. package/lib/esm/serialization/IModelJsonSchema.js.map +1 -1
  145. package/lib/esm/serialization/SerializationHelpers.d.ts +109 -0
  146. package/lib/esm/serialization/SerializationHelpers.d.ts.map +1 -0
  147. package/lib/esm/serialization/SerializationHelpers.js +588 -0
  148. package/lib/esm/serialization/SerializationHelpers.js.map +1 -0
  149. package/package.json +3 -3
@@ -49,33 +49,39 @@ export class PackedMatrix3dOps {
49
49
  }
50
50
  /**
51
51
  * Multiply 3x3 matrix `a*b`, store in `result`.
52
- * * All params assumed length 9, allocated by caller.
53
- * * c may alias either input.
52
+ * @param a left matrix in product. ASSUMED length 9.
53
+ * @param b right matrix in product. ASSUMED length 9.
54
+ * @param result optional destination array of length 9. If insufficient length, a new array is returned. May refer to same array as `a` or `b`.
55
+ * @return matrix product `a*b`
54
56
  */
55
57
  static multiplyMatrixMatrix(a, b, result) {
56
- if (!result)
58
+ if (!result || result.length < 9)
57
59
  result = new Float64Array(9);
58
60
  PackedMatrix3dOps.loadMatrix(result, (a[0] * b[0] + a[1] * b[3] + a[2] * b[6]), (a[0] * b[1] + a[1] * b[4] + a[2] * b[7]), (a[0] * b[2] + a[1] * b[5] + a[2] * b[8]), (a[3] * b[0] + a[4] * b[3] + a[5] * b[6]), (a[3] * b[1] + a[4] * b[4] + a[5] * b[7]), (a[3] * b[2] + a[4] * b[5] + a[5] * b[8]), (a[6] * b[0] + a[7] * b[3] + a[8] * b[6]), (a[6] * b[1] + a[7] * b[4] + a[8] * b[7]), (a[6] * b[2] + a[7] * b[5] + a[8] * b[8]));
59
61
  return result;
60
62
  }
61
63
  /**
62
64
  * Multiply 3x3 matrix `a*bTranspose`, store in `result`.
63
- * * All params assumed length 9, allocated by caller.
64
- * * c may alias either input.
65
+ * @param a left matrix in product. ASSUMED length 9.
66
+ * @param b transpose of right matrix in product. ASSUMED length 9.
67
+ * @param result optional destination array of length 9. If insufficient length, a new array is returned. May refer to same array as `a` or `b`.
68
+ * @return matrix product `a*b^T`
65
69
  */
66
70
  static multiplyMatrixMatrixTranspose(a, b, result) {
67
- if (!result)
71
+ if (!result || result.length < 9)
68
72
  result = new Float64Array(9);
69
73
  PackedMatrix3dOps.loadMatrix(result, (a[0] * b[0] + a[1] * b[1] + a[2] * b[2]), (a[0] * b[3] + a[1] * b[4] + a[2] * b[5]), (a[0] * b[6] + a[1] * b[7] + a[2] * b[8]), (a[3] * b[0] + a[4] * b[1] + a[5] * b[2]), (a[3] * b[3] + a[4] * b[4] + a[5] * b[5]), (a[3] * b[6] + a[4] * b[7] + a[5] * b[8]), (a[6] * b[0] + a[7] * b[1] + a[8] * b[2]), (a[6] * b[3] + a[7] * b[4] + a[8] * b[5]), (a[6] * b[6] + a[7] * b[7] + a[8] * b[8]));
70
74
  return result;
71
75
  }
72
76
  /**
73
77
  * Multiply 3x3 matrix `aTranspose*b`, store in `result`.
74
- * * All params assumed length 9, allocated by caller.
75
- * * c may alias either input.
78
+ * @param a transpose of left matrix in product. ASSUMED length 9.
79
+ * @param b right matrix in product. ASSUMED length 9.
80
+ * @param result optional destination array of length 9. If insufficient length, a new array is returned. May refer to same array as `a` or `b`.
81
+ * @return matrix product `a^T*b`
76
82
  */
77
83
  static multiplyMatrixTransposeMatrix(a, b, result) {
78
- if (!result)
84
+ if (!result || result.length < 9)
79
85
  result = new Float64Array(9);
80
86
  PackedMatrix3dOps.loadMatrix(result, (a[0] * b[0] + a[3] * b[3] + a[6] * b[6]), (a[0] * b[1] + a[3] * b[4] + a[6] * b[7]), (a[0] * b[2] + a[3] * b[5] + a[6] * b[8]), (a[1] * b[0] + a[4] * b[3] + a[7] * b[6]), (a[1] * b[1] + a[4] * b[4] + a[7] * b[7]), (a[1] * b[2] + a[4] * b[5] + a[7] * b[8]), (a[2] * b[0] + a[5] * b[3] + a[8] * b[6]), (a[2] * b[1] + a[5] * b[4] + a[8] * b[7]), (a[2] * b[2] + a[5] * b[5] + a[8] * b[8]));
81
87
  return result;
@@ -93,16 +99,17 @@ export class PackedMatrix3dOps {
93
99
  a[7] = q;
94
100
  }
95
101
  /**
96
- * Returns the transpose of 3x3 matrix `a`
97
- * * If `dest` is passed as argument, then the function copies the transpose of 3x3 matrix `a` into `dest`
98
- * * `a` is not changed unless also passed as the dest, i.e., copyTransposed(a,a) transposes `a` in place
102
+ * Compute transpose of 3x3 matrix `a`, store in `dest`.
103
+ * @param a source matrix. ASSUMED length 9. Note that `a` is not changed unless also passed as `dest`, i.e., `copyTransposed(a,a)` transposes `a` in place.
104
+ * @param dest optional destination array of length 9. If insufficient length, a new array is returned. May refer to same array as `a`.
105
+ * @return matrix `a^T`
99
106
  */
100
107
  static copyTransposed(a, dest) {
101
108
  if (dest === a) {
102
109
  PackedMatrix3dOps.transposeInPlace(dest);
103
110
  }
104
111
  else {
105
- if (!dest)
112
+ if (!dest || dest.length < 9)
106
113
  dest = new Float64Array(9);
107
114
  dest[0] = a[0];
108
115
  dest[1] = a[3];
@@ -202,11 +209,10 @@ class Matrix3d {
202
209
  }
203
210
  /**
204
211
  * Constructor
205
- * @param coffs optional coefficient array.
206
- * * **WARNING:** coffs is captured (i.e., is now owned by the Matrix3d object and can be modified by it).
212
+ * @param coffs optional coefficient array of length at least 9 (CAPTURED). If undefined or insufficient length, a new array is created.
207
213
  */
208
214
  constructor(coffs) {
209
- this.coffs = coffs ? coffs : new Float64Array(9);
215
+ this.coffs = (coffs && coffs.length >= 9) ? coffs : new Float64Array(9);
210
216
  this.inverseCoffs = undefined;
211
217
  this.inverseState = InverseMatrixState.unknown;
212
218
  }
@@ -369,13 +375,14 @@ class Matrix3d {
369
375
  * Create a Matrix3d with caller-supplied coefficients and optional inverse coefficients.
370
376
  * * The inputs are captured into (i.e., owned by) the new Matrix3d.
371
377
  * * The caller is responsible for validity of the inverse coefficients.
378
+ * * If either array is insufficiently sized, it is ignored.
372
379
  * @param coffs (required) array of 9 coefficients.
373
380
  * @param inverseCoffs (optional) array of 9 coefficients.
374
381
  * @returns a Matrix3d populated by a coffs array.
375
382
  */
376
383
  static createCapture(coffs, inverseCoffs) {
377
384
  const result = new Matrix3d(coffs);
378
- if (inverseCoffs) {
385
+ if (inverseCoffs && inverseCoffs.length >= 9) {
379
386
  result.inverseCoffs = inverseCoffs;
380
387
  result.inverseState = InverseMatrixState.inverseStored;
381
388
  }
@@ -1609,10 +1616,10 @@ class Matrix3d {
1609
1616
  * @param y y part of multiplied point
1610
1617
  * @param z z part of multiplied point
1611
1618
  * @param w w part of multiplied point
1612
- * @param result optional preallocated result.
1619
+ * @param result optional preallocated result. If length < 4, a new array is returned.
1613
1620
  */
1614
1621
  static xyzPlusMatrixTimesWeightedCoordinatesToFloat64Array(origin, matrix, x, y, z, w, result) {
1615
- if (!result)
1622
+ if (!result || result.length < 4)
1616
1623
  result = new Float64Array(4);
1617
1624
  result[0] = matrix.coffs[0] * x + matrix.coffs[1] * y + matrix.coffs[2] * z + origin.x * w;
1618
1625
  result[1] = matrix.coffs[3] * x + matrix.coffs[4] * y + matrix.coffs[5] * z + origin.y * w;
@@ -1632,10 +1639,10 @@ class Matrix3d {
1632
1639
  * @param x x part of multiplied point
1633
1640
  * @param y y part of multiplied point
1634
1641
  * @param z z part of multiplied point
1635
- * @param result optional preallocated result.
1642
+ * @param result optional preallocated result. If length < 3, a new array is returned.
1636
1643
  */
1637
1644
  static xyzPlusMatrixTimesCoordinatesToFloat64Array(origin, matrix, x, y, z, result) {
1638
- if (!result)
1645
+ if (!result || result.length < 3)
1639
1646
  result = new Float64Array(3);
1640
1647
  result[0] = matrix.coffs[0] * x + matrix.coffs[1] * y + matrix.coffs[2] * z + origin.x;
1641
1648
  result[1] = matrix.coffs[3] * x + matrix.coffs[4] * y + matrix.coffs[5] * z + origin.y;