@itwin/core-common 3.4.0-dev.9 → 3.4.0

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 (240) hide show
  1. package/CHANGELOG.md +68 -1
  2. package/lib/cjs/Camera.d.ts.map +1 -1
  3. package/lib/cjs/Camera.js +7 -3
  4. package/lib/cjs/Camera.js.map +1 -1
  5. package/lib/cjs/CloudStorage.d.ts +20 -5
  6. package/lib/cjs/CloudStorage.d.ts.map +1 -1
  7. package/lib/cjs/CloudStorage.js +13 -3
  8. package/lib/cjs/CloudStorage.js.map +1 -1
  9. package/lib/cjs/CloudStorageTileCache.d.ts +4 -1
  10. package/lib/cjs/CloudStorageTileCache.d.ts.map +1 -1
  11. package/lib/cjs/CloudStorageTileCache.js +5 -1
  12. package/lib/cjs/CloudStorageTileCache.js.map +1 -1
  13. package/lib/cjs/Code.d.ts +10 -4
  14. package/lib/cjs/Code.d.ts.map +1 -1
  15. package/lib/cjs/Code.js +6 -2
  16. package/lib/cjs/Code.js.map +1 -1
  17. package/lib/cjs/ColorDef.d.ts.map +1 -1
  18. package/lib/cjs/ColorDef.js +2 -0
  19. package/lib/cjs/ColorDef.js.map +1 -1
  20. package/lib/cjs/ConcurrentQuery.d.ts.map +1 -1
  21. package/lib/cjs/ConcurrentQuery.js +56 -14
  22. package/lib/cjs/ConcurrentQuery.js.map +1 -1
  23. package/lib/cjs/ECSchemaProps.d.ts +40 -0
  24. package/lib/cjs/ECSchemaProps.d.ts.map +1 -0
  25. package/lib/cjs/ECSchemaProps.js +10 -0
  26. package/lib/cjs/ECSchemaProps.js.map +1 -0
  27. package/lib/cjs/ElementProps.d.ts +6 -0
  28. package/lib/cjs/ElementProps.d.ts.map +1 -1
  29. package/lib/cjs/ElementProps.js.map +1 -1
  30. package/lib/cjs/FeatureGates.d.ts.map +1 -1
  31. package/lib/cjs/FeatureGates.js +6 -2
  32. package/lib/cjs/FeatureGates.js.map +1 -1
  33. package/lib/cjs/FeatureIndex.d.ts.map +1 -1
  34. package/lib/cjs/FeatureIndex.js +5 -1
  35. package/lib/cjs/FeatureIndex.js.map +1 -1
  36. package/lib/cjs/FeatureSymbology.d.ts.map +1 -1
  37. package/lib/cjs/FeatureSymbology.js.map +1 -1
  38. package/lib/cjs/Fonts.d.ts.map +1 -1
  39. package/lib/cjs/Fonts.js.map +1 -1
  40. package/lib/cjs/Frustum.d.ts.map +1 -1
  41. package/lib/cjs/Frustum.js +55 -21
  42. package/lib/cjs/Frustum.js.map +1 -1
  43. package/lib/cjs/Gradient.d.ts +18 -2
  44. package/lib/cjs/Gradient.d.ts.map +1 -1
  45. package/lib/cjs/Gradient.js +29 -18
  46. package/lib/cjs/Gradient.js.map +1 -1
  47. package/lib/cjs/IModel.d.ts +4 -0
  48. package/lib/cjs/IModel.d.ts.map +1 -1
  49. package/lib/cjs/IModel.js +8 -1
  50. package/lib/cjs/IModel.js.map +1 -1
  51. package/lib/cjs/Image.d.ts.map +1 -1
  52. package/lib/cjs/Image.js +3 -1
  53. package/lib/cjs/Image.js.map +1 -1
  54. package/lib/cjs/Localization.d.ts +4 -5
  55. package/lib/cjs/Localization.d.ts.map +1 -1
  56. package/lib/cjs/Localization.js.map +1 -1
  57. package/lib/cjs/ModelProps.d.ts +1 -0
  58. package/lib/cjs/ModelProps.d.ts.map +1 -1
  59. package/lib/cjs/ModelProps.js.map +1 -1
  60. package/lib/cjs/QPoint.d.ts +185 -5
  61. package/lib/cjs/QPoint.d.ts.map +1 -1
  62. package/lib/cjs/QPoint.js +204 -4
  63. package/lib/cjs/QPoint.js.map +1 -1
  64. package/lib/cjs/Render.d.ts.map +1 -1
  65. package/lib/cjs/Render.js +11 -3
  66. package/lib/cjs/Render.js.map +1 -1
  67. package/lib/cjs/SubCategoryOverride.d.ts.map +1 -1
  68. package/lib/cjs/SubCategoryOverride.js.map +1 -1
  69. package/lib/cjs/TerrainSettings.d.ts +12 -7
  70. package/lib/cjs/TerrainSettings.d.ts.map +1 -1
  71. package/lib/cjs/TerrainSettings.js +2 -1
  72. package/lib/cjs/TerrainSettings.js.map +1 -1
  73. package/lib/cjs/ThematicDisplay.d.ts +6 -10
  74. package/lib/cjs/ThematicDisplay.d.ts.map +1 -1
  75. package/lib/cjs/ThematicDisplay.js.map +1 -1
  76. package/lib/cjs/TileProps.d.ts +5 -0
  77. package/lib/cjs/TileProps.d.ts.map +1 -1
  78. package/lib/cjs/TileProps.js +12 -1
  79. package/lib/cjs/TileProps.js.map +1 -1
  80. package/lib/cjs/ViewFlags.d.ts.map +1 -1
  81. package/lib/cjs/ViewFlags.js.map +1 -1
  82. package/lib/cjs/core-common.d.ts +1 -0
  83. package/lib/cjs/core-common.d.ts.map +1 -1
  84. package/lib/cjs/core-common.js +1 -0
  85. package/lib/cjs/core-common.js.map +1 -1
  86. package/lib/cjs/geometry/BoundingSphere.d.ts.map +1 -1
  87. package/lib/cjs/geometry/BoundingSphere.js +8 -2
  88. package/lib/cjs/geometry/BoundingSphere.js.map +1 -1
  89. package/lib/cjs/geometry/TextString.d.ts.map +1 -1
  90. package/lib/cjs/geometry/TextString.js.map +1 -1
  91. package/lib/cjs/ipc/IpcWebSocketTransport.js +10 -3
  92. package/lib/cjs/ipc/IpcWebSocketTransport.js.map +1 -1
  93. package/lib/cjs/rpc/IModelReadRpcInterface.js +1 -1
  94. package/lib/cjs/rpc/IModelReadRpcInterface.js.map +1 -1
  95. package/lib/cjs/rpc/IModelTileRpcInterface.d.ts +9 -1
  96. package/lib/cjs/rpc/IModelTileRpcInterface.d.ts.map +1 -1
  97. package/lib/cjs/rpc/IModelTileRpcInterface.js +12 -2
  98. package/lib/cjs/rpc/IModelTileRpcInterface.js.map +1 -1
  99. package/lib/cjs/rpc/core/RpcConfiguration.js +1 -1
  100. package/lib/cjs/rpc/core/RpcConfiguration.js.map +1 -1
  101. package/lib/cjs/rpc/core/RpcConstants.d.ts +3 -1
  102. package/lib/cjs/rpc/core/RpcConstants.d.ts.map +1 -1
  103. package/lib/cjs/rpc/core/RpcConstants.js +4 -1
  104. package/lib/cjs/rpc/core/RpcConstants.js.map +1 -1
  105. package/lib/cjs/rpc/core/RpcRequest.d.ts.map +1 -1
  106. package/lib/cjs/rpc/core/RpcRequest.js +8 -2
  107. package/lib/cjs/rpc/core/RpcRequest.js.map +1 -1
  108. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
  109. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js +3 -0
  110. package/lib/cjs/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  111. package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts +1 -1
  112. package/lib/cjs/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
  113. package/lib/cjs/rpc/web/WebAppRpcProtocol.js +17 -1
  114. package/lib/cjs/rpc/web/WebAppRpcProtocol.js.map +1 -1
  115. package/lib/cjs/rpc/web/WebAppRpcRequest.js +1 -1
  116. package/lib/cjs/rpc/web/WebAppRpcRequest.js.map +1 -1
  117. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  118. package/lib/cjs/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  119. package/lib/cjs/tile/I3dmTileIO.d.ts.map +1 -1
  120. package/lib/cjs/tile/I3dmTileIO.js.map +1 -1
  121. package/lib/esm/Camera.d.ts.map +1 -1
  122. package/lib/esm/Camera.js +7 -3
  123. package/lib/esm/Camera.js.map +1 -1
  124. package/lib/esm/CloudStorage.d.ts +20 -5
  125. package/lib/esm/CloudStorage.d.ts.map +1 -1
  126. package/lib/esm/CloudStorage.js +13 -3
  127. package/lib/esm/CloudStorage.js.map +1 -1
  128. package/lib/esm/CloudStorageTileCache.d.ts +4 -1
  129. package/lib/esm/CloudStorageTileCache.d.ts.map +1 -1
  130. package/lib/esm/CloudStorageTileCache.js +5 -1
  131. package/lib/esm/CloudStorageTileCache.js.map +1 -1
  132. package/lib/esm/Code.d.ts +10 -4
  133. package/lib/esm/Code.d.ts.map +1 -1
  134. package/lib/esm/Code.js +6 -2
  135. package/lib/esm/Code.js.map +1 -1
  136. package/lib/esm/ColorDef.d.ts.map +1 -1
  137. package/lib/esm/ColorDef.js +2 -0
  138. package/lib/esm/ColorDef.js.map +1 -1
  139. package/lib/esm/ConcurrentQuery.d.ts.map +1 -1
  140. package/lib/esm/ConcurrentQuery.js +56 -14
  141. package/lib/esm/ConcurrentQuery.js.map +1 -1
  142. package/lib/esm/ECSchemaProps.d.ts +40 -0
  143. package/lib/esm/ECSchemaProps.d.ts.map +1 -0
  144. package/lib/esm/ECSchemaProps.js +9 -0
  145. package/lib/esm/ECSchemaProps.js.map +1 -0
  146. package/lib/esm/ElementProps.d.ts +6 -0
  147. package/lib/esm/ElementProps.d.ts.map +1 -1
  148. package/lib/esm/ElementProps.js.map +1 -1
  149. package/lib/esm/FeatureGates.d.ts.map +1 -1
  150. package/lib/esm/FeatureGates.js +6 -2
  151. package/lib/esm/FeatureGates.js.map +1 -1
  152. package/lib/esm/FeatureIndex.d.ts.map +1 -1
  153. package/lib/esm/FeatureIndex.js +5 -1
  154. package/lib/esm/FeatureIndex.js.map +1 -1
  155. package/lib/esm/FeatureSymbology.d.ts.map +1 -1
  156. package/lib/esm/FeatureSymbology.js.map +1 -1
  157. package/lib/esm/Fonts.d.ts.map +1 -1
  158. package/lib/esm/Fonts.js.map +1 -1
  159. package/lib/esm/Frustum.d.ts.map +1 -1
  160. package/lib/esm/Frustum.js +55 -21
  161. package/lib/esm/Frustum.js.map +1 -1
  162. package/lib/esm/Gradient.d.ts +18 -2
  163. package/lib/esm/Gradient.d.ts.map +1 -1
  164. package/lib/esm/Gradient.js +29 -18
  165. package/lib/esm/Gradient.js.map +1 -1
  166. package/lib/esm/IModel.d.ts +4 -0
  167. package/lib/esm/IModel.d.ts.map +1 -1
  168. package/lib/esm/IModel.js +8 -1
  169. package/lib/esm/IModel.js.map +1 -1
  170. package/lib/esm/Image.d.ts.map +1 -1
  171. package/lib/esm/Image.js +3 -1
  172. package/lib/esm/Image.js.map +1 -1
  173. package/lib/esm/Localization.d.ts +4 -5
  174. package/lib/esm/Localization.d.ts.map +1 -1
  175. package/lib/esm/Localization.js.map +1 -1
  176. package/lib/esm/ModelProps.d.ts +1 -0
  177. package/lib/esm/ModelProps.d.ts.map +1 -1
  178. package/lib/esm/ModelProps.js.map +1 -1
  179. package/lib/esm/QPoint.d.ts +185 -5
  180. package/lib/esm/QPoint.d.ts.map +1 -1
  181. package/lib/esm/QPoint.js +203 -5
  182. package/lib/esm/QPoint.js.map +1 -1
  183. package/lib/esm/Render.d.ts.map +1 -1
  184. package/lib/esm/Render.js +11 -3
  185. package/lib/esm/Render.js.map +1 -1
  186. package/lib/esm/SubCategoryOverride.d.ts.map +1 -1
  187. package/lib/esm/SubCategoryOverride.js.map +1 -1
  188. package/lib/esm/TerrainSettings.d.ts +12 -7
  189. package/lib/esm/TerrainSettings.d.ts.map +1 -1
  190. package/lib/esm/TerrainSettings.js +2 -1
  191. package/lib/esm/TerrainSettings.js.map +1 -1
  192. package/lib/esm/ThematicDisplay.d.ts +6 -10
  193. package/lib/esm/ThematicDisplay.d.ts.map +1 -1
  194. package/lib/esm/ThematicDisplay.js.map +1 -1
  195. package/lib/esm/TileProps.d.ts +5 -0
  196. package/lib/esm/TileProps.d.ts.map +1 -1
  197. package/lib/esm/TileProps.js +10 -0
  198. package/lib/esm/TileProps.js.map +1 -1
  199. package/lib/esm/ViewFlags.d.ts.map +1 -1
  200. package/lib/esm/ViewFlags.js.map +1 -1
  201. package/lib/esm/core-common.d.ts +1 -0
  202. package/lib/esm/core-common.d.ts.map +1 -1
  203. package/lib/esm/core-common.js +1 -0
  204. package/lib/esm/core-common.js.map +1 -1
  205. package/lib/esm/geometry/BoundingSphere.d.ts.map +1 -1
  206. package/lib/esm/geometry/BoundingSphere.js +8 -2
  207. package/lib/esm/geometry/BoundingSphere.js.map +1 -1
  208. package/lib/esm/geometry/TextString.d.ts.map +1 -1
  209. package/lib/esm/geometry/TextString.js.map +1 -1
  210. package/lib/esm/ipc/IpcWebSocketTransport.js +10 -3
  211. package/lib/esm/ipc/IpcWebSocketTransport.js.map +1 -1
  212. package/lib/esm/rpc/IModelReadRpcInterface.js +1 -1
  213. package/lib/esm/rpc/IModelReadRpcInterface.js.map +1 -1
  214. package/lib/esm/rpc/IModelTileRpcInterface.d.ts +9 -1
  215. package/lib/esm/rpc/IModelTileRpcInterface.d.ts.map +1 -1
  216. package/lib/esm/rpc/IModelTileRpcInterface.js +12 -2
  217. package/lib/esm/rpc/IModelTileRpcInterface.js.map +1 -1
  218. package/lib/esm/rpc/core/RpcConfiguration.js +1 -1
  219. package/lib/esm/rpc/core/RpcConfiguration.js.map +1 -1
  220. package/lib/esm/rpc/core/RpcConstants.d.ts +3 -1
  221. package/lib/esm/rpc/core/RpcConstants.d.ts.map +1 -1
  222. package/lib/esm/rpc/core/RpcConstants.js +4 -1
  223. package/lib/esm/rpc/core/RpcConstants.js.map +1 -1
  224. package/lib/esm/rpc/core/RpcRequest.d.ts.map +1 -1
  225. package/lib/esm/rpc/core/RpcRequest.js +8 -2
  226. package/lib/esm/rpc/core/RpcRequest.js.map +1 -1
  227. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.d.ts.map +1 -1
  228. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js +3 -0
  229. package/lib/esm/rpc/web/BentleyCloudRpcProtocol.js.map +1 -1
  230. package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts +1 -1
  231. package/lib/esm/rpc/web/WebAppRpcProtocol.d.ts.map +1 -1
  232. package/lib/esm/rpc/web/WebAppRpcProtocol.js +17 -1
  233. package/lib/esm/rpc/web/WebAppRpcProtocol.js.map +1 -1
  234. package/lib/esm/rpc/web/WebAppRpcRequest.js +1 -1
  235. package/lib/esm/rpc/web/WebAppRpcRequest.js.map +1 -1
  236. package/lib/esm/rpc/web/multipart/RpcMultipartParser.d.ts.map +1 -1
  237. package/lib/esm/rpc/web/multipart/RpcMultipartParser.js.map +1 -1
  238. package/lib/esm/tile/I3dmTileIO.d.ts.map +1 -1
  239. package/lib/esm/tile/I3dmTileIO.js.map +1 -1
  240. package/package.json +9 -8
@@ -1,7 +1,8 @@
1
1
  /** @packageDocumentation
2
2
  * @module Geometry
3
3
  */
4
- import { Point2d, Point3d, Range2d, Range3d, Vector2d, Vector3d } from "@itwin/core-geometry";
4
+ import { Uint16ArrayBuilder } from "@itwin/core-bentley";
5
+ import { Point2d, Point3d, Range2d, Range3d, Vector2d, Vector3d, XAndY, XYAndZ } from "@itwin/core-geometry";
5
6
  /**
6
7
  * Provides facilities for quantizing floating point values within a specified range into 16-bit unsigned integers.
7
8
  * This is a lossy compression technique.
@@ -11,6 +12,7 @@ import { Point2d, Point3d, Range2d, Range3d, Vector2d, Vector3d } from "@itwin/c
11
12
  * These routines are chiefly used by classes like [[QPoint2d]] and [[QPoint3d]] to reduce the space required to store
12
13
  * coordinate values for [RenderGraphic]($frontend)s.
13
14
  * @public
15
+ * @extensions
14
16
  */
15
17
  export declare namespace Quantization {
16
18
  const rangeScale16 = 65535;
@@ -36,6 +38,7 @@ export declare namespace Quantization {
36
38
  * @see [[QPoint2d]] for the quantized representation of a [Point2d]($core-geometry).
37
39
  * @see [[QPoint2dList]] for a list of [[QPoint2d]]s quantized using a [[QParams2d]].
38
40
  * @public
41
+ * @extensions
39
42
  */
40
43
  export declare class QParams2d {
41
44
  /** The origin of the quantization range. */
@@ -72,6 +75,7 @@ export declare class QParams2d {
72
75
  * @see [[QParams2d]] to define quantization parameters for a range of points.
73
76
  * @see [[QPoint2dList]] for a list of points all quantized to the same range.
74
77
  * @public
78
+ * @extensions
75
79
  */
76
80
  export declare class QPoint2d {
77
81
  private _x;
@@ -84,8 +88,8 @@ export declare class QPoint2d {
84
88
  set y(y: number);
85
89
  /** Construct with `x` and `y` initialized to zero. */
86
90
  constructor();
87
- /** Initialize this point by quantizing the supplied Point2d using the specified params */
88
- init(pos: Point2d, params: QParams2d): void;
91
+ /** Initialize this point by quantizing the supplied { x, y } using the specified params */
92
+ init(pos: XAndY, params: QParams2d): void;
89
93
  /** Create a quantized point from the supplied Point2d using the specified params */
90
94
  static create(pos: Point2d, params: QParams2d): QPoint2d;
91
95
  /** Initialize `x` and `y` from `src`. */
@@ -109,8 +113,44 @@ export declare class QPoint2d {
109
113
  /** Return a Point2d unquantized according to the supplied `params`. If `out` is supplied, it will be modified in-place and returned. */
110
114
  unquantize(params: QParams2d, out?: Point2d): Point2d;
111
115
  }
116
+ /** A compact representation of a list of [[QPoint2d]]s stored in a `Uint16Array`
117
+ * This representation is particularly useful when passing data to WebGL; for example, see [RealityMeshParams.uvs]($frontend).
118
+ * @see [[QPoint3dBuffer]] for 3d points.
119
+ * @public
120
+ * @extensions
121
+ */
122
+ export interface QPoint2dBuffer {
123
+ /** The parameters used to quantize the [[points]]. */
124
+ params: QParams2d;
125
+ /** The [[QPoint2d]]s as pairs of unsigned 16-bit integers. The length must be a multiple of 2; the number of points in the array is half the array's length.
126
+ * To obtain the `n`th point, use `QPoint2d.fromScalars(buffer.points[n * 2], buffer.points[n * 2 + 1])`.
127
+ */
128
+ points: Uint16Array;
129
+ }
130
+ /** @public
131
+ * @extensions
132
+ */
133
+ export declare namespace QPoint2dBuffer {
134
+ /** Extracts the point at the specified index from a buffer.
135
+ * @param points The buffer in which each consecutive pair of integers is a 2d quantized point.
136
+ * @param pointIndex The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
137
+ * @param result If supplied, a preallocated [[QPoint2d]] to initialize with the result and return.
138
+ * @returns The point at `pointIndex`.
139
+ * @throws Error if `pointIndex` is out of bounds.
140
+ */
141
+ function getQPoint(points: Uint16Array, pointIndex: number, result?: QPoint2d): QPoint2d;
142
+ /** Extracts and unquantizes the point at the specified index from a buffer.
143
+ * @param buffer The array of points and the quantization parameters.
144
+ * @param The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
145
+ * @param result If supplied, a preallocated [Point2d]($core-geometry) to initialize with the result and return.
146
+ * @returns The point at `pointIndex`.
147
+ * @throws Error if `pointIndex` is out of bounds.
148
+ */
149
+ function unquantizePoint(buffer: QPoint2dBuffer, pointIndex: number, result?: Point2d): Point2d;
150
+ }
112
151
  /** A list of [[QPoint2d]]s all quantized to the same range.
113
152
  * @public
153
+ * @extensions
114
154
  */
115
155
  export declare class QPoint2dList {
116
156
  /** Parameters used to quantize the points. */
@@ -149,6 +189,7 @@ export declare class QPoint2dList {
149
189
  * @see [[QPoint3d]] for the quantized representation of a [Point3d]($core-geometry).
150
190
  * @see [[QPoint3dList]] for a list of [[QPoint3d]]s quantized using a [[QParams3d]].
151
191
  * @public
192
+ * @extensions
152
193
  */
153
194
  export declare class QParams3d {
154
195
  /** The origin of the quantization range. */
@@ -195,6 +236,7 @@ export declare class QParams3d {
195
236
  * @see [[QParams3d]] to define quantization parameters for a range of points.
196
237
  * @see [[QPoint3dList]] for a list of points all quantized to the same range.
197
238
  * @public
239
+ * @extensions
198
240
  */
199
241
  export declare class QPoint3d {
200
242
  private _x;
@@ -211,8 +253,8 @@ export declare class QPoint3d {
211
253
  set z(z: number);
212
254
  /** Construct with all components initialized to zero. */
213
255
  constructor();
214
- /** Initialize this point by quantizing the supplied Point3d using the specified params */
215
- init(pos: Point3d, params: QParams3d): void;
256
+ /** Initialize this point by quantizing the supplied { x, y, z } using the specified params */
257
+ init(pos: XYAndZ, params: QParams3d): void;
216
258
  /** Creates a quantized point from the supplied Point3d using the specified params */
217
259
  static create(pos: Point3d, params: QParams3d): QPoint3d;
218
260
  /** Set this points components from `src`. */
@@ -250,8 +292,43 @@ export declare class QPoint3d {
250
292
  */
251
293
  compare(rhs: QPoint3d): number;
252
294
  }
295
+ /** A compact representation of a list of [[QPoint3d]]s stored in a `Uint16Array`.
296
+ * This representation is particularly useful when passing data to WebGL; for example, see [RealityMeshParams.positions]($frontend).
297
+ * @public
298
+ * @extensions
299
+ */
300
+ export interface QPoint3dBuffer {
301
+ /** The parameters used to quantize the [[points]]. */
302
+ params: QParams3d;
303
+ /** The [[QPoint3d]]s as pairs of unsigned 16-bit integers. The length must be a multiple of 3; the number of points in the array is half the array's length.
304
+ * To obtain the `n`th point, use `QPoint3d.fromScalars(buffer.points[n * 3], buffer.points[n * 3 + 1], buffer.points[n * 3 + 2])`.
305
+ */
306
+ points: Uint16Array;
307
+ }
308
+ /** @public
309
+ * @extensions
310
+ */
311
+ export declare namespace QPoint3dBuffer {
312
+ /** Extracts the point at the specified index from a buffer.
313
+ * @param points The buffer in which each consecutive pair of integers is a 3d quantized point.
314
+ * @param pointIndex The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
315
+ * @param result If supplied, a preallocated [[QPoint3d]] to initialize with the result and return.
316
+ * @returns The point at `pointIndex`.
317
+ * @throws Error if `pointIndex` is out of bounds.
318
+ */
319
+ function getQPoint(points: Uint16Array, pointIndex: number, result?: QPoint3d): QPoint3d;
320
+ /** Extracts and unquantizes the point at the specified index from a buffer.
321
+ * @param buffer The array of points and the quantization parameters.
322
+ * @param The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
323
+ * @param result If supplied, a preallocated [Point3d]($core-geometry) to initialize with the result and return.
324
+ * @returns The point at `pointIndex`.
325
+ * @throws Error if `pointIndex` is out of bounds.
326
+ */
327
+ function unquantizePoint(buffer: QPoint3dBuffer, pointIndex: number, result?: Point3d): Point3d;
328
+ }
253
329
  /** A list of [[QPoint3d]]s all quantized to the same range.
254
330
  * @public
331
+ * @extensions
255
332
  */
256
333
  export declare class QPoint3dList {
257
334
  /** Parameters used to quantize the points. */
@@ -297,4 +374,107 @@ export declare class QPoint3dList {
297
374
  /** An iterator over the points in the list. */
298
375
  [Symbol.iterator](): IterableIterator<QPoint3d>;
299
376
  }
377
+ /** Options used to construct a [[QPoint2dBufferBuilder]].
378
+ * @beta
379
+ * @extensions
380
+ */
381
+ interface QPoint2dBufferBuilderOptions {
382
+ /** The range to which the points will be quantized. This must be large enough to contain all of the points that will be added to the buffer. */
383
+ range: Range2d;
384
+ /** The number of points for which to allocate space.
385
+ * @see [TypedArrayBuilderOptions.initialCapacity]($bentley).
386
+ */
387
+ initialCapacity?: number;
388
+ /** Multiplier used to compute new capacity when resizing the buffer.
389
+ * @see [TypedArrayBuilderOptions.growthFactor]($bentley).
390
+ */
391
+ growthFactor?: number;
392
+ }
393
+ /** Constructs a [[QPoint2dBuffer]] using a [Uint16ArrayBuilder]($bentley).
394
+ * @public
395
+ * @extensions
396
+ */
397
+ export declare class QPoint2dBufferBuilder {
398
+ private readonly _scratchQPoint2d;
399
+ /** The parameters used to quantize the points in the [[buffer]]. */
400
+ readonly params: QParams2d;
401
+ /** The buffer that holds the points. */
402
+ readonly buffer: Uint16ArrayBuilder;
403
+ /** Construct a new buffer with a [[length]] of zero. */
404
+ constructor(options: QPoint2dBufferBuilderOptions);
405
+ /** Append a point with the specified quantized coordinates. */
406
+ pushXY(x: number, y: number): void;
407
+ /** Append a point with the specified quantized coordinates. */
408
+ push(pt: XAndY): void;
409
+ /** The number of points currently in the [[buffer]]. */
410
+ get length(): number;
411
+ /** Returns the quantized point at the specified index in [[buffer]].
412
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
413
+ * @param result If supplied, a [[QPoint2d]] to initialize with the result and return.
414
+ * @returns The quantized point at the specified index in [[buffer]].
415
+ * @throws Error if `pointIndex` is out of bounds.
416
+ */
417
+ get(pointIndex: number, result?: QPoint2d): QPoint2d;
418
+ /** Returns the unquantized point at the specified index in [[buffer]].
419
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
420
+ * @param result If supplied, a [Point2d]($core-geometry) to initialize with the result and return.
421
+ * @returns The unquantized point at the specified index in [[buffer]].
422
+ * @throws Error if `pointIndex` is out of bounds.
423
+ */
424
+ unquantize(pointIndex: number, result?: Point2d): Point2d;
425
+ /** Obtain a [[QPoint2dBuffer]] containing all of the points that have been appended by this builder. */
426
+ finish(): QPoint2dBuffer;
427
+ }
428
+ /** Options used to construct a [[QPoint3dBufferBuilder]].
429
+ * @beta
430
+ * @extensions
431
+ */
432
+ interface QPoint3dBufferBuilderOptions {
433
+ /** The range to which the points will be quantized. This must be large enough to contain all of the points that will be added to the buffer. */
434
+ range: Range3d;
435
+ /** The number of points for which to allocate space.
436
+ * @see [TypedArrayBuilderOptions.initialCapacity]($bentley).
437
+ */
438
+ initialCapacity?: number;
439
+ /** Multiplier used to compute new capacity when resizing the buffer.
440
+ * @see [TypedArrayBuilderOptions.growthFactor]($bentley).
441
+ */
442
+ growthFactor?: number;
443
+ }
444
+ /** Constructs a [[QPoint3dBuffer]] using a [Uint16ArrayBuilder]($bentley).
445
+ * @public
446
+ * @extensions
447
+ */
448
+ export declare class QPoint3dBufferBuilder {
449
+ private readonly _scratchQPoint3d;
450
+ /** The parameters used to quantize the points in the [[buffer]]. */
451
+ readonly params: QParams3d;
452
+ /** The buffer that holds the points. */
453
+ readonly buffer: Uint16ArrayBuilder;
454
+ /** Construct a new buffer with a [[length]] of zero. */
455
+ constructor(options: QPoint3dBufferBuilderOptions);
456
+ /** Append a point with the specified quantized coordinates. */
457
+ pushXYZ(x: number, y: number, z: number): void;
458
+ /** Append a point with the specified quantized coordinates. */
459
+ push(pt: XYAndZ): void;
460
+ /** The number of points currently in the [[buffer]]. */
461
+ get length(): number;
462
+ /** Returns the quantized point at the specified index in [[buffer]].
463
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
464
+ * @param result If supplied, a [[QPoint3d]] to initialize with the result and return.
465
+ * @returns The quantized point at the specified index in [[buffer]].
466
+ * @throws Error if `pointIndex` is out of bounds.
467
+ */
468
+ get(pointIndex: number, result?: QPoint3d): QPoint3d;
469
+ /** Returns the unquantized point at the specified index in [[buffer]].
470
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
471
+ * @param result If supplied, a [Point3d]($core-geometry) to initialize with the result and return.
472
+ * @returns The unquantized point at the specified index in [[buffer]].
473
+ * @throws Error if `pointIndex` is out of bounds.
474
+ */
475
+ unquantize(pointIndex: number, result?: Point3d): Point3d;
476
+ /** Obtain a [[QPoint3dBuffer]] containing all of the points that have been appended by this builder. */
477
+ finish(): QPoint3dBuffer;
478
+ }
479
+ export {};
300
480
  //# sourceMappingURL=QPoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"QPoint.d.ts","sourceRoot":"","sources":["../../src/QPoint.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE9F;;;;;;;;;GASG;AACH,yBAAiB,YAAY,CAAC;IACrB,MAAM,YAAY,QAAS,CAAC;IAC5B,MAAM,WAAW,MAAO,CAAC;IAEhC,8FAA8F;IAC9F,SAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,SAAe,GAAG,MAAM,CAE9E;IAED,gBAAgB;IAChB,SAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,SAAe,GAAG,OAAO,CAE1E;IAED;;OAEG;IACH,SAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAe,GAAG,MAAM,CAEtG;IAED,gBAAgB;IAChB,SAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAe,WAElG;IAED;;OAEG;IACH,SAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9E;IAED,gBAAgB;IAChB,SAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,WAEvC;CACF;AAED;;;;GAIG;AACH,qBAAa,SAAS;IACpB,4CAA4C;IAC5C,SAAgB,MAAM,UAAiB;IACvC,yD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,OAAO,EAAE,4BAA4B;IASxD,+DAA+D;IACxD,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAMrD,+DAA+D;IACxD,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI7B,wDAAwD;IACxD,IAAW,MAAM,IAAI,MAAM,CAI1B;IAED;;;;;OAKG;IACI,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ;IAI3D;;;;;OAKG;IACI,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;IAIhE,wGAAwG;IACjG,MAAM,IAAI,cAAc;CAMhC"}
package/lib/esm/QPoint.js CHANGED
@@ -5,8 +5,8 @@
5
5
  /** @packageDocumentation
6
6
  * @module Geometry
7
7
  */
8
- import { assert } from "@itwin/core-bentley";
9
- import { Point2d, Point3d, Range2d, Range3d, Vector2d, Vector3d } from "@itwin/core-geometry";
8
+ import { assert, Uint16ArrayBuilder } from "@itwin/core-bentley";
9
+ import { Point2d, Point3d, Range2d, Range3d, Vector2d, Vector3d, } from "@itwin/core-geometry";
10
10
  /**
11
11
  * Provides facilities for quantizing floating point values within a specified range into 16-bit unsigned integers.
12
12
  * This is a lossy compression technique.
@@ -16,6 +16,7 @@ import { Point2d, Point3d, Range2d, Range3d, Vector2d, Vector3d } from "@itwin/c
16
16
  * These routines are chiefly used by classes like [[QPoint2d]] and [[QPoint3d]] to reduce the space required to store
17
17
  * coordinate values for [RenderGraphic]($frontend)s.
18
18
  * @public
19
+ * @extensions
19
20
  */
20
21
  export var Quantization;
21
22
  (function (Quantization) {
@@ -60,6 +61,7 @@ export var Quantization;
60
61
  * @see [[QPoint2d]] for the quantized representation of a [Point2d]($core-geometry).
61
62
  * @see [[QPoint2dList]] for a list of [[QPoint2d]]s quantized using a [[QParams2d]].
62
63
  * @public
64
+ * @extensions
63
65
  */
64
66
  export class QParams2d {
65
67
  constructor(ox = 0, oy = 0, sx = 0, sy = 0) {
@@ -135,6 +137,7 @@ export class QParams2d {
135
137
  * @see [[QParams2d]] to define quantization parameters for a range of points.
136
138
  * @see [[QPoint2dList]] for a list of points all quantized to the same range.
137
139
  * @public
140
+ * @extensions
138
141
  */
139
142
  export class QPoint2d {
140
143
  /** Construct with `x` and `y` initialized to zero. */
@@ -154,7 +157,7 @@ export class QPoint2d {
154
157
  assert(Quantization.isQuantized(y));
155
158
  this._y = y;
156
159
  }
157
- /** Initialize this point by quantizing the supplied Point2d using the specified params */
160
+ /** Initialize this point by quantizing the supplied { x, y } using the specified params */
158
161
  init(pos, params) {
159
162
  this.x = Quantization.quantize(pos.x, params.origin.x, params.scale.x);
160
163
  this.y = Quantization.quantize(pos.y, params.origin.y, params.scale.y);
@@ -205,8 +208,46 @@ export class QPoint2d {
205
208
  return pt;
206
209
  }
207
210
  }
211
+ /** @public
212
+ * @extensions
213
+ */
214
+ export var QPoint2dBuffer;
215
+ (function (QPoint2dBuffer) {
216
+ const scratchQPoint2d = new QPoint2d();
217
+ /** Extracts the point at the specified index from a buffer.
218
+ * @param points The buffer in which each consecutive pair of integers is a 2d quantized point.
219
+ * @param pointIndex The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
220
+ * @param result If supplied, a preallocated [[QPoint2d]] to initialize with the result and return.
221
+ * @returns The point at `pointIndex`.
222
+ * @throws Error if `pointIndex` is out of bounds.
223
+ */
224
+ function getQPoint(points, pointIndex, result) {
225
+ const index = pointIndex * 2;
226
+ const x = points[index + 0];
227
+ const y = points[index + 1];
228
+ if (undefined === x || undefined === y)
229
+ throw new Error("Index out of range");
230
+ result = result !== null && result !== void 0 ? result : new QPoint2d();
231
+ result.setFromScalars(x, y);
232
+ return result;
233
+ }
234
+ QPoint2dBuffer.getQPoint = getQPoint;
235
+ /** Extracts and unquantizes the point at the specified index from a buffer.
236
+ * @param buffer The array of points and the quantization parameters.
237
+ * @param The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
238
+ * @param result If supplied, a preallocated [Point2d]($core-geometry) to initialize with the result and return.
239
+ * @returns The point at `pointIndex`.
240
+ * @throws Error if `pointIndex` is out of bounds.
241
+ */
242
+ function unquantizePoint(buffer, pointIndex, result) {
243
+ const qpt = getQPoint(buffer.points, pointIndex, scratchQPoint2d);
244
+ return qpt.unquantize(buffer.params, result);
245
+ }
246
+ QPoint2dBuffer.unquantizePoint = unquantizePoint;
247
+ })(QPoint2dBuffer || (QPoint2dBuffer = {}));
208
248
  /** A list of [[QPoint2d]]s all quantized to the same range.
209
249
  * @public
250
+ * @extensions
210
251
  */
211
252
  export class QPoint2dList {
212
253
  /** Construct an empty list set up to use the supplied quantization parameters. */
@@ -287,8 +328,9 @@ export class QPoint2dList {
287
328
  qPoints = out;
288
329
  qPoints.reset(qParams);
289
330
  }
290
- else
331
+ else {
291
332
  qPoints = new QPoint2dList(qParams);
333
+ }
292
334
  for (const point of points)
293
335
  qPoints.add(point);
294
336
  return qPoints;
@@ -298,6 +340,7 @@ export class QPoint2dList {
298
340
  * @see [[QPoint3d]] for the quantized representation of a [Point3d]($core-geometry).
299
341
  * @see [[QPoint3dList]] for a list of [[QPoint3d]]s quantized using a [[QParams3d]].
300
342
  * @public
343
+ * @extensions
301
344
  */
302
345
  export class QParams3d {
303
346
  constructor(ox = 0, oy = 0, oz = 0, sx = 0, sy = 0, sz = 0) {
@@ -400,6 +443,7 @@ export class QParams3d {
400
443
  * @see [[QParams3d]] to define quantization parameters for a range of points.
401
444
  * @see [[QPoint3dList]] for a list of points all quantized to the same range.
402
445
  * @public
446
+ * @extensions
403
447
  */
404
448
  export class QPoint3d {
405
449
  /** Construct with all components initialized to zero. */
@@ -426,7 +470,7 @@ export class QPoint3d {
426
470
  assert(Quantization.isQuantized(z));
427
471
  this._z = z;
428
472
  }
429
- /** Initialize this point by quantizing the supplied Point3d using the specified params */
473
+ /** Initialize this point by quantizing the supplied { x, y, z } using the specified params */
430
474
  init(pos, params) {
431
475
  this.x = Quantization.quantize(pos.x, params.origin.x, params.scale.x);
432
476
  this.y = Quantization.quantize(pos.y, params.origin.y, params.scale.y);
@@ -506,8 +550,47 @@ export class QPoint3d {
506
550
  return diff;
507
551
  }
508
552
  }
553
+ /** @public
554
+ * @extensions
555
+ */
556
+ export var QPoint3dBuffer;
557
+ (function (QPoint3dBuffer) {
558
+ const scratchQPoint3d = new QPoint3d();
559
+ /** Extracts the point at the specified index from a buffer.
560
+ * @param points The buffer in which each consecutive pair of integers is a 3d quantized point.
561
+ * @param pointIndex The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
562
+ * @param result If supplied, a preallocated [[QPoint3d]] to initialize with the result and return.
563
+ * @returns The point at `pointIndex`.
564
+ * @throws Error if `pointIndex` is out of bounds.
565
+ */
566
+ function getQPoint(points, pointIndex, result) {
567
+ const index = pointIndex * 3;
568
+ const x = points[index + 0];
569
+ const y = points[index + 1];
570
+ const z = points[index + 2];
571
+ if (undefined === x || undefined === y || undefined === z)
572
+ throw new Error("Index out of range");
573
+ result = result !== null && result !== void 0 ? result : new QPoint3d();
574
+ result.setFromScalars(x, y, z);
575
+ return result;
576
+ }
577
+ QPoint3dBuffer.getQPoint = getQPoint;
578
+ /** Extracts and unquantizes the point at the specified index from a buffer.
579
+ * @param buffer The array of points and the quantization parameters.
580
+ * @param The index of the point to extract, ranging from zero to one less than the number of points in the buffer.
581
+ * @param result If supplied, a preallocated [Point3d]($core-geometry) to initialize with the result and return.
582
+ * @returns The point at `pointIndex`.
583
+ * @throws Error if `pointIndex` is out of bounds.
584
+ */
585
+ function unquantizePoint(buffer, pointIndex, result) {
586
+ const qpt = getQPoint(buffer.points, pointIndex, scratchQPoint3d);
587
+ return qpt.unquantize(buffer.params, result);
588
+ }
589
+ QPoint3dBuffer.unquantizePoint = unquantizePoint;
590
+ })(QPoint3dBuffer || (QPoint3dBuffer = {}));
509
591
  /** A list of [[QPoint3d]]s all quantized to the same range.
510
592
  * @public
593
+ * @extensions
511
594
  */
512
595
  export class QPoint3dList {
513
596
  /** Construct an empty list set up to quantize to the supplied range.
@@ -615,4 +698,119 @@ export class QPoint3dList {
615
698
  return this.list[Symbol.iterator]();
616
699
  }
617
700
  }
701
+ /** Constructs a [[QPoint2dBuffer]] using a [Uint16ArrayBuilder]($bentley).
702
+ * @public
703
+ * @extensions
704
+ */
705
+ export class QPoint2dBufferBuilder {
706
+ /** Construct a new buffer with a [[length]] of zero. */
707
+ constructor(options) {
708
+ var _a;
709
+ this._scratchQPoint2d = new QPoint2d();
710
+ this.params = QParams2d.fromRange(options.range);
711
+ const initialCapacity = (_a = options.initialCapacity) !== null && _a !== void 0 ? _a : 0;
712
+ this.buffer = new Uint16ArrayBuilder({
713
+ growthFactor: options.growthFactor,
714
+ initialCapacity: 2 * initialCapacity,
715
+ });
716
+ }
717
+ /** Append a point with the specified quantized coordinates. */
718
+ pushXY(x, y) {
719
+ this.buffer.push(x);
720
+ this.buffer.push(y);
721
+ }
722
+ /** Append a point with the specified quantized coordinates. */
723
+ push(pt) {
724
+ this.pushXY(pt.x, pt.y);
725
+ }
726
+ /** The number of points currently in the [[buffer]]. */
727
+ get length() {
728
+ const len = this.buffer.length;
729
+ assert(len % 2 === 0);
730
+ return len / 2;
731
+ }
732
+ /** Returns the quantized point at the specified index in [[buffer]].
733
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
734
+ * @param result If supplied, a [[QPoint2d]] to initialize with the result and return.
735
+ * @returns The quantized point at the specified index in [[buffer]].
736
+ * @throws Error if `pointIndex` is out of bounds.
737
+ */
738
+ get(pointIndex, result) {
739
+ return QPoint2dBuffer.getQPoint(this.buffer.toTypedArray(), pointIndex, result);
740
+ }
741
+ /** Returns the unquantized point at the specified index in [[buffer]].
742
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
743
+ * @param result If supplied, a [Point2d]($core-geometry) to initialize with the result and return.
744
+ * @returns The unquantized point at the specified index in [[buffer]].
745
+ * @throws Error if `pointIndex` is out of bounds.
746
+ */
747
+ unquantize(pointIndex, result) {
748
+ return this.get(pointIndex, this._scratchQPoint2d).unquantize(this.params, result);
749
+ }
750
+ /** Obtain a [[QPoint2dBuffer]] containing all of the points that have been appended by this builder. */
751
+ finish() {
752
+ return {
753
+ params: this.params,
754
+ points: this.buffer.toTypedArray(),
755
+ };
756
+ }
757
+ }
758
+ /** Constructs a [[QPoint3dBuffer]] using a [Uint16ArrayBuilder]($bentley).
759
+ * @public
760
+ * @extensions
761
+ */
762
+ export class QPoint3dBufferBuilder {
763
+ /** Construct a new buffer with a [[length]] of zero. */
764
+ constructor(options) {
765
+ var _a;
766
+ this._scratchQPoint3d = new QPoint3d();
767
+ this.params = QParams3d.fromRange(options.range);
768
+ const initialCapacity = (_a = options.initialCapacity) !== null && _a !== void 0 ? _a : 0;
769
+ this.buffer = new Uint16ArrayBuilder({
770
+ growthFactor: options.growthFactor,
771
+ initialCapacity: 3 * initialCapacity,
772
+ });
773
+ }
774
+ /** Append a point with the specified quantized coordinates. */
775
+ pushXYZ(x, y, z) {
776
+ this.buffer.push(x);
777
+ this.buffer.push(y);
778
+ this.buffer.push(z);
779
+ }
780
+ /** Append a point with the specified quantized coordinates. */
781
+ push(pt) {
782
+ this.pushXYZ(pt.x, pt.y, pt.z);
783
+ }
784
+ /** The number of points currently in the [[buffer]]. */
785
+ get length() {
786
+ const len = this.buffer.length;
787
+ assert(len % 3 === 0);
788
+ return len / 3;
789
+ }
790
+ /** Returns the quantized point at the specified index in [[buffer]].
791
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
792
+ * @param result If supplied, a [[QPoint3d]] to initialize with the result and return.
793
+ * @returns The quantized point at the specified index in [[buffer]].
794
+ * @throws Error if `pointIndex` is out of bounds.
795
+ */
796
+ get(pointIndex, result) {
797
+ return QPoint3dBuffer.getQPoint(this.buffer.toTypedArray(), pointIndex, result);
798
+ }
799
+ /** Returns the unquantized point at the specified index in [[buffer]].
800
+ * @param pointIndex The index of the point of interest, ranging from zero to one minus the number of points currently in the [[buffer]].
801
+ * @param result If supplied, a [Point3d]($core-geometry) to initialize with the result and return.
802
+ * @returns The unquantized point at the specified index in [[buffer]].
803
+ * @throws Error if `pointIndex` is out of bounds.
804
+ */
805
+ unquantize(pointIndex, result) {
806
+ return this.get(pointIndex, this._scratchQPoint3d).unquantize(this.params, result);
807
+ }
808
+ /** Obtain a [[QPoint3dBuffer]] containing all of the points that have been appended by this builder. */
809
+ finish() {
810
+ return {
811
+ params: this.params,
812
+ points: this.buffer.toTypedArray(),
813
+ };
814
+ }
815
+ }
618
816
  //# sourceMappingURL=QPoint.js.map