@itwin/core-geometry 3.3.0-dev.76 → 3.3.0-dev.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/curve/spiral/DirectSpiral3d.js +1 -1
- package/lib/cjs/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts +32 -3
- package/lib/cjs/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableBlockedArray.js +63 -14
- package/lib/cjs/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts +24 -8
- package/lib/cjs/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableFloat64Array.js +72 -54
- package/lib/cjs/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts +51 -26
- package/lib/cjs/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYArray.js +136 -116
- package/lib/cjs/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts +35 -21
- package/lib/cjs/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/cjs/geometry3d/GrowableXYZArray.js +124 -137
- package/lib/cjs/geometry3d/GrowableXYZArray.js.map +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js +1 -1
- package/lib/esm/curve/spiral/DirectSpiral3d.js.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.d.ts +32 -3
- package/lib/esm/geometry3d/GrowableBlockedArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableBlockedArray.js +63 -14
- package/lib/esm/geometry3d/GrowableBlockedArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts +24 -8
- package/lib/esm/geometry3d/GrowableFloat64Array.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableFloat64Array.js +72 -54
- package/lib/esm/geometry3d/GrowableFloat64Array.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.d.ts +51 -26
- package/lib/esm/geometry3d/GrowableXYArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYArray.js +136 -116
- package/lib/esm/geometry3d/GrowableXYArray.js.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts +35 -21
- package/lib/esm/geometry3d/GrowableXYZArray.d.ts.map +1 -1
- package/lib/esm/geometry3d/GrowableXYZArray.js +124 -137
- package/lib/esm/geometry3d/GrowableXYZArray.js.map +1 -1
- package/package.json +4 -4
|
@@ -12,21 +12,36 @@ import { XAndY, XYAndZ } from "./XYZProps";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare class GrowableXYArray extends IndexedXYCollection {
|
|
14
14
|
/**
|
|
15
|
-
* array of packed
|
|
15
|
+
* array of packed xy xy xy components
|
|
16
16
|
*/
|
|
17
17
|
private _data;
|
|
18
18
|
/**
|
|
19
|
-
* Number of
|
|
19
|
+
* Number of xy tuples (not floats) in the array
|
|
20
20
|
*/
|
|
21
21
|
private _xyInUse;
|
|
22
22
|
/**
|
|
23
|
-
* capacity in
|
|
23
|
+
* capacity in xy tuples. (not floats)
|
|
24
24
|
*/
|
|
25
|
-
private
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
25
|
+
private _xyCapacity;
|
|
26
|
+
/**
|
|
27
|
+
* multiplier used by ensureCapacity to expand requested reallocation size
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
private _growthFactor;
|
|
30
|
+
/** Construct a new GrowablePoint2d array.
|
|
31
|
+
* @param numPoints initial capacity in xy tuples (default 8)
|
|
32
|
+
* @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)
|
|
33
|
+
*/
|
|
34
|
+
constructor(numPoints?: number, growthFactor?: number);
|
|
35
|
+
/** Copy xy points from source array. Does not reallocate or change active point count.
|
|
36
|
+
* @param source array to copy from
|
|
37
|
+
* @param sourceCount copy the first sourceCount points; all points if undefined
|
|
38
|
+
* @param destOffset copy to instance array starting at this point index; zero if undefined
|
|
39
|
+
* @return count and offset of points copied
|
|
40
|
+
*/
|
|
41
|
+
protected copyData(source: Float64Array | number[], sourceCount?: number, destOffset?: number): {
|
|
42
|
+
count: number;
|
|
43
|
+
offset: number;
|
|
44
|
+
};
|
|
30
45
|
/** The number of points in use. When the length is increased, the array is padded with zeroes. */
|
|
31
46
|
get length(): number;
|
|
32
47
|
set length(newLength: number);
|
|
@@ -37,9 +52,14 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
37
52
|
*/
|
|
38
53
|
float64Data(): Float64Array;
|
|
39
54
|
/** If necessary, increase the capacity to a new pointCount. Current coordinates and point count (length) are unchanged. */
|
|
40
|
-
ensureCapacity(pointCapacity: number): void;
|
|
41
|
-
/**
|
|
42
|
-
|
|
55
|
+
ensureCapacity(pointCapacity: number, applyGrowthFactor?: boolean): void;
|
|
56
|
+
/**
|
|
57
|
+
* * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active points but preserving original capacity.
|
|
58
|
+
* * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and optionally pad excess with zero.
|
|
59
|
+
* @param pointCount new number of active points in array
|
|
60
|
+
* @param padWithZero when increasing point count, whether to zero out new points (default false)
|
|
61
|
+
*/
|
|
62
|
+
resize(pointCount: number, padWithZero?: boolean): void;
|
|
43
63
|
/**
|
|
44
64
|
* Make a copy of the (active) points in this array.
|
|
45
65
|
* (The clone does NOT get excess capacity)
|
|
@@ -61,24 +81,24 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
61
81
|
/** push all points of an array */
|
|
62
82
|
pushAllXYAndZ(points: XYAndZ[] | GrowableXYZArray): void;
|
|
63
83
|
/**
|
|
64
|
-
* Replicate numWrap
|
|
65
|
-
* @param numWrap number of
|
|
84
|
+
* Replicate numWrap xy values from the front of the array as new values at the end.
|
|
85
|
+
* @param numWrap number of xy values to replicate
|
|
66
86
|
*/
|
|
67
87
|
pushWrap(numWrap: number): void;
|
|
68
88
|
/** push a point given by x,y coordinates */
|
|
69
89
|
pushXY(x: number, y: number): void;
|
|
70
90
|
/** Remove one point from the back.
|
|
71
91
|
* * NOTE that (in the manner of std::vector native) this is "just" removing the point -- no point is NOT returned.
|
|
72
|
-
* * Use `back ()` to get the last x,y
|
|
92
|
+
* * Use `back ()` to get the last x,y assembled into a `Point2d `
|
|
73
93
|
*/
|
|
74
94
|
pop(): void;
|
|
75
95
|
/**
|
|
76
|
-
* Test if index is valid for an
|
|
77
|
-
* @param index
|
|
96
|
+
* Test if index is valid for an xy (point or vector) within this array
|
|
97
|
+
* @param index xy index to test.
|
|
78
98
|
*/
|
|
79
99
|
isIndexValid(index: number): boolean;
|
|
80
100
|
/**
|
|
81
|
-
* Clear all
|
|
101
|
+
* Clear all xy data, but leave capacity unchanged.
|
|
82
102
|
*/
|
|
83
103
|
clear(): void;
|
|
84
104
|
/**
|
|
@@ -101,9 +121,9 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
101
121
|
* Gather all points as a Point2d[]
|
|
102
122
|
*/
|
|
103
123
|
getPoint2dArray(): Point2d[];
|
|
104
|
-
/** copy
|
|
124
|
+
/** copy xy into strongly typed Point2d */
|
|
105
125
|
getPoint2dAtCheckedPointIndex(pointIndex: number, result?: Point2d): Point2d | undefined;
|
|
106
|
-
/** copy
|
|
126
|
+
/** copy xy into strongly typed Vector2d */
|
|
107
127
|
getVector2dAtCheckedVectorIndex(vectorIndex: number, result?: Vector2d): Vector2d | undefined;
|
|
108
128
|
/**
|
|
109
129
|
* Read coordinates from source array, place them at index within this array.
|
|
@@ -116,8 +136,8 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
116
136
|
/**
|
|
117
137
|
* push coordinates from the source array to the end of this array.
|
|
118
138
|
* @param source source array
|
|
119
|
-
* @param sourceIndex
|
|
120
|
-
* @returns
|
|
139
|
+
* @param sourceIndex xy index within the source. If undefined, push entire contents of source
|
|
140
|
+
* @returns number of points pushed.
|
|
121
141
|
*/
|
|
122
142
|
pushFromGrowableXYArray(source: GrowableXYArray, sourceIndex?: number): number;
|
|
123
143
|
/**
|
|
@@ -126,9 +146,9 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
126
146
|
*/
|
|
127
147
|
pushInterpolatedFromGrowableXYArray(source: GrowableXYArray, i: number, fraction: number, j: number): void;
|
|
128
148
|
/**
|
|
129
|
-
*
|
|
130
|
-
* @param source source array
|
|
131
|
-
* @param transform optional transform to apply to points.
|
|
149
|
+
* Create an array of xy points from source xyz points.
|
|
150
|
+
* @param source source array of xyz
|
|
151
|
+
* @param transform optional transform to apply to xyz points.
|
|
132
152
|
* @param dest optional result.
|
|
133
153
|
*/
|
|
134
154
|
static createFromGrowableXYZArray(source: GrowableXYZArray, transform?: Transform, dest?: GrowableXYArray): GrowableXYArray;
|
|
@@ -152,16 +172,21 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
152
172
|
* @param x x coordinate
|
|
153
173
|
* @param y y coordinate
|
|
154
174
|
*/
|
|
175
|
+
setXYAtCheckedPointIndex(pointIndex: number, x: number, y: number): boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Set the coordinates of a single point given as coordinates.
|
|
178
|
+
* @deprecated Use setXYAtCheckedPointIndex instead
|
|
179
|
+
*/
|
|
155
180
|
setXYZAtCheckedPointIndex(pointIndex: number, x: number, y: number): boolean;
|
|
156
181
|
/**
|
|
157
|
-
* Copy all points into a simple array of
|
|
182
|
+
* Copy all points into a simple array of Point3d with given z.
|
|
158
183
|
*/
|
|
159
184
|
getPoint3dArray(z?: number): Point3d[];
|
|
160
185
|
/** reverse the order of points. */
|
|
161
186
|
reverseInPlace(): void;
|
|
162
187
|
/** multiply each point by the transform, replace values. */
|
|
163
188
|
multiplyTransformInPlace(transform: Transform): void;
|
|
164
|
-
/** multiply each
|
|
189
|
+
/** multiply each xy (as a vector) by matrix, replace values. */
|
|
165
190
|
multiplyMatrix3dInPlace(matrix: Matrix3d): void;
|
|
166
191
|
/** multiply each point by the transform, replace values. */
|
|
167
192
|
tryTransformInverseInPlace(transform: Transform): boolean;
|
|
@@ -170,7 +195,7 @@ export declare class GrowableXYArray extends IndexedXYCollection {
|
|
|
170
195
|
/** sum the lengths of segments between points. */
|
|
171
196
|
sumLengths(): number;
|
|
172
197
|
/**
|
|
173
|
-
* Multiply each x,y
|
|
198
|
+
* Multiply each x,y by the scale factor.
|
|
174
199
|
* @param factor
|
|
175
200
|
*/
|
|
176
201
|
scaleInPlace(factor: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrowableXYArray.d.ts","sourceRoot":"","sources":["../../../src/geometry3d/GrowableXYArray.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,mBAAmB;IACtD;;OAEG;IACH,OAAO,CAAC,KAAK,CAAe;IAC5B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAS;IACzB;;OAEG;IACH,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"GrowableXYArray.d.ts","sourceRoot":"","sources":["../../../src/geometry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kBAAkB,IAAI,WAAW;IAcxC,kDAAkD;IAC3C,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM;IAY1D,oFAAoF;IAC7E,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM;IAGpE,+BAA+B;IACxB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,GAAE,MAAqC,GAAG,OAAO;CAYxG"}
|
|
@@ -16,27 +16,51 @@ import { PointStreamGrowableXYZArrayCollector, VariantPointDataStream } from "./
|
|
|
16
16
|
*/
|
|
17
17
|
export class GrowableXYArray extends IndexedXYCollection {
|
|
18
18
|
/** Construct a new GrowablePoint2d array.
|
|
19
|
-
* @param numPoints
|
|
19
|
+
* @param numPoints initial capacity in xy tuples (default 8)
|
|
20
|
+
* @param growthFactor used by ensureCapacity to expand requested reallocation size (default 1.5)
|
|
20
21
|
*/
|
|
21
|
-
constructor(numPoints = 8) {
|
|
22
|
+
constructor(numPoints = 8, growthFactor) {
|
|
22
23
|
super();
|
|
23
|
-
this._data = new Float64Array(numPoints * 2); //
|
|
24
|
+
this._data = new Float64Array(numPoints * 2); // 2 values per point
|
|
24
25
|
this._xyInUse = 0;
|
|
25
|
-
this.
|
|
26
|
+
this._xyCapacity = numPoints;
|
|
27
|
+
this._growthFactor = (undefined !== growthFactor && growthFactor >= 1.0) ? growthFactor : 1.5;
|
|
28
|
+
}
|
|
29
|
+
/** Copy xy points from source array. Does not reallocate or change active point count.
|
|
30
|
+
* @param source array to copy from
|
|
31
|
+
* @param sourceCount copy the first sourceCount points; all points if undefined
|
|
32
|
+
* @param destOffset copy to instance array starting at this point index; zero if undefined
|
|
33
|
+
* @return count and offset of points copied
|
|
34
|
+
*/
|
|
35
|
+
copyData(source, sourceCount, destOffset) {
|
|
36
|
+
// validate inputs and convert from points to entries
|
|
37
|
+
let myOffset = (undefined !== destOffset) ? destOffset * 2 : 0;
|
|
38
|
+
if (myOffset < 0)
|
|
39
|
+
myOffset = 0;
|
|
40
|
+
if (myOffset >= this._data.length)
|
|
41
|
+
return { count: 0, offset: 0 };
|
|
42
|
+
let myCount = (undefined !== sourceCount) ? sourceCount * 2 : source.length;
|
|
43
|
+
if (myCount > 0) {
|
|
44
|
+
if (myCount > source.length)
|
|
45
|
+
myCount = source.length;
|
|
46
|
+
if (myOffset + myCount > this._data.length)
|
|
47
|
+
myCount = this._data.length - myOffset;
|
|
48
|
+
if (myCount % 2 !== 0)
|
|
49
|
+
myCount -= myCount % 2;
|
|
50
|
+
}
|
|
51
|
+
if (myCount <= 0)
|
|
52
|
+
return { count: 0, offset: 0 };
|
|
53
|
+
if (myCount === source.length)
|
|
54
|
+
this._data.set(source, myOffset);
|
|
55
|
+
else if (source instanceof Float64Array)
|
|
56
|
+
this._data.set(source.subarray(0, myCount), myOffset);
|
|
57
|
+
else
|
|
58
|
+
this._data.set(source.slice(0, myCount), myOffset);
|
|
59
|
+
return { count: myCount / 2, offset: myOffset / 2 };
|
|
26
60
|
}
|
|
27
61
|
/** The number of points in use. When the length is increased, the array is padded with zeroes. */
|
|
28
62
|
get length() { return this._xyInUse; }
|
|
29
|
-
set length(newLength) {
|
|
30
|
-
let oldLength = this.length;
|
|
31
|
-
if (newLength < oldLength) {
|
|
32
|
-
this._xyInUse = newLength;
|
|
33
|
-
}
|
|
34
|
-
else if (newLength > oldLength) {
|
|
35
|
-
this.ensureCapacity(newLength);
|
|
36
|
-
while (oldLength++ < newLength)
|
|
37
|
-
this.pushXY(0, 0);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
63
|
+
set length(newLength) { this.resize(newLength, true); }
|
|
40
64
|
/** Return the number of float64 in use. */
|
|
41
65
|
get float64Length() { return this._xyInUse * 2; }
|
|
42
66
|
/** Return the raw packed data.
|
|
@@ -44,31 +68,29 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
44
68
|
*/
|
|
45
69
|
float64Data() { return this._data; }
|
|
46
70
|
/** If necessary, increase the capacity to a new pointCount. Current coordinates and point count (length) are unchanged. */
|
|
47
|
-
ensureCapacity(pointCapacity) {
|
|
48
|
-
if (pointCapacity > this.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this._data = newArray;
|
|
71
|
-
this._xyzCapacity = pointCount;
|
|
71
|
+
ensureCapacity(pointCapacity, applyGrowthFactor = true) {
|
|
72
|
+
if (pointCapacity > this._xyCapacity) {
|
|
73
|
+
if (applyGrowthFactor)
|
|
74
|
+
pointCapacity *= this._growthFactor;
|
|
75
|
+
const prevData = this._data;
|
|
76
|
+
this._data = new Float64Array(pointCapacity * 2);
|
|
77
|
+
this.copyData(prevData, this._xyInUse);
|
|
78
|
+
this._xyCapacity = pointCapacity;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* * If pointCount is less than current length, just reset current length to pointCount, effectively trimming active points but preserving original capacity.
|
|
83
|
+
* * If pointCount is greater than current length, reallocate to exactly pointCount, copy existing points, and optionally pad excess with zero.
|
|
84
|
+
* @param pointCount new number of active points in array
|
|
85
|
+
* @param padWithZero when increasing point count, whether to zero out new points (default false)
|
|
86
|
+
*/
|
|
87
|
+
resize(pointCount, padWithZero) {
|
|
88
|
+
if (pointCount >= 0 && pointCount < this._xyInUse)
|
|
89
|
+
this._xyInUse = pointCount;
|
|
90
|
+
else if (pointCount > this._xyInUse) {
|
|
91
|
+
this.ensureCapacity(pointCount, false);
|
|
92
|
+
if (padWithZero !== null && padWithZero !== void 0 ? padWithZero : false)
|
|
93
|
+
this._data.fill(0, this._xyInUse * 2);
|
|
72
94
|
this._xyInUse = pointCount;
|
|
73
95
|
}
|
|
74
96
|
}
|
|
@@ -78,11 +100,7 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
78
100
|
*/
|
|
79
101
|
clone() {
|
|
80
102
|
const newPoints = new GrowableXYArray(this.length);
|
|
81
|
-
|
|
82
|
-
const newData = newPoints._data;
|
|
83
|
-
const data = this._data;
|
|
84
|
-
for (let i = 0; i < numValue; i++)
|
|
85
|
-
newData[i] = data[i];
|
|
103
|
+
newPoints.copyData(this._data, this.length);
|
|
86
104
|
newPoints._xyInUse = this.length;
|
|
87
105
|
return newPoints;
|
|
88
106
|
}
|
|
@@ -114,17 +132,18 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
114
132
|
}
|
|
115
133
|
/** push all points of an array */
|
|
116
134
|
pushAll(points) {
|
|
135
|
+
this.ensureCapacity(this._xyInUse + points.length, false);
|
|
117
136
|
for (const p of points)
|
|
118
137
|
this.push(p);
|
|
119
138
|
}
|
|
120
139
|
/** push all points of an array */
|
|
121
140
|
pushAllXYAndZ(points) {
|
|
141
|
+
this.ensureCapacity(this._xyInUse + points.length, false);
|
|
122
142
|
if (points instanceof GrowableXYZArray) {
|
|
123
143
|
const xyzBuffer = points.float64Data();
|
|
124
144
|
const n = points.length * 3;
|
|
125
|
-
for (let i = 0; i + 2 < n; i += 3)
|
|
145
|
+
for (let i = 0; i + 2 < n; i += 3)
|
|
126
146
|
this.pushXY(xyzBuffer[i], xyzBuffer[i + 1]);
|
|
127
|
-
}
|
|
128
147
|
}
|
|
129
148
|
else {
|
|
130
149
|
for (const p of points)
|
|
@@ -132,38 +151,37 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
132
151
|
}
|
|
133
152
|
}
|
|
134
153
|
/**
|
|
135
|
-
* Replicate numWrap
|
|
136
|
-
* @param numWrap number of
|
|
154
|
+
* Replicate numWrap xy values from the front of the array as new values at the end.
|
|
155
|
+
* @param numWrap number of xy values to replicate
|
|
137
156
|
*/
|
|
138
157
|
pushWrap(numWrap) {
|
|
139
|
-
if (this._xyInUse
|
|
140
|
-
|
|
158
|
+
if (this._xyInUse >= numWrap) {
|
|
159
|
+
this.ensureCapacity(this._xyInUse + numWrap, false);
|
|
141
160
|
for (let i = 0; i < numWrap; i++) {
|
|
142
|
-
k = 2 * i;
|
|
161
|
+
const k = 2 * i;
|
|
143
162
|
this.pushXY(this._data[k], this._data[k + 1]);
|
|
144
163
|
}
|
|
145
164
|
}
|
|
146
165
|
}
|
|
147
166
|
/** push a point given by x,y coordinates */
|
|
148
167
|
pushXY(x, y) {
|
|
168
|
+
this.ensureCapacity(this._xyInUse + 1);
|
|
149
169
|
const index = this._xyInUse * 2;
|
|
150
|
-
if (index >= this._data.length)
|
|
151
|
-
this.ensureCapacity(this.length === 0 ? 4 : this.length * 2);
|
|
152
170
|
this._data[index] = x;
|
|
153
171
|
this._data[index + 1] = y;
|
|
154
172
|
this._xyInUse++;
|
|
155
173
|
}
|
|
156
174
|
/** Remove one point from the back.
|
|
157
175
|
* * NOTE that (in the manner of std::vector native) this is "just" removing the point -- no point is NOT returned.
|
|
158
|
-
* * Use `back ()` to get the last x,y
|
|
176
|
+
* * Use `back ()` to get the last x,y assembled into a `Point2d `
|
|
159
177
|
*/
|
|
160
178
|
pop() {
|
|
161
179
|
if (this._xyInUse > 0)
|
|
162
180
|
this._xyInUse--;
|
|
163
181
|
}
|
|
164
182
|
/**
|
|
165
|
-
* Test if index is valid for an
|
|
166
|
-
* @param index
|
|
183
|
+
* Test if index is valid for an xy (point or vector) within this array
|
|
184
|
+
* @param index xy index to test.
|
|
167
185
|
*/
|
|
168
186
|
isIndexValid(index) {
|
|
169
187
|
if (index >= this._xyInUse || index < 0)
|
|
@@ -171,7 +189,7 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
171
189
|
return true;
|
|
172
190
|
}
|
|
173
191
|
/**
|
|
174
|
-
* Clear all
|
|
192
|
+
* Clear all xy data, but leave capacity unchanged.
|
|
175
193
|
*/
|
|
176
194
|
clear() {
|
|
177
195
|
this._xyInUse = 0;
|
|
@@ -210,18 +228,18 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
210
228
|
result.push(Point2d.create(data[i], data[i + 1]));
|
|
211
229
|
return result;
|
|
212
230
|
}
|
|
213
|
-
/** copy
|
|
231
|
+
/** copy xy into strongly typed Point2d */
|
|
214
232
|
getPoint2dAtCheckedPointIndex(pointIndex, result) {
|
|
215
|
-
const index = 2 * pointIndex;
|
|
216
233
|
if (this.isIndexValid(pointIndex)) {
|
|
234
|
+
const index = 2 * pointIndex;
|
|
217
235
|
return Point2d.create(this._data[index], this._data[index + 1], result);
|
|
218
236
|
}
|
|
219
237
|
return undefined;
|
|
220
238
|
}
|
|
221
|
-
/** copy
|
|
239
|
+
/** copy xy into strongly typed Vector2d */
|
|
222
240
|
getVector2dAtCheckedVectorIndex(vectorIndex, result) {
|
|
223
|
-
const index = 2 * vectorIndex;
|
|
224
241
|
if (this.isIndexValid(vectorIndex)) {
|
|
242
|
+
const index = 2 * vectorIndex;
|
|
225
243
|
return Vector2d.create(this._data[index], this._data[index + 1], result);
|
|
226
244
|
}
|
|
227
245
|
return undefined;
|
|
@@ -239,7 +257,6 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
239
257
|
const j = sourceIndex * 2;
|
|
240
258
|
this._data[i] = source._data[j];
|
|
241
259
|
this._data[i + 1] = source._data[j + 1];
|
|
242
|
-
this._data[i + 2] = source._data[j + 2];
|
|
243
260
|
return true;
|
|
244
261
|
}
|
|
245
262
|
return false;
|
|
@@ -247,21 +264,19 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
247
264
|
/**
|
|
248
265
|
* push coordinates from the source array to the end of this array.
|
|
249
266
|
* @param source source array
|
|
250
|
-
* @param sourceIndex
|
|
251
|
-
* @returns
|
|
267
|
+
* @param sourceIndex xy index within the source. If undefined, push entire contents of source
|
|
268
|
+
* @returns number of points pushed.
|
|
252
269
|
*/
|
|
253
270
|
pushFromGrowableXYArray(source, sourceIndex) {
|
|
271
|
+
// full array push . . .
|
|
254
272
|
if (sourceIndex === undefined) {
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
this.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
for (let i = 0; i < numFloatAdd; i++)
|
|
261
|
-
this._data[numFloatPresent + i] = source._data[i];
|
|
262
|
-
this._xyInUse += numPush;
|
|
263
|
-
return numPush;
|
|
273
|
+
const numXYAdd = source.length;
|
|
274
|
+
this.ensureCapacity(this.length + numXYAdd, false);
|
|
275
|
+
this.copyData(source._data, numXYAdd, this.length);
|
|
276
|
+
this._xyInUse += numXYAdd;
|
|
277
|
+
return numXYAdd;
|
|
264
278
|
}
|
|
279
|
+
// single point push . . .
|
|
265
280
|
if (source.isIndexValid(sourceIndex)) {
|
|
266
281
|
const j = sourceIndex * 2;
|
|
267
282
|
this.pushXY(source._data[j], source._data[j + 1]);
|
|
@@ -275,29 +290,31 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
275
290
|
*/
|
|
276
291
|
pushInterpolatedFromGrowableXYArray(source, i, fraction, j) {
|
|
277
292
|
if (source.isIndexValid(i) && source.isIndexValid(j)) {
|
|
293
|
+
const fraction0 = 1.0 - fraction;
|
|
278
294
|
const data = source._data;
|
|
279
|
-
i =
|
|
280
|
-
j =
|
|
281
|
-
this.pushXY(
|
|
295
|
+
i = 2 * i;
|
|
296
|
+
j = 2 * j;
|
|
297
|
+
this.pushXY(fraction0 * data[i] + fraction * data[j], fraction0 * data[i + 1] + fraction * data[j + 1]);
|
|
282
298
|
}
|
|
283
299
|
}
|
|
284
300
|
/**
|
|
285
|
-
*
|
|
286
|
-
* @param source source array
|
|
287
|
-
* @param transform optional transform to apply to points.
|
|
301
|
+
* Create an array of xy points from source xyz points.
|
|
302
|
+
* @param source source array of xyz
|
|
303
|
+
* @param transform optional transform to apply to xyz points.
|
|
288
304
|
* @param dest optional result.
|
|
289
305
|
*/
|
|
290
306
|
static createFromGrowableXYZArray(source, transform, dest) {
|
|
291
|
-
const
|
|
292
|
-
const numXYZ = source.length; // this is in xyz points
|
|
293
|
-
const nDouble = 3 * numXYZ;
|
|
307
|
+
const numPoints = source.length;
|
|
294
308
|
if (!dest)
|
|
295
|
-
dest = new GrowableXYArray(
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
309
|
+
dest = new GrowableXYArray(numPoints);
|
|
310
|
+
else {
|
|
311
|
+
dest.ensureCapacity(numPoints, false);
|
|
312
|
+
dest.clear();
|
|
313
|
+
}
|
|
300
314
|
if (transform) {
|
|
315
|
+
const packedXYZ = source.float64Data();
|
|
316
|
+
const nDouble = 3 * numPoints;
|
|
317
|
+
let x, y, z;
|
|
301
318
|
for (let i = 0; i < nDouble; i += 3) {
|
|
302
319
|
x = packedXYZ[i];
|
|
303
320
|
y = packedXYZ[i + 1];
|
|
@@ -306,11 +323,7 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
306
323
|
}
|
|
307
324
|
}
|
|
308
325
|
else {
|
|
309
|
-
|
|
310
|
-
x = packedXYZ[i];
|
|
311
|
-
y = packedXYZ[i + 1];
|
|
312
|
-
dest.pushXY(x, y);
|
|
313
|
-
}
|
|
326
|
+
dest.pushAllXYAndZ(source);
|
|
314
327
|
}
|
|
315
328
|
return dest;
|
|
316
329
|
}
|
|
@@ -349,7 +362,7 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
349
362
|
* @param x x coordinate
|
|
350
363
|
* @param y y coordinate
|
|
351
364
|
*/
|
|
352
|
-
|
|
365
|
+
setXYAtCheckedPointIndex(pointIndex, x, y) {
|
|
353
366
|
if (!this.isIndexValid(pointIndex))
|
|
354
367
|
return false;
|
|
355
368
|
const index = pointIndex * 2;
|
|
@@ -358,15 +371,21 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
358
371
|
return true;
|
|
359
372
|
}
|
|
360
373
|
/**
|
|
361
|
-
*
|
|
374
|
+
* Set the coordinates of a single point given as coordinates.
|
|
375
|
+
* @deprecated Use setXYAtCheckedPointIndex instead
|
|
376
|
+
*/
|
|
377
|
+
setXYZAtCheckedPointIndex(pointIndex, x, y) {
|
|
378
|
+
return this.setXYAtCheckedPointIndex(pointIndex, x, y);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Copy all points into a simple array of Point3d with given z.
|
|
362
382
|
*/
|
|
363
383
|
getPoint3dArray(z = 0) {
|
|
384
|
+
const n = 2 * this._xyInUse;
|
|
364
385
|
const result = [];
|
|
365
386
|
const data = this._data;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
result.push(Point3d.create(data[i * 2], data[i * 2 + 1], z));
|
|
369
|
-
}
|
|
387
|
+
for (let i = 0; i < n; i += 2)
|
|
388
|
+
result.push(Point3d.create(data[i], data[i + 1], z));
|
|
370
389
|
return result;
|
|
371
390
|
}
|
|
372
391
|
/** reverse the order of points. */
|
|
@@ -398,21 +417,21 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
398
417
|
const y0 = origin.y;
|
|
399
418
|
let x = 0;
|
|
400
419
|
let y = 0;
|
|
401
|
-
for (let i = 0; i +
|
|
420
|
+
for (let i = 0; i + 1 < nDouble; i += 2) {
|
|
402
421
|
x = data[i];
|
|
403
422
|
y = data[i + 1];
|
|
404
423
|
data[i] = coffs[0] * x + coffs[1] * y + x0;
|
|
405
424
|
data[i + 1] = coffs[3] * x + coffs[4] * y + y0;
|
|
406
425
|
}
|
|
407
426
|
}
|
|
408
|
-
/** multiply each
|
|
427
|
+
/** multiply each xy (as a vector) by matrix, replace values. */
|
|
409
428
|
multiplyMatrix3dInPlace(matrix) {
|
|
410
429
|
const data = this._data;
|
|
411
430
|
const nDouble = this.float64Length;
|
|
412
431
|
const coffs = matrix.coffs;
|
|
413
432
|
let x = 0;
|
|
414
433
|
let y = 0;
|
|
415
|
-
for (let i = 0; i +
|
|
434
|
+
for (let i = 0; i + 1 < nDouble; i += 2) {
|
|
416
435
|
x = data[i];
|
|
417
436
|
y = data[i + 1];
|
|
418
437
|
data[i] = coffs[0] * x + coffs[1] * y;
|
|
@@ -433,12 +452,11 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
433
452
|
const y0 = origin.y;
|
|
434
453
|
let x = 0;
|
|
435
454
|
let y = 0;
|
|
436
|
-
for (let i = 0; i +
|
|
455
|
+
for (let i = 0; i + 1 < nDouble; i += 2) {
|
|
437
456
|
x = data[i] - x0;
|
|
438
457
|
y = data[i + 1] - y0;
|
|
439
458
|
data[i] = coffs[0] * x + coffs[1] * y;
|
|
440
459
|
data[i + 1] = coffs[3] * x + coffs[4] * y;
|
|
441
|
-
data[i + 2] = coffs[6] * x + coffs[7] * y;
|
|
442
460
|
}
|
|
443
461
|
return true;
|
|
444
462
|
}
|
|
@@ -447,11 +465,11 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
447
465
|
const numDouble = this.float64Length;
|
|
448
466
|
const data = this._data;
|
|
449
467
|
if (transform) {
|
|
450
|
-
for (let i = 0; i +
|
|
468
|
+
for (let i = 0; i + 1 < numDouble; i += 2)
|
|
451
469
|
rangeToExtend.extendTransformedXY(transform, data[i], data[i + 1]);
|
|
452
470
|
}
|
|
453
471
|
else {
|
|
454
|
-
for (let i = 0; i +
|
|
472
|
+
for (let i = 0; i + 1 < numDouble; i += 2)
|
|
455
473
|
rangeToExtend.extendXY(data[i], data[i + 1]);
|
|
456
474
|
}
|
|
457
475
|
}
|
|
@@ -465,7 +483,7 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
465
483
|
return sum;
|
|
466
484
|
}
|
|
467
485
|
/**
|
|
468
|
-
* Multiply each x,y
|
|
486
|
+
* Multiply each x,y by the scale factor.
|
|
469
487
|
* @param factor
|
|
470
488
|
*/
|
|
471
489
|
scaleInPlace(factor) {
|
|
@@ -525,21 +543,23 @@ export class GrowableXYArray extends IndexedXYCollection {
|
|
|
525
543
|
}
|
|
526
544
|
/** Compute the cross product of vectors from from indexed origin to indexed targets i and j */
|
|
527
545
|
crossProductIndexIndexIndex(originIndex, targetAIndex, targetBIndex) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
546
|
+
if (this.isIndexValid(originIndex) && this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {
|
|
547
|
+
const i = originIndex * 2;
|
|
548
|
+
const j = targetAIndex * 2;
|
|
549
|
+
const k = targetBIndex * 2;
|
|
550
|
+
const data = this._data;
|
|
533
551
|
return Geometry.crossProductXYXY(data[j] - data[i], data[j + 1] - data[i + 1], data[k] - data[i], data[k + 1] - data[i + 1]);
|
|
552
|
+
}
|
|
534
553
|
return undefined;
|
|
535
554
|
}
|
|
536
555
|
/** Compute the cross product of vectors from from origin to indexed targets i and j */
|
|
537
556
|
crossProductXAndYIndexIndex(origin, targetAIndex, targetBIndex) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
557
|
+
if (this.isIndexValid(targetAIndex) && this.isIndexValid(targetBIndex)) {
|
|
558
|
+
const j = targetAIndex * 2;
|
|
559
|
+
const k = targetBIndex * 2;
|
|
560
|
+
const data = this._data;
|
|
542
561
|
return Geometry.crossProductXYXY(data[j] - origin.x, data[j + 1] - origin.y, data[k] - origin.x, data[k + 1] - origin.y);
|
|
562
|
+
}
|
|
543
563
|
return undefined;
|
|
544
564
|
}
|
|
545
565
|
/** Return the distance between two points in the array. */
|