@bitbybit-dev/base 0.20.13 → 0.20.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.
- package/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/inputs/lists-inputs.d.ts +39 -0
- package/lib/api/inputs/lists-inputs.js +43 -0
- package/lib/api/inputs/math-inputs.d.ts +154 -0
- package/lib/api/inputs/math-inputs.js +217 -0
- package/lib/api/inputs/text-inputs.d.ts +139 -0
- package/lib/api/inputs/text-inputs.js +215 -0
- package/lib/api/inputs/vector-inputs.d.ts +8 -0
- package/lib/api/inputs/vector-inputs.js +8 -0
- package/lib/api/services/color.d.ts +27 -12
- package/lib/api/services/color.js +27 -12
- package/lib/api/services/dates.d.ts +62 -30
- package/lib/api/services/dates.js +62 -30
- package/lib/api/services/geometry-helper.d.ts +50 -0
- package/lib/api/services/geometry-helper.js +50 -2
- package/lib/api/services/helpers/dxf/dxf.d.ts +19 -9
- package/lib/api/services/helpers/dxf/dxf.js +19 -9
- package/lib/api/services/line.d.ts +34 -16
- package/lib/api/services/line.js +34 -16
- package/lib/api/services/lists.d.ts +175 -32
- package/lib/api/services/lists.js +275 -32
- package/lib/api/services/logic.d.ts +24 -13
- package/lib/api/services/logic.js +24 -13
- package/lib/api/services/math.d.ts +180 -35
- package/lib/api/services/math.js +215 -35
- package/lib/api/services/mesh.d.ts +17 -6
- package/lib/api/services/mesh.js +17 -6
- package/lib/api/services/point.d.ts +63 -32
- package/lib/api/services/point.js +63 -32
- package/lib/api/services/polyline.d.ts +27 -11
- package/lib/api/services/polyline.js +27 -11
- package/lib/api/services/text.d.ts +286 -7
- package/lib/api/services/text.js +350 -7
- package/lib/api/services/transforms.d.ts +30 -16
- package/lib/api/services/transforms.js +30 -16
- package/lib/api/services/vector.d.ts +85 -38
- package/lib/api/services/vector.js +87 -38
- package/package.json +1 -1
package/lib/api/services/text.js
CHANGED
|
@@ -8,7 +8,8 @@ export class TextBitByBit {
|
|
|
8
8
|
this.point = point;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Creates a text
|
|
11
|
+
* Creates and returns a text string (pass-through for text input).
|
|
12
|
+
* Example: text='Hello World' → 'Hello World'
|
|
12
13
|
* @param inputs a text
|
|
13
14
|
* @returns text
|
|
14
15
|
* @group create
|
|
@@ -19,7 +20,8 @@ export class TextBitByBit {
|
|
|
19
20
|
return inputs.text;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Splits text into multiple pieces using a separator string.
|
|
24
|
+
* Example: text='apple,banana,cherry', separator=',' → ['apple', 'banana', 'cherry']
|
|
23
25
|
* @param inputs a text
|
|
24
26
|
* @returns text
|
|
25
27
|
* @group transform
|
|
@@ -30,7 +32,8 @@ export class TextBitByBit {
|
|
|
30
32
|
return inputs.text.split(inputs.separator);
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* Replaces all occurrences of a search string with a replacement string.
|
|
36
|
+
* Example: text='hello hello', search='hello', replaceWith='hi' → 'hi hi'
|
|
34
37
|
* @param inputs a text
|
|
35
38
|
* @returns text
|
|
36
39
|
* @group transform
|
|
@@ -41,7 +44,8 @@ export class TextBitByBit {
|
|
|
41
44
|
return inputs.text.split(inputs.search).join(inputs.replaceWith);
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
|
-
*
|
|
47
|
+
* Joins multiple items into a single text string using a separator.
|
|
48
|
+
* Example: list=['apple', 'banana', 'cherry'], separator=', ' → 'apple, banana, cherry'
|
|
45
49
|
* @param inputs a list of items
|
|
46
50
|
* @returns text
|
|
47
51
|
* @group transform
|
|
@@ -74,7 +78,8 @@ export class TextBitByBit {
|
|
|
74
78
|
return inputs.list.map(i => i.toString());
|
|
75
79
|
}
|
|
76
80
|
/**
|
|
77
|
-
*
|
|
81
|
+
* Formats text with placeholder values using {0}, {1}, etc. syntax.
|
|
82
|
+
* Example: text='Point: ({0}, {1})', values=[10, 5] → 'Point: (10, 5)'
|
|
78
83
|
* @param inputs a text and values
|
|
79
84
|
* @returns formatted text
|
|
80
85
|
* @group transform
|
|
@@ -87,7 +92,343 @@ export class TextBitByBit {
|
|
|
87
92
|
});
|
|
88
93
|
}
|
|
89
94
|
/**
|
|
90
|
-
*
|
|
95
|
+
* Checks if text contains a search string.
|
|
96
|
+
* Example: text='hello world', search='world' → true
|
|
97
|
+
* @param inputs a text and search string
|
|
98
|
+
* @returns boolean
|
|
99
|
+
* @group query
|
|
100
|
+
* @shortname includes
|
|
101
|
+
* @drawable false
|
|
102
|
+
*/
|
|
103
|
+
includes(inputs) {
|
|
104
|
+
return inputs.text.includes(inputs.search);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Checks if text starts with a search string.
|
|
108
|
+
* Example: text='hello world', search='hello' → true
|
|
109
|
+
* @param inputs a text and search string
|
|
110
|
+
* @returns boolean
|
|
111
|
+
* @group query
|
|
112
|
+
* @shortname starts with
|
|
113
|
+
* @drawable false
|
|
114
|
+
*/
|
|
115
|
+
startsWith(inputs) {
|
|
116
|
+
return inputs.text.startsWith(inputs.search);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Checks if text ends with a search string.
|
|
120
|
+
* Example: text='hello world', search='world' → true
|
|
121
|
+
* @param inputs a text and search string
|
|
122
|
+
* @returns boolean
|
|
123
|
+
* @group query
|
|
124
|
+
* @shortname ends with
|
|
125
|
+
* @drawable false
|
|
126
|
+
*/
|
|
127
|
+
endsWith(inputs) {
|
|
128
|
+
return inputs.text.endsWith(inputs.search);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Returns the index of the first occurrence of a search string.
|
|
132
|
+
* Example: text='hello world', search='world' → 6
|
|
133
|
+
* @param inputs a text and search string
|
|
134
|
+
* @returns index or -1 if not found
|
|
135
|
+
* @group query
|
|
136
|
+
* @shortname index of
|
|
137
|
+
* @drawable false
|
|
138
|
+
*/
|
|
139
|
+
indexOf(inputs) {
|
|
140
|
+
return inputs.text.indexOf(inputs.search);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Returns the index of the last occurrence of a search string.
|
|
144
|
+
* Example: text='hello world hello', search='hello' → 12
|
|
145
|
+
* @param inputs a text and search string
|
|
146
|
+
* @returns index or -1 if not found
|
|
147
|
+
* @group query
|
|
148
|
+
* @shortname last index of
|
|
149
|
+
* @drawable false
|
|
150
|
+
*/
|
|
151
|
+
lastIndexOf(inputs) {
|
|
152
|
+
return inputs.text.lastIndexOf(inputs.search);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Extracts a section of text between two indices.
|
|
156
|
+
* Example: text='hello world', start=0, end=5 → 'hello'
|
|
157
|
+
* @param inputs a text, start and end indices
|
|
158
|
+
* @returns extracted text
|
|
159
|
+
* @group transform
|
|
160
|
+
* @shortname substring
|
|
161
|
+
* @drawable false
|
|
162
|
+
*/
|
|
163
|
+
substring(inputs) {
|
|
164
|
+
return inputs.text.substring(inputs.start, inputs.end);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Extracts a section of text and returns a new string.
|
|
168
|
+
* Example: text='hello world', start=0, end=5 → 'hello'
|
|
169
|
+
* @param inputs a text, start and end indices
|
|
170
|
+
* @returns extracted text
|
|
171
|
+
* @group transform
|
|
172
|
+
* @shortname slice
|
|
173
|
+
* @drawable false
|
|
174
|
+
*/
|
|
175
|
+
slice(inputs) {
|
|
176
|
+
return inputs.text.slice(inputs.start, inputs.end);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Returns the character at the specified index.
|
|
180
|
+
* Example: text='hello', index=1 → 'e'
|
|
181
|
+
* @param inputs a text and index
|
|
182
|
+
* @returns character
|
|
183
|
+
* @group query
|
|
184
|
+
* @shortname char at
|
|
185
|
+
* @drawable false
|
|
186
|
+
*/
|
|
187
|
+
charAt(inputs) {
|
|
188
|
+
return inputs.text.charAt(inputs.index);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Removes whitespace from both ends of text.
|
|
192
|
+
* Example: text=' hello ' → 'hello'
|
|
193
|
+
* @param inputs a text
|
|
194
|
+
* @returns trimmed text
|
|
195
|
+
* @group transform
|
|
196
|
+
* @shortname trim
|
|
197
|
+
* @drawable false
|
|
198
|
+
*/
|
|
199
|
+
trim(inputs) {
|
|
200
|
+
return inputs.text.trim();
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Removes whitespace from the start of text.
|
|
204
|
+
* Example: text=' hello ' → 'hello '
|
|
205
|
+
* @param inputs a text
|
|
206
|
+
* @returns trimmed text
|
|
207
|
+
* @group transform
|
|
208
|
+
* @shortname trim start
|
|
209
|
+
* @drawable false
|
|
210
|
+
*/
|
|
211
|
+
trimStart(inputs) {
|
|
212
|
+
return inputs.text.trimStart();
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Removes whitespace from the end of text.
|
|
216
|
+
* Example: text=' hello ' → ' hello'
|
|
217
|
+
* @param inputs a text
|
|
218
|
+
* @returns trimmed text
|
|
219
|
+
* @group transform
|
|
220
|
+
* @shortname trim end
|
|
221
|
+
* @drawable false
|
|
222
|
+
*/
|
|
223
|
+
trimEnd(inputs) {
|
|
224
|
+
return inputs.text.trimEnd();
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Pads text from the start to reach target length.
|
|
228
|
+
* Example: text='x', length=3, padString='a' → 'aax'
|
|
229
|
+
* @param inputs a text, target length and pad string
|
|
230
|
+
* @returns padded text
|
|
231
|
+
* @group transform
|
|
232
|
+
* @shortname pad start
|
|
233
|
+
* @drawable false
|
|
234
|
+
*/
|
|
235
|
+
padStart(inputs) {
|
|
236
|
+
return inputs.text.padStart(inputs.length, inputs.padString);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Pads text from the end to reach target length.
|
|
240
|
+
* Example: text='x', length=3, padString='a' → 'xaa'
|
|
241
|
+
* @param inputs a text, target length and pad string
|
|
242
|
+
* @returns padded text
|
|
243
|
+
* @group transform
|
|
244
|
+
* @shortname pad end
|
|
245
|
+
* @drawable false
|
|
246
|
+
*/
|
|
247
|
+
padEnd(inputs) {
|
|
248
|
+
return inputs.text.padEnd(inputs.length, inputs.padString);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Converts text to uppercase.
|
|
252
|
+
* Example: text='hello' → 'HELLO'
|
|
253
|
+
* @param inputs a text
|
|
254
|
+
* @returns uppercase text
|
|
255
|
+
* @group transform
|
|
256
|
+
* @shortname to upper case
|
|
257
|
+
* @drawable false
|
|
258
|
+
*/
|
|
259
|
+
toUpperCase(inputs) {
|
|
260
|
+
return inputs.text.toUpperCase();
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Converts text to lowercase.
|
|
264
|
+
* Example: text='HELLO' → 'hello'
|
|
265
|
+
* @param inputs a text
|
|
266
|
+
* @returns lowercase text
|
|
267
|
+
* @group transform
|
|
268
|
+
* @shortname to lower case
|
|
269
|
+
* @drawable false
|
|
270
|
+
*/
|
|
271
|
+
toLowerCase(inputs) {
|
|
272
|
+
return inputs.text.toLowerCase();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Capitalizes the first character of text.
|
|
276
|
+
* Example: text='hello world' → 'Hello world'
|
|
277
|
+
* @param inputs a text
|
|
278
|
+
* @returns text with first character uppercase
|
|
279
|
+
* @group transform
|
|
280
|
+
* @shortname capitalize first
|
|
281
|
+
* @drawable false
|
|
282
|
+
*/
|
|
283
|
+
toUpperCaseFirst(inputs) {
|
|
284
|
+
if (!inputs.text)
|
|
285
|
+
return inputs.text;
|
|
286
|
+
return inputs.text.charAt(0).toUpperCase() + inputs.text.slice(1);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Lowercases the first character of text.
|
|
290
|
+
* Example: text='Hello World' → 'hello World'
|
|
291
|
+
* @param inputs a text
|
|
292
|
+
* @returns text with first character lowercase
|
|
293
|
+
* @group transform
|
|
294
|
+
* @shortname uncapitalize first
|
|
295
|
+
* @drawable false
|
|
296
|
+
*/
|
|
297
|
+
toLowerCaseFirst(inputs) {
|
|
298
|
+
if (!inputs.text)
|
|
299
|
+
return inputs.text;
|
|
300
|
+
return inputs.text.charAt(0).toLowerCase() + inputs.text.slice(1);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Repeats text a specified number of times.
|
|
304
|
+
* Example: text='ha', count=3 → 'hahaha'
|
|
305
|
+
* @param inputs a text and count
|
|
306
|
+
* @returns repeated text
|
|
307
|
+
* @group transform
|
|
308
|
+
* @shortname repeat
|
|
309
|
+
* @drawable false
|
|
310
|
+
*/
|
|
311
|
+
repeat(inputs) {
|
|
312
|
+
return inputs.text.repeat(inputs.count);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Reverses the characters in text.
|
|
316
|
+
* Example: text='hello' → 'olleh'
|
|
317
|
+
* @param inputs a text
|
|
318
|
+
* @returns reversed text
|
|
319
|
+
* @group transform
|
|
320
|
+
* @shortname reverse
|
|
321
|
+
* @drawable false
|
|
322
|
+
*/
|
|
323
|
+
reverse(inputs) {
|
|
324
|
+
return inputs.text.split("").reverse().join("");
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Returns the length of text.
|
|
328
|
+
* Example: text='hello' → 5
|
|
329
|
+
* @param inputs a text
|
|
330
|
+
* @returns length
|
|
331
|
+
* @group query
|
|
332
|
+
* @shortname length
|
|
333
|
+
* @drawable false
|
|
334
|
+
*/
|
|
335
|
+
length(inputs) {
|
|
336
|
+
return inputs.text.length;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Checks if text is empty or only whitespace.
|
|
340
|
+
* Example: text=' ' → true
|
|
341
|
+
* @param inputs a text
|
|
342
|
+
* @returns boolean
|
|
343
|
+
* @group query
|
|
344
|
+
* @shortname is empty
|
|
345
|
+
* @drawable false
|
|
346
|
+
*/
|
|
347
|
+
isEmpty(inputs) {
|
|
348
|
+
return !inputs.text || inputs.text.trim().length === 0;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Concatenates multiple text strings.
|
|
352
|
+
* Example: texts=['hello', ' ', 'world'] → 'hello world'
|
|
353
|
+
* @param inputs array of texts
|
|
354
|
+
* @returns concatenated text
|
|
355
|
+
* @group transform
|
|
356
|
+
* @shortname concat
|
|
357
|
+
* @drawable false
|
|
358
|
+
*/
|
|
359
|
+
concat(inputs) {
|
|
360
|
+
return inputs.texts.join("");
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Tests if text matches a regular expression pattern.
|
|
364
|
+
* Example: text='hello123', pattern='[0-9]+' → true
|
|
365
|
+
* @param inputs a text and regex pattern
|
|
366
|
+
* @returns boolean
|
|
367
|
+
* @group regex
|
|
368
|
+
* @shortname test regex
|
|
369
|
+
* @drawable false
|
|
370
|
+
*/
|
|
371
|
+
regexTest(inputs) {
|
|
372
|
+
const regex = new RegExp(inputs.pattern, inputs.flags);
|
|
373
|
+
return regex.test(inputs.text);
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Matches text against a regular expression and returns matches.
|
|
377
|
+
* Example: text='hello123world456', pattern='[0-9]+', flags='g' → ['123', '456']
|
|
378
|
+
* @param inputs a text and regex pattern
|
|
379
|
+
* @returns array of matches or null
|
|
380
|
+
* @group regex
|
|
381
|
+
* @shortname regex match
|
|
382
|
+
* @drawable false
|
|
383
|
+
*/
|
|
384
|
+
regexMatch(inputs) {
|
|
385
|
+
const regex = new RegExp(inputs.pattern, inputs.flags);
|
|
386
|
+
const result = inputs.text.match(regex);
|
|
387
|
+
return result ? Array.from(result) : null;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Replaces text matching a regular expression pattern.
|
|
391
|
+
* Example: text='hello123world456', pattern='[0-9]+', flags='g', replaceWith='X' → 'helloXworldX'
|
|
392
|
+
* @param inputs a text, regex pattern, and replacement
|
|
393
|
+
* @returns text with replacements
|
|
394
|
+
* @group regex
|
|
395
|
+
* @shortname regex replace
|
|
396
|
+
* @drawable false
|
|
397
|
+
*/
|
|
398
|
+
regexReplace(inputs) {
|
|
399
|
+
const regex = new RegExp(inputs.pattern, inputs.flags);
|
|
400
|
+
return inputs.text.replace(regex, inputs.replaceWith);
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Searches text for a regular expression pattern and returns the index.
|
|
404
|
+
* Example: text='hello123', pattern='[0-9]+' → 5
|
|
405
|
+
* @param inputs a text and regex pattern
|
|
406
|
+
* @returns index or -1 if not found
|
|
407
|
+
* @group regex
|
|
408
|
+
* @shortname regex search
|
|
409
|
+
* @drawable false
|
|
410
|
+
*/
|
|
411
|
+
regexSearch(inputs) {
|
|
412
|
+
const regex = new RegExp(inputs.pattern, inputs.flags);
|
|
413
|
+
return inputs.text.search(regex);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Splits text using a regular expression pattern.
|
|
417
|
+
* Example: text='a1b2c3', pattern='[0-9]+' → ['a', 'b', 'c']
|
|
418
|
+
* @param inputs a text and regex pattern
|
|
419
|
+
* @returns array of split strings
|
|
420
|
+
* @group regex
|
|
421
|
+
* @shortname regex split
|
|
422
|
+
* @drawable false
|
|
423
|
+
*/
|
|
424
|
+
regexSplit(inputs) {
|
|
425
|
+
const regex = new RegExp(inputs.pattern, inputs.flags);
|
|
426
|
+
return inputs.text.split(regex);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Converts a character to vector paths (polylines) with width and height data for rendering.
|
|
430
|
+
* Uses simplex stroke font to generate 2D line segments representing the character shape.
|
|
431
|
+
* Example: char='A', height=10 → {width:8, height:10, paths:[[points forming A shape]]}
|
|
91
432
|
* @param inputs a text
|
|
92
433
|
* @returns width, height and segments as json
|
|
93
434
|
* @group vector
|
|
@@ -123,7 +464,9 @@ export class TextBitByBit {
|
|
|
123
464
|
return { width, height, paths };
|
|
124
465
|
}
|
|
125
466
|
/**
|
|
126
|
-
*
|
|
467
|
+
* Converts multi-line text to vector paths (polylines) with alignment and spacing controls.
|
|
468
|
+
* Supports line breaks, letter spacing, line spacing, horizontal alignment, and origin centering.
|
|
469
|
+
* Example: text='Hello\nWorld', height=10, align=center → [{line1 chars}, {line2 chars}]
|
|
127
470
|
* @param inputs a text as string
|
|
128
471
|
* @returns segments
|
|
129
472
|
* @group vector
|
|
@@ -12,7 +12,9 @@ export declare class Transforms {
|
|
|
12
12
|
private readonly math;
|
|
13
13
|
constructor(vector: Vector, math: MathBitByBit);
|
|
14
14
|
/**
|
|
15
|
-
* Creates
|
|
15
|
+
* Creates rotation transformations around a center point and custom axis.
|
|
16
|
+
* Combines translation to origin, axis rotation, then translation back.
|
|
17
|
+
* Example: center=[5,0,0], axis=[0,1,0], angle=90° → rotates around vertical axis through point [5,0,0]
|
|
16
18
|
* @param inputs Rotation around center with an axis information
|
|
17
19
|
* @returns array of transformations
|
|
18
20
|
* @group rotation
|
|
@@ -21,7 +23,8 @@ export declare class Transforms {
|
|
|
21
23
|
*/
|
|
22
24
|
rotationCenterAxis(inputs: Inputs.Transforms.RotationCenterAxisDto): Base.TransformMatrixes;
|
|
23
25
|
/**
|
|
24
|
-
* Creates
|
|
26
|
+
* Creates rotation transformations around a center point along the X axis.
|
|
27
|
+
* Example: center=[5,5,5], angle=90° → rotates 90° around X axis through point [5,5,5]
|
|
25
28
|
* @param inputs Rotation around center with an X axis information
|
|
26
29
|
* @returns array of transformations
|
|
27
30
|
* @group rotation
|
|
@@ -30,7 +33,8 @@ export declare class Transforms {
|
|
|
30
33
|
*/
|
|
31
34
|
rotationCenterX(inputs: Inputs.Transforms.RotationCenterDto): Base.TransformMatrixes;
|
|
32
35
|
/**
|
|
33
|
-
* Creates
|
|
36
|
+
* Creates rotation transformations around a center point along the Y axis.
|
|
37
|
+
* Example: center=[0,0,0], angle=45° → rotates 45° around Y axis through origin
|
|
34
38
|
* @param inputs Rotation around center with an Y axis information
|
|
35
39
|
* @returns array of transformations
|
|
36
40
|
* @group rotation
|
|
@@ -39,7 +43,8 @@ export declare class Transforms {
|
|
|
39
43
|
*/
|
|
40
44
|
rotationCenterY(inputs: Inputs.Transforms.RotationCenterDto): Base.TransformMatrixes;
|
|
41
45
|
/**
|
|
42
|
-
* Creates
|
|
46
|
+
* Creates rotation transformations around a center point along the Z axis.
|
|
47
|
+
* Example: center=[10,10,0], angle=180° → rotates 180° around Z axis through point [10,10,0]
|
|
43
48
|
* @param inputs Rotation around center with an Z axis information
|
|
44
49
|
* @returns array of transformations
|
|
45
50
|
* @group rotation
|
|
@@ -48,7 +53,9 @@ export declare class Transforms {
|
|
|
48
53
|
*/
|
|
49
54
|
rotationCenterZ(inputs: Inputs.Transforms.RotationCenterDto): Base.TransformMatrixes;
|
|
50
55
|
/**
|
|
51
|
-
* Creates
|
|
56
|
+
* Creates rotation transformations using yaw-pitch-roll (Euler angles) around a center point.
|
|
57
|
+
* Yaw → Y axis rotation, Pitch → X axis rotation, Roll → Z axis rotation.
|
|
58
|
+
* Example: center=[0,0,0], yaw=90°, pitch=0°, roll=0° → rotates 90° around Y axis
|
|
52
59
|
* @param inputs Yaw pitch roll rotation information
|
|
53
60
|
* @returns array of transformations
|
|
54
61
|
* @group rotation
|
|
@@ -57,16 +64,18 @@ export declare class Transforms {
|
|
|
57
64
|
*/
|
|
58
65
|
rotationCenterYawPitchRoll(inputs: Inputs.Transforms.RotationCenterYawPitchRollDto): Base.TransformMatrixes;
|
|
59
66
|
/**
|
|
60
|
-
*
|
|
67
|
+
* Creates non-uniform scale transformation around a center point (different scale per axis).
|
|
68
|
+
* Example: center=[5,5,5], scaleXyz=[2,1,0.5] → doubles X, keeps Y, halves Z around point [5,5,5]
|
|
61
69
|
* @param inputs Scale center xyz trnansformation
|
|
62
70
|
* @returns array of transformations
|
|
63
|
-
* @group
|
|
71
|
+
* @group scale
|
|
64
72
|
* @shortname center xyz
|
|
65
73
|
* @drawable false
|
|
66
74
|
*/
|
|
67
75
|
scaleCenterXYZ(inputs: Inputs.Transforms.ScaleCenterXYZDto): Base.TransformMatrixes;
|
|
68
76
|
/**
|
|
69
|
-
* Creates
|
|
77
|
+
* Creates non-uniform scale transformation from origin (different scale per axis).
|
|
78
|
+
* Example: scaleXyz=[2,3,1] → doubles X, triples Y, keeps Z unchanged
|
|
70
79
|
* @param inputs Scale XYZ number array information
|
|
71
80
|
* @returns transformation
|
|
72
81
|
* @group scale
|
|
@@ -75,9 +84,9 @@ export declare class Transforms {
|
|
|
75
84
|
*/
|
|
76
85
|
scaleXYZ(inputs: Inputs.Transforms.ScaleXYZDto): Base.TransformMatrixes;
|
|
77
86
|
/**
|
|
78
|
-
* Creates
|
|
79
|
-
*
|
|
80
|
-
*
|
|
87
|
+
* Creates directional stretch transformation that scales along a specific direction from a center point.
|
|
88
|
+
* Points move only along the direction vector; perpendicular plane remains unchanged.
|
|
89
|
+
* Example: center=[0,0,0], direction=[1,0,0], scale=2 → stretches 2× along X axis only
|
|
81
90
|
* @param inputs Defines the center, direction, and scale factor for the stretch.
|
|
82
91
|
* @returns Array of transformations: [Translate To Origin, Stretch, Translate Back].
|
|
83
92
|
* @group scale
|
|
@@ -86,7 +95,8 @@ export declare class Transforms {
|
|
|
86
95
|
*/
|
|
87
96
|
stretchDirFromCenter(inputs: Inputs.Transforms.StretchDirCenterDto): Base.TransformMatrixes;
|
|
88
97
|
/**
|
|
89
|
-
* Creates uniform scale transformation
|
|
98
|
+
* Creates uniform scale transformation from origin (same scale on all axes).
|
|
99
|
+
* Example: scale=2 → doubles size in all directions (X, Y, Z)
|
|
90
100
|
* @param inputs Scale Dto
|
|
91
101
|
* @returns transformation
|
|
92
102
|
* @group scale
|
|
@@ -95,7 +105,8 @@ export declare class Transforms {
|
|
|
95
105
|
*/
|
|
96
106
|
uniformScale(inputs: Inputs.Transforms.UniformScaleDto): Base.TransformMatrixes;
|
|
97
107
|
/**
|
|
98
|
-
* Creates uniform scale transformation
|
|
108
|
+
* Creates uniform scale transformation around a center point (same scale on all axes).
|
|
109
|
+
* Example: center=[5,5,5], scale=0.5 → halves size in all directions around point [5,5,5]
|
|
99
110
|
* @param inputs Scale Dto with center point information
|
|
100
111
|
* @returns array of transformations
|
|
101
112
|
* @group scale
|
|
@@ -104,7 +115,8 @@ export declare class Transforms {
|
|
|
104
115
|
*/
|
|
105
116
|
uniformScaleFromCenter(inputs: Inputs.Transforms.UniformScaleFromCenterDto): Base.TransformMatrixes;
|
|
106
117
|
/**
|
|
107
|
-
* Creates
|
|
118
|
+
* Creates translation transformation (moves objects in space).
|
|
119
|
+
* Example: translation=[10,5,0] → moves object 10 units in X, 5 in Y, 0 in Z
|
|
108
120
|
* @param inputs Translation information
|
|
109
121
|
* @returns transformation
|
|
110
122
|
* @group translation
|
|
@@ -113,7 +125,8 @@ export declare class Transforms {
|
|
|
113
125
|
*/
|
|
114
126
|
translationXYZ(inputs: Inputs.Transforms.TranslationXYZDto): Base.TransformMatrixes;
|
|
115
127
|
/**
|
|
116
|
-
* Creates
|
|
128
|
+
* Creates multiple translation transformations (batch move operations).
|
|
129
|
+
* Example: translations=[[1,0,0], [0,2,0]] → generates two transforms: move +X, move +Y
|
|
117
130
|
* @param inputs Translation information
|
|
118
131
|
* @returns transformation
|
|
119
132
|
* @group translations
|
|
@@ -122,7 +135,8 @@ export declare class Transforms {
|
|
|
122
135
|
*/
|
|
123
136
|
translationsXYZ(inputs: Inputs.Transforms.TranslationsXYZDto): Base.TransformMatrixes[];
|
|
124
137
|
/**
|
|
125
|
-
* Creates
|
|
138
|
+
* Creates identity transformation matrix (no transformation - leaves objects unchanged).
|
|
139
|
+
* Returns 4×4 matrix: [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
|
|
126
140
|
* @returns transformation
|
|
127
141
|
* @group identity
|
|
128
142
|
* @shortname identity
|
|
@@ -9,7 +9,9 @@ export class Transforms {
|
|
|
9
9
|
this.math = math;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Creates
|
|
12
|
+
* Creates rotation transformations around a center point and custom axis.
|
|
13
|
+
* Combines translation to origin, axis rotation, then translation back.
|
|
14
|
+
* Example: center=[5,0,0], axis=[0,1,0], angle=90° → rotates around vertical axis through point [5,0,0]
|
|
13
15
|
* @param inputs Rotation around center with an axis information
|
|
14
16
|
* @returns array of transformations
|
|
15
17
|
* @group rotation
|
|
@@ -24,7 +26,8 @@ export class Transforms {
|
|
|
24
26
|
];
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
* Creates
|
|
29
|
+
* Creates rotation transformations around a center point along the X axis.
|
|
30
|
+
* Example: center=[5,5,5], angle=90° → rotates 90° around X axis through point [5,5,5]
|
|
28
31
|
* @param inputs Rotation around center with an X axis information
|
|
29
32
|
* @returns array of transformations
|
|
30
33
|
* @group rotation
|
|
@@ -39,7 +42,8 @@ export class Transforms {
|
|
|
39
42
|
];
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
|
-
* Creates
|
|
45
|
+
* Creates rotation transformations around a center point along the Y axis.
|
|
46
|
+
* Example: center=[0,0,0], angle=45° → rotates 45° around Y axis through origin
|
|
43
47
|
* @param inputs Rotation around center with an Y axis information
|
|
44
48
|
* @returns array of transformations
|
|
45
49
|
* @group rotation
|
|
@@ -54,7 +58,8 @@ export class Transforms {
|
|
|
54
58
|
];
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
57
|
-
* Creates
|
|
61
|
+
* Creates rotation transformations around a center point along the Z axis.
|
|
62
|
+
* Example: center=[10,10,0], angle=180° → rotates 180° around Z axis through point [10,10,0]
|
|
58
63
|
* @param inputs Rotation around center with an Z axis information
|
|
59
64
|
* @returns array of transformations
|
|
60
65
|
* @group rotation
|
|
@@ -69,7 +74,9 @@ export class Transforms {
|
|
|
69
74
|
];
|
|
70
75
|
}
|
|
71
76
|
/**
|
|
72
|
-
* Creates
|
|
77
|
+
* Creates rotation transformations using yaw-pitch-roll (Euler angles) around a center point.
|
|
78
|
+
* Yaw → Y axis rotation, Pitch → X axis rotation, Roll → Z axis rotation.
|
|
79
|
+
* Example: center=[0,0,0], yaw=90°, pitch=0°, roll=0° → rotates 90° around Y axis
|
|
73
80
|
* @param inputs Yaw pitch roll rotation information
|
|
74
81
|
* @returns array of transformations
|
|
75
82
|
* @group rotation
|
|
@@ -84,10 +91,11 @@ export class Transforms {
|
|
|
84
91
|
];
|
|
85
92
|
}
|
|
86
93
|
/**
|
|
87
|
-
*
|
|
94
|
+
* Creates non-uniform scale transformation around a center point (different scale per axis).
|
|
95
|
+
* Example: center=[5,5,5], scaleXyz=[2,1,0.5] → doubles X, keeps Y, halves Z around point [5,5,5]
|
|
88
96
|
* @param inputs Scale center xyz trnansformation
|
|
89
97
|
* @returns array of transformations
|
|
90
|
-
* @group
|
|
98
|
+
* @group scale
|
|
91
99
|
* @shortname center xyz
|
|
92
100
|
* @drawable false
|
|
93
101
|
*/
|
|
@@ -99,7 +107,8 @@ export class Transforms {
|
|
|
99
107
|
];
|
|
100
108
|
}
|
|
101
109
|
/**
|
|
102
|
-
* Creates
|
|
110
|
+
* Creates non-uniform scale transformation from origin (different scale per axis).
|
|
111
|
+
* Example: scaleXyz=[2,3,1] → doubles X, triples Y, keeps Z unchanged
|
|
103
112
|
* @param inputs Scale XYZ number array information
|
|
104
113
|
* @returns transformation
|
|
105
114
|
* @group scale
|
|
@@ -110,9 +119,9 @@ export class Transforms {
|
|
|
110
119
|
return [this.scaling(inputs.scaleXyz[0], inputs.scaleXyz[1], inputs.scaleXyz[2])];
|
|
111
120
|
}
|
|
112
121
|
/**
|
|
113
|
-
* Creates
|
|
114
|
-
*
|
|
115
|
-
*
|
|
122
|
+
* Creates directional stretch transformation that scales along a specific direction from a center point.
|
|
123
|
+
* Points move only along the direction vector; perpendicular plane remains unchanged.
|
|
124
|
+
* Example: center=[0,0,0], direction=[1,0,0], scale=2 → stretches 2× along X axis only
|
|
116
125
|
* @param inputs Defines the center, direction, and scale factor for the stretch.
|
|
117
126
|
* @returns Array of transformations: [Translate To Origin, Stretch, Translate Back].
|
|
118
127
|
* @group scale
|
|
@@ -127,7 +136,8 @@ export class Transforms {
|
|
|
127
136
|
];
|
|
128
137
|
}
|
|
129
138
|
/**
|
|
130
|
-
* Creates uniform scale transformation
|
|
139
|
+
* Creates uniform scale transformation from origin (same scale on all axes).
|
|
140
|
+
* Example: scale=2 → doubles size in all directions (X, Y, Z)
|
|
131
141
|
* @param inputs Scale Dto
|
|
132
142
|
* @returns transformation
|
|
133
143
|
* @group scale
|
|
@@ -138,7 +148,8 @@ export class Transforms {
|
|
|
138
148
|
return [this.scaling(inputs.scale, inputs.scale, inputs.scale)];
|
|
139
149
|
}
|
|
140
150
|
/**
|
|
141
|
-
* Creates uniform scale transformation
|
|
151
|
+
* Creates uniform scale transformation around a center point (same scale on all axes).
|
|
152
|
+
* Example: center=[5,5,5], scale=0.5 → halves size in all directions around point [5,5,5]
|
|
142
153
|
* @param inputs Scale Dto with center point information
|
|
143
154
|
* @returns array of transformations
|
|
144
155
|
* @group scale
|
|
@@ -153,7 +164,8 @@ export class Transforms {
|
|
|
153
164
|
];
|
|
154
165
|
}
|
|
155
166
|
/**
|
|
156
|
-
* Creates
|
|
167
|
+
* Creates translation transformation (moves objects in space).
|
|
168
|
+
* Example: translation=[10,5,0] → moves object 10 units in X, 5 in Y, 0 in Z
|
|
157
169
|
* @param inputs Translation information
|
|
158
170
|
* @returns transformation
|
|
159
171
|
* @group translation
|
|
@@ -164,7 +176,8 @@ export class Transforms {
|
|
|
164
176
|
return [this.translation(inputs.translation[0], inputs.translation[1], inputs.translation[2])];
|
|
165
177
|
}
|
|
166
178
|
/**
|
|
167
|
-
* Creates
|
|
179
|
+
* Creates multiple translation transformations (batch move operations).
|
|
180
|
+
* Example: translations=[[1,0,0], [0,2,0]] → generates two transforms: move +X, move +Y
|
|
168
181
|
* @param inputs Translation information
|
|
169
182
|
* @returns transformation
|
|
170
183
|
* @group translations
|
|
@@ -175,7 +188,8 @@ export class Transforms {
|
|
|
175
188
|
return inputs.translations.map(translation => [this.translation(translation[0], translation[1], translation[2])]);
|
|
176
189
|
}
|
|
177
190
|
/**
|
|
178
|
-
* Creates
|
|
191
|
+
* Creates identity transformation matrix (no transformation - leaves objects unchanged).
|
|
192
|
+
* Returns 4×4 matrix: [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
|
|
179
193
|
* @returns transformation
|
|
180
194
|
* @group identity
|
|
181
195
|
* @shortname identity
|