@bitbybit-dev/base 0.20.13 → 0.21.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.
- 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
|
@@ -4,7 +4,8 @@ import * as Inputs from "../inputs";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class Dates {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Converts date to human-readable date string (excludes time).
|
|
8
|
+
* Example: Date(2024,0,15,14,30) → 'Mon Jan 15 2024'
|
|
8
9
|
* @param inputs a date
|
|
9
10
|
* @returns date as string
|
|
10
11
|
* @group convert
|
|
@@ -13,7 +14,8 @@ export declare class Dates {
|
|
|
13
14
|
*/
|
|
14
15
|
toDateString(inputs: Inputs.Dates.DateDto): string;
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* Converts date to ISO 8601 format string (standard format for APIs and data interchange).
|
|
18
|
+
* Example: Date(2024,0,15,14,30,45) → '2024-01-15T14:30:45.000Z'
|
|
17
19
|
* @param inputs a date
|
|
18
20
|
* @returns date as string
|
|
19
21
|
* @group convert
|
|
@@ -22,7 +24,8 @@ export declare class Dates {
|
|
|
22
24
|
*/
|
|
23
25
|
toISOString(inputs: Inputs.Dates.DateDto): string;
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
27
|
+
* Converts date to JSON-compatible string (same as ISO format, used in JSON.stringify).
|
|
28
|
+
* Example: Date(2024,0,15,14,30) → '2024-01-15T14:30:00.000Z'
|
|
26
29
|
* @param inputs a date
|
|
27
30
|
* @returns date as string
|
|
28
31
|
* @group convert
|
|
@@ -31,7 +34,8 @@ export declare class Dates {
|
|
|
31
34
|
*/
|
|
32
35
|
toJSON(inputs: Inputs.Dates.DateDto): string;
|
|
33
36
|
/**
|
|
34
|
-
*
|
|
37
|
+
* Converts date to full locale-specific string (includes date, time, and timezone).
|
|
38
|
+
* Example: Date(2024,0,15,14,30) → 'Mon Jan 15 2024 14:30:00 GMT+0000'
|
|
35
39
|
* @param inputs a date
|
|
36
40
|
* @returns date as string
|
|
37
41
|
* @group convert
|
|
@@ -40,7 +44,8 @@ export declare class Dates {
|
|
|
40
44
|
*/
|
|
41
45
|
toString(inputs: Inputs.Dates.DateDto): string;
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
47
|
+
* Converts date to time string (excludes date, includes timezone).
|
|
48
|
+
* Example: Date(2024,0,15,14,30,45) → '14:30:45 GMT+0000'
|
|
44
49
|
* @param inputs a date
|
|
45
50
|
* @returns time as string
|
|
46
51
|
* @group convert
|
|
@@ -49,7 +54,8 @@ export declare class Dates {
|
|
|
49
54
|
*/
|
|
50
55
|
toTimeString(inputs: Inputs.Dates.DateDto): string;
|
|
51
56
|
/**
|
|
52
|
-
*
|
|
57
|
+
* Converts date to UTC string format (Universal Coordinated Time, no timezone offset).
|
|
58
|
+
* Example: Date(2024,0,15,14,30) → 'Mon, 15 Jan 2024 14:30:00 GMT'
|
|
53
59
|
* @param inputs a date
|
|
54
60
|
* @returns date as utc string
|
|
55
61
|
* @group convert
|
|
@@ -58,7 +64,8 @@ export declare class Dates {
|
|
|
58
64
|
*/
|
|
59
65
|
toUTCString(inputs: Inputs.Dates.DateDto): string;
|
|
60
66
|
/**
|
|
61
|
-
* Returns the current date and time.
|
|
67
|
+
* Returns the current date and time at the moment of execution.
|
|
68
|
+
* Example: calling now() → Date object representing current moment (e.g., '2024-01-15T14:30:45')
|
|
62
69
|
* @returns date
|
|
63
70
|
* @group create
|
|
64
71
|
* @shortname now
|
|
@@ -66,7 +73,9 @@ export declare class Dates {
|
|
|
66
73
|
*/
|
|
67
74
|
now(): Date;
|
|
68
75
|
/**
|
|
69
|
-
* Creates a new date
|
|
76
|
+
* Creates a new date from individual components using local time.
|
|
77
|
+
* Month is 0-indexed: 0=January, 11=December.
|
|
78
|
+
* Example: year=2024, month=0, day=15, hours=14, minutes=30 → Date(Jan 15, 2024 14:30)
|
|
70
79
|
* @param inputs a date
|
|
71
80
|
* @returns date
|
|
72
81
|
* @group create
|
|
@@ -75,7 +84,9 @@ export declare class Dates {
|
|
|
75
84
|
*/
|
|
76
85
|
createDate(inputs: Inputs.Dates.CreateDateDto): Date;
|
|
77
86
|
/**
|
|
78
|
-
*
|
|
87
|
+
* Creates a new date from individual components using UTC (ignores timezone).
|
|
88
|
+
* Returns milliseconds since Unix epoch (Jan 1, 1970 00:00:00 UTC).
|
|
89
|
+
* Example: year=2024, month=0, day=15 → Date representing Jan 15, 2024 00:00 UTC
|
|
79
90
|
* @param inputs a date
|
|
80
91
|
* @returns date
|
|
81
92
|
* @group create
|
|
@@ -84,7 +95,8 @@ export declare class Dates {
|
|
|
84
95
|
*/
|
|
85
96
|
createDateUTC(inputs: Inputs.Dates.CreateDateDto): Date;
|
|
86
97
|
/**
|
|
87
|
-
* Creates a
|
|
98
|
+
* Creates a date from Unix timestamp (milliseconds since Jan 1, 1970 UTC).
|
|
99
|
+
* Example: unixTimeStamp=1705329000000 → Date(Jan 15, 2024 14:30:00)
|
|
88
100
|
* @param inputs a unix time stamp
|
|
89
101
|
* @returns date
|
|
90
102
|
* @group create
|
|
@@ -93,7 +105,8 @@ export declare class Dates {
|
|
|
93
105
|
*/
|
|
94
106
|
createFromUnixTimeStamp(inputs: Inputs.Dates.CreateFromUnixTimeStampDto): Date;
|
|
95
107
|
/**
|
|
96
|
-
* Parses a string
|
|
108
|
+
* Parses a date string and returns Unix timestamp (milliseconds since Jan 1, 1970 UTC).
|
|
109
|
+
* Example: dateString='2024-01-15' → 1705276800000
|
|
97
110
|
* @param inputs a date string
|
|
98
111
|
* @returns the number of milliseconds between that date and midnight, January 1, 1970.
|
|
99
112
|
* @group parse
|
|
@@ -102,7 +115,8 @@ export declare class Dates {
|
|
|
102
115
|
*/
|
|
103
116
|
parseDate(inputs: Inputs.Dates.DateStringDto): number;
|
|
104
117
|
/**
|
|
105
|
-
*
|
|
118
|
+
* Extracts day of the month from date (1-31) using local time.
|
|
119
|
+
* Example: Date(2024,0,15) → 15
|
|
106
120
|
* @returns date
|
|
107
121
|
* @group get
|
|
108
122
|
* @shortname get date of month
|
|
@@ -110,7 +124,8 @@ export declare class Dates {
|
|
|
110
124
|
*/
|
|
111
125
|
getDayOfMonth(inputs: Inputs.Dates.DateDto): number;
|
|
112
126
|
/**
|
|
113
|
-
*
|
|
127
|
+
* Extracts day of the week from date (0=Sunday, 6=Saturday) using local time.
|
|
128
|
+
* Example: Date(2024,0,15) → 1 (Monday)
|
|
114
129
|
* @returns day
|
|
115
130
|
* @group get
|
|
116
131
|
* @shortname get weekday
|
|
@@ -118,7 +133,8 @@ export declare class Dates {
|
|
|
118
133
|
*/
|
|
119
134
|
getWeekday(inputs: Inputs.Dates.DateDto): number;
|
|
120
135
|
/**
|
|
121
|
-
*
|
|
136
|
+
* Extracts full year from date using local time.
|
|
137
|
+
* Example: Date(2024,0,15) → 2024
|
|
122
138
|
* @returns year
|
|
123
139
|
* @group get
|
|
124
140
|
* @shortname get year
|
|
@@ -126,7 +142,8 @@ export declare class Dates {
|
|
|
126
142
|
*/
|
|
127
143
|
getYear(inputs: Inputs.Dates.DateDto): number;
|
|
128
144
|
/**
|
|
129
|
-
*
|
|
145
|
+
* Extracts month from date (0=January, 11=December) using local time.
|
|
146
|
+
* Example: Date(2024,0,15) → 0 (January)
|
|
130
147
|
* @returns month
|
|
131
148
|
* @group get
|
|
132
149
|
* @shortname get month
|
|
@@ -134,7 +151,8 @@ export declare class Dates {
|
|
|
134
151
|
*/
|
|
135
152
|
getMonth(inputs: Inputs.Dates.DateDto): number;
|
|
136
153
|
/**
|
|
137
|
-
*
|
|
154
|
+
* Extracts hours from date (0-23) using local time.
|
|
155
|
+
* Example: Date(2024,0,15,14,30) → 14
|
|
138
156
|
* @returns hours
|
|
139
157
|
* @group get
|
|
140
158
|
* @shortname get hours
|
|
@@ -142,7 +160,8 @@ export declare class Dates {
|
|
|
142
160
|
*/
|
|
143
161
|
getHours(inputs: Inputs.Dates.DateDto): number;
|
|
144
162
|
/**
|
|
145
|
-
*
|
|
163
|
+
* Extracts minutes from date (0-59) using local time.
|
|
164
|
+
* Example: Date(2024,0,15,14,30) → 30
|
|
146
165
|
* @returns minutes
|
|
147
166
|
* @group get
|
|
148
167
|
* @shortname get minutes
|
|
@@ -150,7 +169,8 @@ export declare class Dates {
|
|
|
150
169
|
*/
|
|
151
170
|
getMinutes(inputs: Inputs.Dates.DateDto): number;
|
|
152
171
|
/**
|
|
153
|
-
*
|
|
172
|
+
* Extracts seconds from date (0-59) using local time.
|
|
173
|
+
* Example: Date(2024,0,15,14,30,45) → 45
|
|
154
174
|
* @returns seconds
|
|
155
175
|
* @group get
|
|
156
176
|
* @shortname get seconds
|
|
@@ -158,7 +178,8 @@ export declare class Dates {
|
|
|
158
178
|
*/
|
|
159
179
|
getSeconds(inputs: Inputs.Dates.DateDto): number;
|
|
160
180
|
/**
|
|
161
|
-
*
|
|
181
|
+
* Extracts milliseconds from date (0-999) using local time.
|
|
182
|
+
* Example: Date(2024,0,15,14,30,45,123) → 123
|
|
162
183
|
* @returns milliseconds
|
|
163
184
|
* @group get
|
|
164
185
|
* @shortname get milliseconds
|
|
@@ -166,7 +187,8 @@ export declare class Dates {
|
|
|
166
187
|
*/
|
|
167
188
|
getMilliseconds(inputs: Inputs.Dates.DateDto): number;
|
|
168
189
|
/**
|
|
169
|
-
*
|
|
190
|
+
* Converts date to Unix timestamp (milliseconds since Jan 1, 1970 UTC).
|
|
191
|
+
* Example: Date(2024,0,15,14,30) → 1705329000000
|
|
170
192
|
* @returns time
|
|
171
193
|
* @group get
|
|
172
194
|
* @shortname get time
|
|
@@ -174,7 +196,8 @@ export declare class Dates {
|
|
|
174
196
|
*/
|
|
175
197
|
getTime(inputs: Inputs.Dates.DateDto): number;
|
|
176
198
|
/**
|
|
177
|
-
*
|
|
199
|
+
* Extracts full year from date using UTC (ignores timezone).
|
|
200
|
+
* Example: Date(2024,0,15) → 2024
|
|
178
201
|
* @returns year
|
|
179
202
|
* @group get
|
|
180
203
|
* @shortname get utc year
|
|
@@ -182,7 +205,8 @@ export declare class Dates {
|
|
|
182
205
|
*/
|
|
183
206
|
getUTCYear(inputs: Inputs.Dates.DateDto): number;
|
|
184
207
|
/**
|
|
185
|
-
*
|
|
208
|
+
* Extracts month from date (0=January, 11=December) using UTC.
|
|
209
|
+
* Example: Date.UTC(2024,0,15) → 0 (January)
|
|
186
210
|
* @returns month
|
|
187
211
|
* @group get
|
|
188
212
|
* @shortname get utc month
|
|
@@ -190,7 +214,8 @@ export declare class Dates {
|
|
|
190
214
|
*/
|
|
191
215
|
getUTCMonth(inputs: Inputs.Dates.DateDto): number;
|
|
192
216
|
/**
|
|
193
|
-
*
|
|
217
|
+
* Extracts day of the month from date (1-31) using UTC.
|
|
218
|
+
* Example: Date.UTC(2024,0,15) → 15
|
|
194
219
|
* @returns day
|
|
195
220
|
* @group get
|
|
196
221
|
* @shortname get utc day
|
|
@@ -198,7 +223,8 @@ export declare class Dates {
|
|
|
198
223
|
*/
|
|
199
224
|
getUTCDay(inputs: Inputs.Dates.DateDto): number;
|
|
200
225
|
/**
|
|
201
|
-
*
|
|
226
|
+
* Extracts hours from date (0-23) using UTC.
|
|
227
|
+
* Example: Date.UTC(2024,0,15,14) → 14
|
|
202
228
|
* @returns hours
|
|
203
229
|
* @group get
|
|
204
230
|
* @shortname get utc hours
|
|
@@ -206,7 +232,8 @@ export declare class Dates {
|
|
|
206
232
|
*/
|
|
207
233
|
getUTCHours(inputs: Inputs.Dates.DateDto): number;
|
|
208
234
|
/**
|
|
209
|
-
*
|
|
235
|
+
* Extracts minutes from date (0-59) using UTC.
|
|
236
|
+
* Example: Date.UTC(2024,0,15,14,30) → 30
|
|
210
237
|
* @returns minutes
|
|
211
238
|
* @group get
|
|
212
239
|
* @shortname get utc minutes
|
|
@@ -214,7 +241,8 @@ export declare class Dates {
|
|
|
214
241
|
*/
|
|
215
242
|
getUTCMinutes(inputs: Inputs.Dates.DateDto): number;
|
|
216
243
|
/**
|
|
217
|
-
*
|
|
244
|
+
* Extracts seconds from date (0-59) using UTC.
|
|
245
|
+
* Example: Date.UTC(2024,0,15,14,30,45) → 45
|
|
218
246
|
* @returns seconds
|
|
219
247
|
* @group get
|
|
220
248
|
* @shortname get utc seconds
|
|
@@ -222,7 +250,8 @@ export declare class Dates {
|
|
|
222
250
|
*/
|
|
223
251
|
getUTCSeconds(inputs: Inputs.Dates.DateDto): number;
|
|
224
252
|
/**
|
|
225
|
-
*
|
|
253
|
+
* Extracts milliseconds from date (0-999) using UTC.
|
|
254
|
+
* Example: Date.UTC(2024,0,15,14,30,45,123) → 123
|
|
226
255
|
* @returns milliseconds
|
|
227
256
|
* @group get
|
|
228
257
|
* @shortname get utc milliseconds
|
|
@@ -230,7 +259,8 @@ export declare class Dates {
|
|
|
230
259
|
*/
|
|
231
260
|
getUTCMilliseconds(inputs: Inputs.Dates.DateDto): number;
|
|
232
261
|
/**
|
|
233
|
-
*
|
|
262
|
+
* Creates new date with modified year (returns new date, original unchanged).
|
|
263
|
+
* Example: Date(2024,0,15) with year=2025 → Date(2025,0,15)
|
|
234
264
|
* @param inputs a date and the year
|
|
235
265
|
* @returns date
|
|
236
266
|
* @group set
|
|
@@ -239,7 +269,8 @@ export declare class Dates {
|
|
|
239
269
|
* */
|
|
240
270
|
setYear(inputs: Inputs.Dates.DateYearDto): Date;
|
|
241
271
|
/**
|
|
242
|
-
*
|
|
272
|
+
* Creates new date with modified month (0=January, 11=December, returns new date).
|
|
273
|
+
* Example: Date(2024,0,15) with month=5 → Date(2024,5,15) (June 15)
|
|
243
274
|
* @param inputs a date and the month
|
|
244
275
|
* @returns date
|
|
245
276
|
* @group set
|
|
@@ -248,7 +279,8 @@ export declare class Dates {
|
|
|
248
279
|
* */
|
|
249
280
|
setMonth(inputs: Inputs.Dates.DateMonthDto): Date;
|
|
250
281
|
/**
|
|
251
|
-
*
|
|
282
|
+
* Creates new date with modified day of month (1-31, returns new date).
|
|
283
|
+
* Example: Date(2024,0,15) with day=20 → Date(2024,0,20)
|
|
252
284
|
* @param inputs a date and the day
|
|
253
285
|
* @returns date
|
|
254
286
|
* @group set
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export class Dates {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Converts date to human-readable date string (excludes time).
|
|
7
|
+
* Example: Date(2024,0,15,14,30) → 'Mon Jan 15 2024'
|
|
7
8
|
* @param inputs a date
|
|
8
9
|
* @returns date as string
|
|
9
10
|
* @group convert
|
|
@@ -14,7 +15,8 @@ export class Dates {
|
|
|
14
15
|
return inputs.date.toDateString();
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Converts date to ISO 8601 format string (standard format for APIs and data interchange).
|
|
19
|
+
* Example: Date(2024,0,15,14,30,45) → '2024-01-15T14:30:45.000Z'
|
|
18
20
|
* @param inputs a date
|
|
19
21
|
* @returns date as string
|
|
20
22
|
* @group convert
|
|
@@ -25,7 +27,8 @@ export class Dates {
|
|
|
25
27
|
return inputs.date.toISOString();
|
|
26
28
|
}
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
30
|
+
* Converts date to JSON-compatible string (same as ISO format, used in JSON.stringify).
|
|
31
|
+
* Example: Date(2024,0,15,14,30) → '2024-01-15T14:30:00.000Z'
|
|
29
32
|
* @param inputs a date
|
|
30
33
|
* @returns date as string
|
|
31
34
|
* @group convert
|
|
@@ -36,7 +39,8 @@ export class Dates {
|
|
|
36
39
|
return inputs.date.toJSON();
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
|
-
*
|
|
42
|
+
* Converts date to full locale-specific string (includes date, time, and timezone).
|
|
43
|
+
* Example: Date(2024,0,15,14,30) → 'Mon Jan 15 2024 14:30:00 GMT+0000'
|
|
40
44
|
* @param inputs a date
|
|
41
45
|
* @returns date as string
|
|
42
46
|
* @group convert
|
|
@@ -47,7 +51,8 @@ export class Dates {
|
|
|
47
51
|
return inputs.date.toString();
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
|
-
*
|
|
54
|
+
* Converts date to time string (excludes date, includes timezone).
|
|
55
|
+
* Example: Date(2024,0,15,14,30,45) → '14:30:45 GMT+0000'
|
|
51
56
|
* @param inputs a date
|
|
52
57
|
* @returns time as string
|
|
53
58
|
* @group convert
|
|
@@ -58,7 +63,8 @@ export class Dates {
|
|
|
58
63
|
return inputs.date.toTimeString();
|
|
59
64
|
}
|
|
60
65
|
/**
|
|
61
|
-
*
|
|
66
|
+
* Converts date to UTC string format (Universal Coordinated Time, no timezone offset).
|
|
67
|
+
* Example: Date(2024,0,15,14,30) → 'Mon, 15 Jan 2024 14:30:00 GMT'
|
|
62
68
|
* @param inputs a date
|
|
63
69
|
* @returns date as utc string
|
|
64
70
|
* @group convert
|
|
@@ -69,7 +75,8 @@ export class Dates {
|
|
|
69
75
|
return inputs.date.toUTCString();
|
|
70
76
|
}
|
|
71
77
|
/**
|
|
72
|
-
* Returns the current date and time.
|
|
78
|
+
* Returns the current date and time at the moment of execution.
|
|
79
|
+
* Example: calling now() → Date object representing current moment (e.g., '2024-01-15T14:30:45')
|
|
73
80
|
* @returns date
|
|
74
81
|
* @group create
|
|
75
82
|
* @shortname now
|
|
@@ -79,7 +86,9 @@ export class Dates {
|
|
|
79
86
|
return new Date(Date.now());
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
82
|
-
* Creates a new date
|
|
89
|
+
* Creates a new date from individual components using local time.
|
|
90
|
+
* Month is 0-indexed: 0=January, 11=December.
|
|
91
|
+
* Example: year=2024, month=0, day=15, hours=14, minutes=30 → Date(Jan 15, 2024 14:30)
|
|
83
92
|
* @param inputs a date
|
|
84
93
|
* @returns date
|
|
85
94
|
* @group create
|
|
@@ -90,7 +99,9 @@ export class Dates {
|
|
|
90
99
|
return new Date(inputs.year, inputs.month, inputs.day, inputs.hours, inputs.minutes, inputs.seconds, inputs.milliseconds);
|
|
91
100
|
}
|
|
92
101
|
/**
|
|
93
|
-
*
|
|
102
|
+
* Creates a new date from individual components using UTC (ignores timezone).
|
|
103
|
+
* Returns milliseconds since Unix epoch (Jan 1, 1970 00:00:00 UTC).
|
|
104
|
+
* Example: year=2024, month=0, day=15 → Date representing Jan 15, 2024 00:00 UTC
|
|
94
105
|
* @param inputs a date
|
|
95
106
|
* @returns date
|
|
96
107
|
* @group create
|
|
@@ -101,7 +112,8 @@ export class Dates {
|
|
|
101
112
|
return new Date(Date.UTC(inputs.year, inputs.month, inputs.day, inputs.hours, inputs.minutes, inputs.seconds, inputs.milliseconds));
|
|
102
113
|
}
|
|
103
114
|
/**
|
|
104
|
-
* Creates a
|
|
115
|
+
* Creates a date from Unix timestamp (milliseconds since Jan 1, 1970 UTC).
|
|
116
|
+
* Example: unixTimeStamp=1705329000000 → Date(Jan 15, 2024 14:30:00)
|
|
105
117
|
* @param inputs a unix time stamp
|
|
106
118
|
* @returns date
|
|
107
119
|
* @group create
|
|
@@ -112,7 +124,8 @@ export class Dates {
|
|
|
112
124
|
return new Date(inputs.unixTimeStamp);
|
|
113
125
|
}
|
|
114
126
|
/**
|
|
115
|
-
* Parses a string
|
|
127
|
+
* Parses a date string and returns Unix timestamp (milliseconds since Jan 1, 1970 UTC).
|
|
128
|
+
* Example: dateString='2024-01-15' → 1705276800000
|
|
116
129
|
* @param inputs a date string
|
|
117
130
|
* @returns the number of milliseconds between that date and midnight, January 1, 1970.
|
|
118
131
|
* @group parse
|
|
@@ -123,7 +136,8 @@ export class Dates {
|
|
|
123
136
|
return Date.parse(inputs.dateString);
|
|
124
137
|
}
|
|
125
138
|
/**
|
|
126
|
-
*
|
|
139
|
+
* Extracts day of the month from date (1-31) using local time.
|
|
140
|
+
* Example: Date(2024,0,15) → 15
|
|
127
141
|
* @returns date
|
|
128
142
|
* @group get
|
|
129
143
|
* @shortname get date of month
|
|
@@ -133,7 +147,8 @@ export class Dates {
|
|
|
133
147
|
return inputs.date.getDate();
|
|
134
148
|
}
|
|
135
149
|
/**
|
|
136
|
-
*
|
|
150
|
+
* Extracts day of the week from date (0=Sunday, 6=Saturday) using local time.
|
|
151
|
+
* Example: Date(2024,0,15) → 1 (Monday)
|
|
137
152
|
* @returns day
|
|
138
153
|
* @group get
|
|
139
154
|
* @shortname get weekday
|
|
@@ -143,7 +158,8 @@ export class Dates {
|
|
|
143
158
|
return inputs.date.getDay();
|
|
144
159
|
}
|
|
145
160
|
/**
|
|
146
|
-
*
|
|
161
|
+
* Extracts full year from date using local time.
|
|
162
|
+
* Example: Date(2024,0,15) → 2024
|
|
147
163
|
* @returns year
|
|
148
164
|
* @group get
|
|
149
165
|
* @shortname get year
|
|
@@ -153,7 +169,8 @@ export class Dates {
|
|
|
153
169
|
return inputs.date.getFullYear();
|
|
154
170
|
}
|
|
155
171
|
/**
|
|
156
|
-
*
|
|
172
|
+
* Extracts month from date (0=January, 11=December) using local time.
|
|
173
|
+
* Example: Date(2024,0,15) → 0 (January)
|
|
157
174
|
* @returns month
|
|
158
175
|
* @group get
|
|
159
176
|
* @shortname get month
|
|
@@ -163,7 +180,8 @@ export class Dates {
|
|
|
163
180
|
return inputs.date.getMonth();
|
|
164
181
|
}
|
|
165
182
|
/**
|
|
166
|
-
*
|
|
183
|
+
* Extracts hours from date (0-23) using local time.
|
|
184
|
+
* Example: Date(2024,0,15,14,30) → 14
|
|
167
185
|
* @returns hours
|
|
168
186
|
* @group get
|
|
169
187
|
* @shortname get hours
|
|
@@ -173,7 +191,8 @@ export class Dates {
|
|
|
173
191
|
return inputs.date.getHours();
|
|
174
192
|
}
|
|
175
193
|
/**
|
|
176
|
-
*
|
|
194
|
+
* Extracts minutes from date (0-59) using local time.
|
|
195
|
+
* Example: Date(2024,0,15,14,30) → 30
|
|
177
196
|
* @returns minutes
|
|
178
197
|
* @group get
|
|
179
198
|
* @shortname get minutes
|
|
@@ -183,7 +202,8 @@ export class Dates {
|
|
|
183
202
|
return inputs.date.getMinutes();
|
|
184
203
|
}
|
|
185
204
|
/**
|
|
186
|
-
*
|
|
205
|
+
* Extracts seconds from date (0-59) using local time.
|
|
206
|
+
* Example: Date(2024,0,15,14,30,45) → 45
|
|
187
207
|
* @returns seconds
|
|
188
208
|
* @group get
|
|
189
209
|
* @shortname get seconds
|
|
@@ -193,7 +213,8 @@ export class Dates {
|
|
|
193
213
|
return inputs.date.getSeconds();
|
|
194
214
|
}
|
|
195
215
|
/**
|
|
196
|
-
*
|
|
216
|
+
* Extracts milliseconds from date (0-999) using local time.
|
|
217
|
+
* Example: Date(2024,0,15,14,30,45,123) → 123
|
|
197
218
|
* @returns milliseconds
|
|
198
219
|
* @group get
|
|
199
220
|
* @shortname get milliseconds
|
|
@@ -203,7 +224,8 @@ export class Dates {
|
|
|
203
224
|
return inputs.date.getMilliseconds();
|
|
204
225
|
}
|
|
205
226
|
/**
|
|
206
|
-
*
|
|
227
|
+
* Converts date to Unix timestamp (milliseconds since Jan 1, 1970 UTC).
|
|
228
|
+
* Example: Date(2024,0,15,14,30) → 1705329000000
|
|
207
229
|
* @returns time
|
|
208
230
|
* @group get
|
|
209
231
|
* @shortname get time
|
|
@@ -213,7 +235,8 @@ export class Dates {
|
|
|
213
235
|
return inputs.date.getTime();
|
|
214
236
|
}
|
|
215
237
|
/**
|
|
216
|
-
*
|
|
238
|
+
* Extracts full year from date using UTC (ignores timezone).
|
|
239
|
+
* Example: Date(2024,0,15) → 2024
|
|
217
240
|
* @returns year
|
|
218
241
|
* @group get
|
|
219
242
|
* @shortname get utc year
|
|
@@ -223,7 +246,8 @@ export class Dates {
|
|
|
223
246
|
return inputs.date.getUTCFullYear();
|
|
224
247
|
}
|
|
225
248
|
/**
|
|
226
|
-
*
|
|
249
|
+
* Extracts month from date (0=January, 11=December) using UTC.
|
|
250
|
+
* Example: Date.UTC(2024,0,15) → 0 (January)
|
|
227
251
|
* @returns month
|
|
228
252
|
* @group get
|
|
229
253
|
* @shortname get utc month
|
|
@@ -233,7 +257,8 @@ export class Dates {
|
|
|
233
257
|
return inputs.date.getUTCMonth();
|
|
234
258
|
}
|
|
235
259
|
/**
|
|
236
|
-
*
|
|
260
|
+
* Extracts day of the month from date (1-31) using UTC.
|
|
261
|
+
* Example: Date.UTC(2024,0,15) → 15
|
|
237
262
|
* @returns day
|
|
238
263
|
* @group get
|
|
239
264
|
* @shortname get utc day
|
|
@@ -243,7 +268,8 @@ export class Dates {
|
|
|
243
268
|
return inputs.date.getUTCDate();
|
|
244
269
|
}
|
|
245
270
|
/**
|
|
246
|
-
*
|
|
271
|
+
* Extracts hours from date (0-23) using UTC.
|
|
272
|
+
* Example: Date.UTC(2024,0,15,14) → 14
|
|
247
273
|
* @returns hours
|
|
248
274
|
* @group get
|
|
249
275
|
* @shortname get utc hours
|
|
@@ -253,7 +279,8 @@ export class Dates {
|
|
|
253
279
|
return inputs.date.getUTCHours();
|
|
254
280
|
}
|
|
255
281
|
/**
|
|
256
|
-
*
|
|
282
|
+
* Extracts minutes from date (0-59) using UTC.
|
|
283
|
+
* Example: Date.UTC(2024,0,15,14,30) → 30
|
|
257
284
|
* @returns minutes
|
|
258
285
|
* @group get
|
|
259
286
|
* @shortname get utc minutes
|
|
@@ -263,7 +290,8 @@ export class Dates {
|
|
|
263
290
|
return inputs.date.getUTCMinutes();
|
|
264
291
|
}
|
|
265
292
|
/**
|
|
266
|
-
*
|
|
293
|
+
* Extracts seconds from date (0-59) using UTC.
|
|
294
|
+
* Example: Date.UTC(2024,0,15,14,30,45) → 45
|
|
267
295
|
* @returns seconds
|
|
268
296
|
* @group get
|
|
269
297
|
* @shortname get utc seconds
|
|
@@ -273,7 +301,8 @@ export class Dates {
|
|
|
273
301
|
return inputs.date.getUTCSeconds();
|
|
274
302
|
}
|
|
275
303
|
/**
|
|
276
|
-
*
|
|
304
|
+
* Extracts milliseconds from date (0-999) using UTC.
|
|
305
|
+
* Example: Date.UTC(2024,0,15,14,30,45,123) → 123
|
|
277
306
|
* @returns milliseconds
|
|
278
307
|
* @group get
|
|
279
308
|
* @shortname get utc milliseconds
|
|
@@ -283,7 +312,8 @@ export class Dates {
|
|
|
283
312
|
return inputs.date.getUTCMilliseconds();
|
|
284
313
|
}
|
|
285
314
|
/**
|
|
286
|
-
*
|
|
315
|
+
* Creates new date with modified year (returns new date, original unchanged).
|
|
316
|
+
* Example: Date(2024,0,15) with year=2025 → Date(2025,0,15)
|
|
287
317
|
* @param inputs a date and the year
|
|
288
318
|
* @returns date
|
|
289
319
|
* @group set
|
|
@@ -296,7 +326,8 @@ export class Dates {
|
|
|
296
326
|
return dateCopy;
|
|
297
327
|
}
|
|
298
328
|
/**
|
|
299
|
-
*
|
|
329
|
+
* Creates new date with modified month (0=January, 11=December, returns new date).
|
|
330
|
+
* Example: Date(2024,0,15) with month=5 → Date(2024,5,15) (June 15)
|
|
300
331
|
* @param inputs a date and the month
|
|
301
332
|
* @returns date
|
|
302
333
|
* @group set
|
|
@@ -309,7 +340,8 @@ export class Dates {
|
|
|
309
340
|
return dateCopy;
|
|
310
341
|
}
|
|
311
342
|
/**
|
|
312
|
-
*
|
|
343
|
+
* Creates new date with modified day of month (1-31, returns new date).
|
|
344
|
+
* Example: Date(2024,0,15) with day=20 → Date(2024,0,20)
|
|
313
345
|
* @param inputs a date and the day
|
|
314
346
|
* @returns date
|
|
315
347
|
* @group set
|
|
@@ -1,15 +1,65 @@
|
|
|
1
1
|
import * as Inputs from "../inputs";
|
|
2
2
|
export declare class GeometryHelper {
|
|
3
|
+
/**
|
|
4
|
+
* Applies one or more 4×4 transformation matrices to a list of points sequentially.
|
|
5
|
+
* Each transformation is applied in order (composition of transformations).
|
|
6
|
+
* Example: points=[[0,0,0], [1,0,0]] with translation [5,0,0] → [[5,0,0], [6,0,0]]
|
|
7
|
+
*/
|
|
3
8
|
transformControlPoints(transformation: number[][] | number[][][], transformedControlPoints: Inputs.Base.Point3[]): Inputs.Base.Point3[];
|
|
9
|
+
/**
|
|
10
|
+
* Flattens nested transformation arrays into a single-level array of transformation matrices.
|
|
11
|
+
* Handles both 2D arrays (single transform list) and 3D arrays (nested transform lists).
|
|
12
|
+
* Example: [[[matrix1, matrix2]], [[matrix3]]] → [matrix1, matrix2, matrix3]
|
|
13
|
+
*/
|
|
4
14
|
getFlatTransformations(transformation: number[][] | number[][][]): number[][];
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the nesting depth of an array recursively.
|
|
17
|
+
* Example: [1,2,3] → 1, [[1,2],[3,4]] → 2, [[[1]]] → 3
|
|
18
|
+
*/
|
|
5
19
|
getArrayDepth: (value: any) => number;
|
|
20
|
+
/**
|
|
21
|
+
* Applies a single 4×4 transformation matrix (as flat 16-element array) to multiple points.
|
|
22
|
+
* Example: points=[[0,0,0], [1,0,0]] with translation matrix → transformed points
|
|
23
|
+
*/
|
|
6
24
|
transformPointsByMatrixArray(points: Inputs.Base.Point3[], transform: number[]): Inputs.Base.Point3[];
|
|
25
|
+
/**
|
|
26
|
+
* Transforms multiple points using a transformation matrix (maps each point through the matrix).
|
|
27
|
+
* Example: points=[[1,0,0], [0,1,0]] with 90° rotation → [[0,1,0], [-1,0,0]]
|
|
28
|
+
*/
|
|
7
29
|
transformPointsCoordinates(points: Inputs.Base.Point3[], transform: number[]): Inputs.Base.Point3[];
|
|
30
|
+
/**
|
|
31
|
+
* Removes all duplicate vectors from a list (works with arbitrary-length numeric vectors).
|
|
32
|
+
* Compares vectors using tolerance for floating-point equality.
|
|
33
|
+
* Example: [[1,2], [3,4], [1,2], [5,6]] with tolerance=1e-7 → [[1,2], [3,4], [5,6]]
|
|
34
|
+
*/
|
|
8
35
|
removeAllDuplicateVectors(vectors: number[][], tolerance?: number): number[][];
|
|
36
|
+
/**
|
|
37
|
+
* Removes consecutive duplicate vectors from a list (keeps only first occurrence in each sequence).
|
|
38
|
+
* Optionally checks and removes duplicate if first and last vectors match.
|
|
39
|
+
* Example: [[1,2], [1,2], [3,4], [3,4], [5,6]] → [[1,2], [3,4], [5,6]]
|
|
40
|
+
*/
|
|
9
41
|
removeConsecutiveVectorDuplicates(vectors: number[][], checkFirstAndLast?: boolean, tolerance?: number): number[][];
|
|
42
|
+
/**
|
|
43
|
+
* Compares two vectors for approximate equality using tolerance (element-wise comparison).
|
|
44
|
+
* Returns false if vectors have different lengths.
|
|
45
|
+
* Example: [1.0000001, 2.0], [1.0, 2.0] with tolerance=1e-6 → true
|
|
46
|
+
*/
|
|
10
47
|
vectorsTheSame(vec1: number[], vec2: number[], tolerance: number): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Checks if two numbers are approximately equal within a tolerance.
|
|
50
|
+
* Example: 1.0000001, 1.0 with tolerance=1e-6 → true, 1.001, 1.0 with tolerance=1e-6 → false
|
|
51
|
+
*/
|
|
11
52
|
approxEq(num1: number, num2: number, tolerance: number): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Removes consecutive duplicate points from a list (specialized for 3D/2D points).
|
|
55
|
+
* Optionally checks and removes duplicate if first and last points match (for closed loops).
|
|
56
|
+
* Example: [[0,0,0], [0,0,0], [1,0,0], [1,0,0]] → [[0,0,0], [1,0,0]]
|
|
57
|
+
*/
|
|
12
58
|
removeConsecutivePointDuplicates(points: Inputs.Base.Point3[], checkFirstAndLast?: boolean, tolerance?: number): Inputs.Base.Point3[];
|
|
59
|
+
/**
|
|
60
|
+
* Checks if two points are approximately equal using tolerance (supports 2D and 3D points).
|
|
61
|
+
* Example: [1.0000001, 2.0, 3.0], [1.0, 2.0, 3.0] with tolerance=1e-6 → true
|
|
62
|
+
*/
|
|
13
63
|
arePointsTheSame(pointA: Inputs.Base.Point3 | Inputs.Base.Point2, pointB: Inputs.Base.Point3 | Inputs.Base.Point2, tolerance: number): boolean;
|
|
14
64
|
private transformCoordinates;
|
|
15
65
|
}
|