funcnodes-basic 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
- funcnodes_basic/__init__.py +3 -2
- funcnodes_basic/dicts.py +2 -1
- funcnodes_basic/logic.py +114 -114
- funcnodes_basic/{math.py → math_nodes.py} +684 -684
- {funcnodes_basic-0.1.3.dist-info → funcnodes_basic-0.1.5.dist-info}/METADATA +1 -1
- funcnodes_basic-0.1.5.dist-info/RECORD +10 -0
- funcnodes_basic-0.1.5.dist-info/entry_points.txt +4 -0
- funcnodes_basic-0.1.3.dist-info/RECORD +0 -9
- {funcnodes_basic-0.1.3.dist-info → funcnodes_basic-0.1.5.dist-info}/WHEEL +0 -0
@@ -1,684 +1,684 @@
|
|
1
|
-
"""basic math nodes"""
|
2
|
-
|
3
|
-
import math
|
4
|
-
import sys
|
5
|
-
from typing import List
|
6
|
-
from funcnodes.nodemaker import NodeDecorator
|
7
|
-
from funcnodes.lib import module_to_shelf
|
8
|
-
|
9
|
-
|
10
|
-
# region: Basic math nodes
|
11
|
-
@NodeDecorator(
|
12
|
-
"value_node",
|
13
|
-
inputs=[{"name": "value", "allow_multiple": True}],
|
14
|
-
)
|
15
|
-
def value_node(value: float) -> float:
|
16
|
-
return value
|
17
|
-
|
18
|
-
|
19
|
-
@NodeDecorator(
|
20
|
-
"add_node",
|
21
|
-
name="Add",
|
22
|
-
)
|
23
|
-
def add_node(a: float, b: float) -> float:
|
24
|
-
"""Add two numbers"""
|
25
|
-
a = float(a)
|
26
|
-
b = float(b)
|
27
|
-
return a + b
|
28
|
-
|
29
|
-
|
30
|
-
@NodeDecorator(
|
31
|
-
"sub_node",
|
32
|
-
)
|
33
|
-
def sub_node(a: float, b: float) -> float:
|
34
|
-
a = float(a)
|
35
|
-
b = float(b)
|
36
|
-
return a - b
|
37
|
-
|
38
|
-
|
39
|
-
@NodeDecorator(
|
40
|
-
"mul_node",
|
41
|
-
)
|
42
|
-
def mul_node(a: float, b: float) -> float:
|
43
|
-
a = float(a)
|
44
|
-
b = float(b)
|
45
|
-
return a * b
|
46
|
-
|
47
|
-
|
48
|
-
@NodeDecorator(
|
49
|
-
"div_node",
|
50
|
-
)
|
51
|
-
def div_node(a: float, b: float) -> float:
|
52
|
-
a = float(a)
|
53
|
-
b = float(b)
|
54
|
-
return a / b
|
55
|
-
|
56
|
-
|
57
|
-
@NodeDecorator(
|
58
|
-
"mod_node",
|
59
|
-
)
|
60
|
-
def mod_node(a: float, b: float) -> float:
|
61
|
-
a = float(a)
|
62
|
-
b = float(b)
|
63
|
-
return a % b
|
64
|
-
|
65
|
-
|
66
|
-
@NodeDecorator(
|
67
|
-
"pow_node",
|
68
|
-
)
|
69
|
-
def pow_node(a: float, b: float) -> float:
|
70
|
-
a = float(a)
|
71
|
-
b = float(b)
|
72
|
-
return a**b
|
73
|
-
|
74
|
-
|
75
|
-
@NodeDecorator(
|
76
|
-
"floor_div_node",
|
77
|
-
)
|
78
|
-
def floor_div_node(a: float, b: float) -> float:
|
79
|
-
a = float(a)
|
80
|
-
b = float(b)
|
81
|
-
return a // b
|
82
|
-
|
83
|
-
|
84
|
-
@NodeDecorator(
|
85
|
-
"abs_node",
|
86
|
-
)
|
87
|
-
def abs_node(a: float) -> float:
|
88
|
-
a = float(a)
|
89
|
-
return abs(a)
|
90
|
-
|
91
|
-
|
92
|
-
@NodeDecorator(
|
93
|
-
"neg_node",
|
94
|
-
)
|
95
|
-
def neg_node(a: float) -> float:
|
96
|
-
a = float(a)
|
97
|
-
return -a
|
98
|
-
|
99
|
-
|
100
|
-
@NodeDecorator(
|
101
|
-
"pos_node",
|
102
|
-
)
|
103
|
-
def pos_node(a: float) -> float:
|
104
|
-
a = float(a)
|
105
|
-
return +a
|
106
|
-
|
107
|
-
|
108
|
-
@NodeDecorator(
|
109
|
-
"round_node",
|
110
|
-
)
|
111
|
-
def round_node(a: float, ndigits: int = 0) -> float:
|
112
|
-
a = float(a)
|
113
|
-
ndigits = int(ndigits)
|
114
|
-
return round(a, ndigits)
|
115
|
-
|
116
|
-
|
117
|
-
@NodeDecorator(
|
118
|
-
"greater_node",
|
119
|
-
)
|
120
|
-
def greater_node(a: float, b: float) -> bool:
|
121
|
-
a = float(a)
|
122
|
-
b = float(b)
|
123
|
-
return a > b
|
124
|
-
|
125
|
-
|
126
|
-
@NodeDecorator(
|
127
|
-
"greater_equal_node",
|
128
|
-
)
|
129
|
-
def greater_equal_node(a: float, b: float) -> bool:
|
130
|
-
a = float(a)
|
131
|
-
b = float(b)
|
132
|
-
return a >= b
|
133
|
-
|
134
|
-
|
135
|
-
@NodeDecorator(
|
136
|
-
"less_node",
|
137
|
-
)
|
138
|
-
def less_node(a: float, b: float) -> bool:
|
139
|
-
a = float(a)
|
140
|
-
b = float(b)
|
141
|
-
return a < b
|
142
|
-
|
143
|
-
|
144
|
-
@NodeDecorator(
|
145
|
-
"less_equal_node",
|
146
|
-
)
|
147
|
-
def less_equal_node(a: float, b: float) -> bool:
|
148
|
-
return a <= b
|
149
|
-
|
150
|
-
|
151
|
-
@NodeDecorator(
|
152
|
-
"equal_node",
|
153
|
-
)
|
154
|
-
def equal_node(a: float, b: float) -> bool:
|
155
|
-
a = float(a)
|
156
|
-
b = float(b)
|
157
|
-
return a == b
|
158
|
-
|
159
|
-
|
160
|
-
@NodeDecorator(
|
161
|
-
"not_equal_node",
|
162
|
-
)
|
163
|
-
def not_equal_node(a: float, b: float) -> bool:
|
164
|
-
a = float(a)
|
165
|
-
b = float(b)
|
166
|
-
return a != b
|
167
|
-
|
168
|
-
|
169
|
-
@NodeDecorator(
|
170
|
-
"and_node",
|
171
|
-
)
|
172
|
-
def and_node(a: bool, b: bool) -> bool:
|
173
|
-
a = float(a)
|
174
|
-
b = float(b)
|
175
|
-
return a and b
|
176
|
-
|
177
|
-
|
178
|
-
@NodeDecorator(
|
179
|
-
"or_node",
|
180
|
-
)
|
181
|
-
def or_node(a: bool, b: bool) -> bool:
|
182
|
-
a = bool(a)
|
183
|
-
b = bool(b)
|
184
|
-
return a or b
|
185
|
-
|
186
|
-
|
187
|
-
@NodeDecorator(
|
188
|
-
"xor_node",
|
189
|
-
)
|
190
|
-
def xor_node(a: bool, b: bool) -> bool:
|
191
|
-
a = bool(a)
|
192
|
-
b = bool(b)
|
193
|
-
return a ^ b
|
194
|
-
|
195
|
-
|
196
|
-
@NodeDecorator(
|
197
|
-
"not_node",
|
198
|
-
)
|
199
|
-
def not_node(a: bool) -> bool:
|
200
|
-
a = bool(a)
|
201
|
-
return not a
|
202
|
-
|
203
|
-
|
204
|
-
# endregion basic math nodes
|
205
|
-
|
206
|
-
|
207
|
-
# region constants
|
208
|
-
@NodeDecorator(
|
209
|
-
"math.pi",
|
210
|
-
)
|
211
|
-
def math_pi_node() -> float:
|
212
|
-
return math.pi
|
213
|
-
|
214
|
-
|
215
|
-
@NodeDecorator(
|
216
|
-
"math.e",
|
217
|
-
)
|
218
|
-
def math_e_node() -> float:
|
219
|
-
return math.e
|
220
|
-
|
221
|
-
|
222
|
-
@NodeDecorator(
|
223
|
-
"math.tau",
|
224
|
-
)
|
225
|
-
def math_tau_node() -> float:
|
226
|
-
return math.tau
|
227
|
-
|
228
|
-
|
229
|
-
@NodeDecorator(
|
230
|
-
"math.inf",
|
231
|
-
)
|
232
|
-
def math_inf_node() -> float:
|
233
|
-
return math.inf
|
234
|
-
|
235
|
-
|
236
|
-
@NodeDecorator(
|
237
|
-
"math.nan",
|
238
|
-
)
|
239
|
-
def math_nan_node() -> float:
|
240
|
-
return math.nan
|
241
|
-
|
242
|
-
|
243
|
-
# endregion constants
|
244
|
-
|
245
|
-
|
246
|
-
# region 1 float in, 1 float out
|
247
|
-
@NodeDecorator(
|
248
|
-
"math.acos",
|
249
|
-
name="Acos",
|
250
|
-
)
|
251
|
-
def math_acos_node(a: float) -> float:
|
252
|
-
"""Return the arc cosine of a."""
|
253
|
-
return math.acos(a)
|
254
|
-
|
255
|
-
|
256
|
-
@NodeDecorator(
|
257
|
-
"math.acosh",
|
258
|
-
)
|
259
|
-
def math_acosh_node(a: float) -> float:
|
260
|
-
return math.acosh(a)
|
261
|
-
|
262
|
-
|
263
|
-
@NodeDecorator(
|
264
|
-
"math.asin",
|
265
|
-
)
|
266
|
-
def math_asin_node(a: float) -> float:
|
267
|
-
return math.asin(a)
|
268
|
-
|
269
|
-
|
270
|
-
@NodeDecorator(
|
271
|
-
"math.asinh",
|
272
|
-
)
|
273
|
-
def math_asinh_node(a: float) -> float:
|
274
|
-
return math.asinh(a)
|
275
|
-
|
276
|
-
|
277
|
-
@NodeDecorator(
|
278
|
-
"math.atan",
|
279
|
-
)
|
280
|
-
def math_atan_node(a: float) -> float:
|
281
|
-
return math.atan(a)
|
282
|
-
|
283
|
-
|
284
|
-
@NodeDecorator(
|
285
|
-
"math.atanh",
|
286
|
-
)
|
287
|
-
def math_atanh_node(a: float) -> float:
|
288
|
-
return math.atanh(a)
|
289
|
-
|
290
|
-
|
291
|
-
@NodeDecorator(
|
292
|
-
"math.ceil",
|
293
|
-
)
|
294
|
-
def math_ceil_node(a: float) -> float:
|
295
|
-
return math.ceil(a)
|
296
|
-
|
297
|
-
|
298
|
-
@NodeDecorator(
|
299
|
-
"math.cos",
|
300
|
-
)
|
301
|
-
def math_cos_node(a: float) -> float:
|
302
|
-
return math.cos(a)
|
303
|
-
|
304
|
-
|
305
|
-
@NodeDecorator(
|
306
|
-
"math.cosh",
|
307
|
-
)
|
308
|
-
def math_cosh_node(a: float) -> float:
|
309
|
-
return math.cosh(a)
|
310
|
-
|
311
|
-
|
312
|
-
@NodeDecorator(
|
313
|
-
"math.degrees",
|
314
|
-
)
|
315
|
-
def math_degrees_node(a: float) -> float:
|
316
|
-
return math.degrees(a)
|
317
|
-
|
318
|
-
|
319
|
-
@NodeDecorator(
|
320
|
-
"math.erf",
|
321
|
-
)
|
322
|
-
def math_erf_node(a: float) -> float:
|
323
|
-
return math.erf(a)
|
324
|
-
|
325
|
-
|
326
|
-
@NodeDecorator(
|
327
|
-
"math.erfc",
|
328
|
-
)
|
329
|
-
def math_erfc_node(a: float) -> float:
|
330
|
-
return math.erfc(a)
|
331
|
-
|
332
|
-
|
333
|
-
@NodeDecorator(
|
334
|
-
"math.exp",
|
335
|
-
)
|
336
|
-
def math_exp_node(a: float) -> float:
|
337
|
-
return math.exp(a)
|
338
|
-
|
339
|
-
|
340
|
-
@NodeDecorator(
|
341
|
-
"math.expm1",
|
342
|
-
)
|
343
|
-
def math_expm1_node(a: float) -> float:
|
344
|
-
return math.expm1(a)
|
345
|
-
|
346
|
-
|
347
|
-
@NodeDecorator(
|
348
|
-
"math.fabs",
|
349
|
-
)
|
350
|
-
def math_fabs_node(a: float) -> float:
|
351
|
-
return math.fabs(a)
|
352
|
-
|
353
|
-
|
354
|
-
@NodeDecorator(
|
355
|
-
"math.floor",
|
356
|
-
)
|
357
|
-
def math_floor_node(a: float) -> float:
|
358
|
-
return math.floor(a)
|
359
|
-
|
360
|
-
|
361
|
-
@NodeDecorator(
|
362
|
-
"math.gamma",
|
363
|
-
)
|
364
|
-
def math_gamma_node(a: float) -> float:
|
365
|
-
return math.gamma(a)
|
366
|
-
|
367
|
-
|
368
|
-
@NodeDecorator(
|
369
|
-
"math.lgamma",
|
370
|
-
)
|
371
|
-
def math_lgamma_node(a: float) -> float:
|
372
|
-
return math.lgamma(a)
|
373
|
-
|
374
|
-
|
375
|
-
@NodeDecorator(
|
376
|
-
"math.log",
|
377
|
-
)
|
378
|
-
def math_log_node(a: float) -> float:
|
379
|
-
return math.log(a)
|
380
|
-
|
381
|
-
|
382
|
-
@NodeDecorator(
|
383
|
-
"math.log10",
|
384
|
-
)
|
385
|
-
def math_log10_node(a: float) -> float:
|
386
|
-
return math.log10(a)
|
387
|
-
|
388
|
-
|
389
|
-
@NodeDecorator(
|
390
|
-
"math.log1p",
|
391
|
-
)
|
392
|
-
def math_log1p_node(a: float) -> float:
|
393
|
-
return math.log1p(a)
|
394
|
-
|
395
|
-
|
396
|
-
@NodeDecorator(
|
397
|
-
"math.log2",
|
398
|
-
)
|
399
|
-
def math_log2_node(a: float) -> float:
|
400
|
-
return math.log2(a)
|
401
|
-
|
402
|
-
|
403
|
-
@NodeDecorator(
|
404
|
-
"math.modf",
|
405
|
-
)
|
406
|
-
def math_modf_node(a: float) -> float:
|
407
|
-
return math.modf(a)
|
408
|
-
|
409
|
-
|
410
|
-
@NodeDecorator(
|
411
|
-
"math.radians",
|
412
|
-
)
|
413
|
-
def math_radians_node(a: float) -> float:
|
414
|
-
return math.radians(a)
|
415
|
-
|
416
|
-
|
417
|
-
@NodeDecorator(
|
418
|
-
"math.sin",
|
419
|
-
)
|
420
|
-
def math_sin_node(a: float) -> float:
|
421
|
-
return math.sin(a)
|
422
|
-
|
423
|
-
|
424
|
-
@NodeDecorator(
|
425
|
-
"math.sinh",
|
426
|
-
)
|
427
|
-
def math_sinh_node(a: float) -> float:
|
428
|
-
return math.sinh(a)
|
429
|
-
|
430
|
-
|
431
|
-
@NodeDecorator(
|
432
|
-
"math.sqrt",
|
433
|
-
)
|
434
|
-
def math_sqrt_node(a: float) -> float:
|
435
|
-
return math.sqrt(a)
|
436
|
-
|
437
|
-
|
438
|
-
@NodeDecorator(
|
439
|
-
"math.tan",
|
440
|
-
)
|
441
|
-
def math_tan_node(a: float) -> float:
|
442
|
-
return math.tan(a)
|
443
|
-
|
444
|
-
|
445
|
-
@NodeDecorator(
|
446
|
-
"math.tanh",
|
447
|
-
)
|
448
|
-
def math_tanh_node(a: float) -> float:
|
449
|
-
return math.tanh(a)
|
450
|
-
|
451
|
-
|
452
|
-
if sys.version_info >= (3, 11):
|
453
|
-
|
454
|
-
@NodeDecorator(
|
455
|
-
"math.exp2",
|
456
|
-
)
|
457
|
-
def math_exp2_node(a: float) -> float:
|
458
|
-
return math.exp2(a)
|
459
|
-
|
460
|
-
@NodeDecorator(
|
461
|
-
"math.cbrt",
|
462
|
-
)
|
463
|
-
def math_cbrt_node(a: float) -> float:
|
464
|
-
return math.cbrt(a)
|
465
|
-
|
466
|
-
|
467
|
-
# endregion 1 float in, 1 float out
|
468
|
-
|
469
|
-
|
470
|
-
# region 1 float in, 1 bool out
|
471
|
-
@NodeDecorator(
|
472
|
-
"math.isfinite",
|
473
|
-
)
|
474
|
-
def math_isfinite_node(a: float) -> bool:
|
475
|
-
return math.isfinite(a)
|
476
|
-
|
477
|
-
|
478
|
-
@NodeDecorator(
|
479
|
-
"math.isinf",
|
480
|
-
)
|
481
|
-
def math_isinf_node(a: float) -> bool:
|
482
|
-
return math.isinf(a)
|
483
|
-
|
484
|
-
|
485
|
-
@NodeDecorator(
|
486
|
-
"math.isnan",
|
487
|
-
)
|
488
|
-
def math_isnan_node(a: float) -> bool:
|
489
|
-
return math.isnan(a)
|
490
|
-
|
491
|
-
|
492
|
-
# endregion 1 float in, 1 bool out
|
493
|
-
|
494
|
-
|
495
|
-
# region 1 float in, 1 int out
|
496
|
-
@NodeDecorator(
|
497
|
-
"math.trunc",
|
498
|
-
)
|
499
|
-
def math_trunc_node(a: float) -> int:
|
500
|
-
return math.trunc(a)
|
501
|
-
|
502
|
-
|
503
|
-
# endregion 1 float in, 1 int out
|
504
|
-
|
505
|
-
|
506
|
-
# region 2 float in, 1 float out
|
507
|
-
@NodeDecorator(
|
508
|
-
"math.atan2",
|
509
|
-
)
|
510
|
-
def math_atan2_node(a: float, b: float) -> float:
|
511
|
-
return math.atan2(a, b)
|
512
|
-
|
513
|
-
|
514
|
-
@NodeDecorator(
|
515
|
-
"math.copysign",
|
516
|
-
)
|
517
|
-
def math_copysign_node(a: float, b: float) -> float:
|
518
|
-
return math.copysign(a, b)
|
519
|
-
|
520
|
-
|
521
|
-
@NodeDecorator(
|
522
|
-
"math.fmod",
|
523
|
-
)
|
524
|
-
def math_fmod_node(a: float, b: float) -> float:
|
525
|
-
return math.fmod(a, b)
|
526
|
-
|
527
|
-
|
528
|
-
@NodeDecorator(
|
529
|
-
"math.hypot",
|
530
|
-
)
|
531
|
-
def math_hypot_node(a: float, b: float) -> float:
|
532
|
-
return math.hypot(a, b)
|
533
|
-
|
534
|
-
|
535
|
-
@NodeDecorator(
|
536
|
-
"math.pow",
|
537
|
-
)
|
538
|
-
def math_pow_node(a: float, b: float) -> float:
|
539
|
-
return math.pow(a, b)
|
540
|
-
|
541
|
-
|
542
|
-
@NodeDecorator(
|
543
|
-
"math.remainder",
|
544
|
-
)
|
545
|
-
def math_remainder_node(a: float, b: float) -> float:
|
546
|
-
return math.remainder(a, b)
|
547
|
-
|
548
|
-
|
549
|
-
if sys.version_info >= (3, 9):
|
550
|
-
|
551
|
-
@NodeDecorator(
|
552
|
-
"math.nextafter",
|
553
|
-
)
|
554
|
-
def math_nextafter_node(a: float, b: float) -> float:
|
555
|
-
return math.nextafter(a, b)
|
556
|
-
|
557
|
-
|
558
|
-
# endregion 2 float in, 1 float out
|
559
|
-
|
560
|
-
|
561
|
-
# region 2 float in, 1 bool out
|
562
|
-
@NodeDecorator(
|
563
|
-
"math.isclose",
|
564
|
-
)
|
565
|
-
def math_isclose_node(a: float, b: float) -> bool:
|
566
|
-
return math.isclose(a, b)
|
567
|
-
|
568
|
-
|
569
|
-
# endregion 2 float in, 1 bool out
|
570
|
-
|
571
|
-
|
572
|
-
# region 2 float in, 1 int out
|
573
|
-
# endregion 2 float in, 1 int out
|
574
|
-
|
575
|
-
# region 1 int in, 1 int out
|
576
|
-
|
577
|
-
|
578
|
-
@NodeDecorator(
|
579
|
-
"math.factorial",
|
580
|
-
)
|
581
|
-
def math_factorial_node(a: int) -> int:
|
582
|
-
return math.factorial(a)
|
583
|
-
|
584
|
-
|
585
|
-
if sys.version_info >= (3, 8):
|
586
|
-
|
587
|
-
@NodeDecorator(
|
588
|
-
"math.isqrt",
|
589
|
-
)
|
590
|
-
def math_isqrt_node(a: int) -> int:
|
591
|
-
return math.isqrt(a)
|
592
|
-
|
593
|
-
|
594
|
-
# endregion 1 int in, 1 int out
|
595
|
-
|
596
|
-
|
597
|
-
# region 2 int in, 1 int out
|
598
|
-
@NodeDecorator(
|
599
|
-
"math.gcd",
|
600
|
-
)
|
601
|
-
def math_gcd_node(a: int, b: int) -> int:
|
602
|
-
return math.gcd(a, b)
|
603
|
-
|
604
|
-
|
605
|
-
if sys.version_info >= (3, 8):
|
606
|
-
|
607
|
-
@NodeDecorator(
|
608
|
-
"math.comb",
|
609
|
-
)
|
610
|
-
def math_comb_node(a: int, b: int) -> int:
|
611
|
-
return math.comb(a, b)
|
612
|
-
|
613
|
-
@NodeDecorator(
|
614
|
-
"math.perm",
|
615
|
-
)
|
616
|
-
def math_perm_node(a: int, b: int) -> int:
|
617
|
-
return math.perm(a, b)
|
618
|
-
|
619
|
-
|
620
|
-
if sys.version_info >= (3, 9):
|
621
|
-
|
622
|
-
@NodeDecorator(
|
623
|
-
"math.lcm",
|
624
|
-
)
|
625
|
-
def math_lcm_node(a: int, b: int) -> int:
|
626
|
-
return math.lcm(a, b)
|
627
|
-
|
628
|
-
|
629
|
-
# endregion 2 int in, 1 int out
|
630
|
-
|
631
|
-
|
632
|
-
# region float, int in float out
|
633
|
-
@NodeDecorator(
|
634
|
-
"math.ldexp",
|
635
|
-
)
|
636
|
-
def math_ldexp_node(a: float, b: int) -> float:
|
637
|
-
return math.ldexp(a, b)
|
638
|
-
|
639
|
-
|
640
|
-
# endregion float, int in float out
|
641
|
-
|
642
|
-
|
643
|
-
# region vector in float out
|
644
|
-
@NodeDecorator(
|
645
|
-
"math.fsum",
|
646
|
-
)
|
647
|
-
def math_fsum_node(a: List[float]) -> float:
|
648
|
-
return math.fsum(a)
|
649
|
-
|
650
|
-
|
651
|
-
if sys.version_info >= (3, 8):
|
652
|
-
|
653
|
-
@NodeDecorator(
|
654
|
-
"math.prod",
|
655
|
-
)
|
656
|
-
def math_prod_node(a: List[float]) -> float:
|
657
|
-
return math.prod(a)
|
658
|
-
|
659
|
-
|
660
|
-
# endregion vector in float out
|
661
|
-
|
662
|
-
# region vector, vector in float out
|
663
|
-
|
664
|
-
if sys.version_info >= (3, 8):
|
665
|
-
|
666
|
-
@NodeDecorator(
|
667
|
-
"math.dist",
|
668
|
-
)
|
669
|
-
def math_dist_node(a: List[float], b: List[float]) -> float:
|
670
|
-
return math.dist(a, b)
|
671
|
-
|
672
|
-
|
673
|
-
if sys.version_info >= (3, 12):
|
674
|
-
|
675
|
-
@NodeDecorator(
|
676
|
-
"math.sumprod",
|
677
|
-
)
|
678
|
-
def math_sumprod_node(a: List[float], b: List[float]) -> float:
|
679
|
-
return math.sumprod(a, b)
|
680
|
-
|
681
|
-
|
682
|
-
# endregion vector, vector in float out
|
683
|
-
|
684
|
-
NODE_SHELF = module_to_shelf(sys.modules[__name__], name="math")
|
1
|
+
"""basic math nodes"""
|
2
|
+
|
3
|
+
import math
|
4
|
+
import sys
|
5
|
+
from typing import List
|
6
|
+
from funcnodes.nodemaker import NodeDecorator
|
7
|
+
from funcnodes.lib import module_to_shelf
|
8
|
+
|
9
|
+
|
10
|
+
# region: Basic math nodes
|
11
|
+
@NodeDecorator(
|
12
|
+
"value_node",
|
13
|
+
inputs=[{"name": "value", "allow_multiple": True}],
|
14
|
+
)
|
15
|
+
def value_node(value: float) -> float:
|
16
|
+
return value
|
17
|
+
|
18
|
+
|
19
|
+
@NodeDecorator(
|
20
|
+
"add_node",
|
21
|
+
name="Add",
|
22
|
+
)
|
23
|
+
def add_node(a: float, b: float) -> float:
|
24
|
+
"""Add two numbers"""
|
25
|
+
a = float(a)
|
26
|
+
b = float(b)
|
27
|
+
return a + b
|
28
|
+
|
29
|
+
|
30
|
+
@NodeDecorator(
|
31
|
+
"sub_node",
|
32
|
+
)
|
33
|
+
def sub_node(a: float, b: float) -> float:
|
34
|
+
a = float(a)
|
35
|
+
b = float(b)
|
36
|
+
return a - b
|
37
|
+
|
38
|
+
|
39
|
+
@NodeDecorator(
|
40
|
+
"mul_node",
|
41
|
+
)
|
42
|
+
def mul_node(a: float, b: float) -> float:
|
43
|
+
a = float(a)
|
44
|
+
b = float(b)
|
45
|
+
return a * b
|
46
|
+
|
47
|
+
|
48
|
+
@NodeDecorator(
|
49
|
+
"div_node",
|
50
|
+
)
|
51
|
+
def div_node(a: float, b: float) -> float:
|
52
|
+
a = float(a)
|
53
|
+
b = float(b)
|
54
|
+
return a / b
|
55
|
+
|
56
|
+
|
57
|
+
@NodeDecorator(
|
58
|
+
"mod_node",
|
59
|
+
)
|
60
|
+
def mod_node(a: float, b: float) -> float:
|
61
|
+
a = float(a)
|
62
|
+
b = float(b)
|
63
|
+
return a % b
|
64
|
+
|
65
|
+
|
66
|
+
@NodeDecorator(
|
67
|
+
"pow_node",
|
68
|
+
)
|
69
|
+
def pow_node(a: float, b: float) -> float:
|
70
|
+
a = float(a)
|
71
|
+
b = float(b)
|
72
|
+
return a**b
|
73
|
+
|
74
|
+
|
75
|
+
@NodeDecorator(
|
76
|
+
"floor_div_node",
|
77
|
+
)
|
78
|
+
def floor_div_node(a: float, b: float) -> float:
|
79
|
+
a = float(a)
|
80
|
+
b = float(b)
|
81
|
+
return a // b
|
82
|
+
|
83
|
+
|
84
|
+
@NodeDecorator(
|
85
|
+
"abs_node",
|
86
|
+
)
|
87
|
+
def abs_node(a: float) -> float:
|
88
|
+
a = float(a)
|
89
|
+
return abs(a)
|
90
|
+
|
91
|
+
|
92
|
+
@NodeDecorator(
|
93
|
+
"neg_node",
|
94
|
+
)
|
95
|
+
def neg_node(a: float) -> float:
|
96
|
+
a = float(a)
|
97
|
+
return -a
|
98
|
+
|
99
|
+
|
100
|
+
@NodeDecorator(
|
101
|
+
"pos_node",
|
102
|
+
)
|
103
|
+
def pos_node(a: float) -> float:
|
104
|
+
a = float(a)
|
105
|
+
return +a
|
106
|
+
|
107
|
+
|
108
|
+
@NodeDecorator(
|
109
|
+
"round_node",
|
110
|
+
)
|
111
|
+
def round_node(a: float, ndigits: int = 0) -> float:
|
112
|
+
a = float(a)
|
113
|
+
ndigits = int(ndigits)
|
114
|
+
return round(a, ndigits)
|
115
|
+
|
116
|
+
|
117
|
+
@NodeDecorator(
|
118
|
+
"greater_node",
|
119
|
+
)
|
120
|
+
def greater_node(a: float, b: float) -> bool:
|
121
|
+
a = float(a)
|
122
|
+
b = float(b)
|
123
|
+
return a > b
|
124
|
+
|
125
|
+
|
126
|
+
@NodeDecorator(
|
127
|
+
"greater_equal_node",
|
128
|
+
)
|
129
|
+
def greater_equal_node(a: float, b: float) -> bool:
|
130
|
+
a = float(a)
|
131
|
+
b = float(b)
|
132
|
+
return a >= b
|
133
|
+
|
134
|
+
|
135
|
+
@NodeDecorator(
|
136
|
+
"less_node",
|
137
|
+
)
|
138
|
+
def less_node(a: float, b: float) -> bool:
|
139
|
+
a = float(a)
|
140
|
+
b = float(b)
|
141
|
+
return a < b
|
142
|
+
|
143
|
+
|
144
|
+
@NodeDecorator(
|
145
|
+
"less_equal_node",
|
146
|
+
)
|
147
|
+
def less_equal_node(a: float, b: float) -> bool:
|
148
|
+
return a <= b
|
149
|
+
|
150
|
+
|
151
|
+
@NodeDecorator(
|
152
|
+
"equal_node",
|
153
|
+
)
|
154
|
+
def equal_node(a: float, b: float) -> bool:
|
155
|
+
a = float(a)
|
156
|
+
b = float(b)
|
157
|
+
return a == b
|
158
|
+
|
159
|
+
|
160
|
+
@NodeDecorator(
|
161
|
+
"not_equal_node",
|
162
|
+
)
|
163
|
+
def not_equal_node(a: float, b: float) -> bool:
|
164
|
+
a = float(a)
|
165
|
+
b = float(b)
|
166
|
+
return a != b
|
167
|
+
|
168
|
+
|
169
|
+
@NodeDecorator(
|
170
|
+
"and_node",
|
171
|
+
)
|
172
|
+
def and_node(a: bool, b: bool) -> bool:
|
173
|
+
a = float(a)
|
174
|
+
b = float(b)
|
175
|
+
return a and b
|
176
|
+
|
177
|
+
|
178
|
+
@NodeDecorator(
|
179
|
+
"or_node",
|
180
|
+
)
|
181
|
+
def or_node(a: bool, b: bool) -> bool:
|
182
|
+
a = bool(a)
|
183
|
+
b = bool(b)
|
184
|
+
return a or b
|
185
|
+
|
186
|
+
|
187
|
+
@NodeDecorator(
|
188
|
+
"xor_node",
|
189
|
+
)
|
190
|
+
def xor_node(a: bool, b: bool) -> bool:
|
191
|
+
a = bool(a)
|
192
|
+
b = bool(b)
|
193
|
+
return a ^ b
|
194
|
+
|
195
|
+
|
196
|
+
@NodeDecorator(
|
197
|
+
"not_node",
|
198
|
+
)
|
199
|
+
def not_node(a: bool) -> bool:
|
200
|
+
a = bool(a)
|
201
|
+
return not a
|
202
|
+
|
203
|
+
|
204
|
+
# endregion basic math nodes
|
205
|
+
|
206
|
+
|
207
|
+
# region constants
|
208
|
+
@NodeDecorator(
|
209
|
+
"math.pi",
|
210
|
+
)
|
211
|
+
def math_pi_node() -> float:
|
212
|
+
return math.pi
|
213
|
+
|
214
|
+
|
215
|
+
@NodeDecorator(
|
216
|
+
"math.e",
|
217
|
+
)
|
218
|
+
def math_e_node() -> float:
|
219
|
+
return math.e
|
220
|
+
|
221
|
+
|
222
|
+
@NodeDecorator(
|
223
|
+
"math.tau",
|
224
|
+
)
|
225
|
+
def math_tau_node() -> float:
|
226
|
+
return math.tau
|
227
|
+
|
228
|
+
|
229
|
+
@NodeDecorator(
|
230
|
+
"math.inf",
|
231
|
+
)
|
232
|
+
def math_inf_node() -> float:
|
233
|
+
return math.inf
|
234
|
+
|
235
|
+
|
236
|
+
@NodeDecorator(
|
237
|
+
"math.nan",
|
238
|
+
)
|
239
|
+
def math_nan_node() -> float:
|
240
|
+
return math.nan
|
241
|
+
|
242
|
+
|
243
|
+
# endregion constants
|
244
|
+
|
245
|
+
|
246
|
+
# region 1 float in, 1 float out
|
247
|
+
@NodeDecorator(
|
248
|
+
"math.acos",
|
249
|
+
name="Acos",
|
250
|
+
)
|
251
|
+
def math_acos_node(a: float) -> float:
|
252
|
+
"""Return the arc cosine of a."""
|
253
|
+
return math.acos(a)
|
254
|
+
|
255
|
+
|
256
|
+
@NodeDecorator(
|
257
|
+
"math.acosh",
|
258
|
+
)
|
259
|
+
def math_acosh_node(a: float) -> float:
|
260
|
+
return math.acosh(a)
|
261
|
+
|
262
|
+
|
263
|
+
@NodeDecorator(
|
264
|
+
"math.asin",
|
265
|
+
)
|
266
|
+
def math_asin_node(a: float) -> float:
|
267
|
+
return math.asin(a)
|
268
|
+
|
269
|
+
|
270
|
+
@NodeDecorator(
|
271
|
+
"math.asinh",
|
272
|
+
)
|
273
|
+
def math_asinh_node(a: float) -> float:
|
274
|
+
return math.asinh(a)
|
275
|
+
|
276
|
+
|
277
|
+
@NodeDecorator(
|
278
|
+
"math.atan",
|
279
|
+
)
|
280
|
+
def math_atan_node(a: float) -> float:
|
281
|
+
return math.atan(a)
|
282
|
+
|
283
|
+
|
284
|
+
@NodeDecorator(
|
285
|
+
"math.atanh",
|
286
|
+
)
|
287
|
+
def math_atanh_node(a: float) -> float:
|
288
|
+
return math.atanh(a)
|
289
|
+
|
290
|
+
|
291
|
+
@NodeDecorator(
|
292
|
+
"math.ceil",
|
293
|
+
)
|
294
|
+
def math_ceil_node(a: float) -> float:
|
295
|
+
return math.ceil(a)
|
296
|
+
|
297
|
+
|
298
|
+
@NodeDecorator(
|
299
|
+
"math.cos",
|
300
|
+
)
|
301
|
+
def math_cos_node(a: float) -> float:
|
302
|
+
return math.cos(a)
|
303
|
+
|
304
|
+
|
305
|
+
@NodeDecorator(
|
306
|
+
"math.cosh",
|
307
|
+
)
|
308
|
+
def math_cosh_node(a: float) -> float:
|
309
|
+
return math.cosh(a)
|
310
|
+
|
311
|
+
|
312
|
+
@NodeDecorator(
|
313
|
+
"math.degrees",
|
314
|
+
)
|
315
|
+
def math_degrees_node(a: float) -> float:
|
316
|
+
return math.degrees(a)
|
317
|
+
|
318
|
+
|
319
|
+
@NodeDecorator(
|
320
|
+
"math.erf",
|
321
|
+
)
|
322
|
+
def math_erf_node(a: float) -> float:
|
323
|
+
return math.erf(a)
|
324
|
+
|
325
|
+
|
326
|
+
@NodeDecorator(
|
327
|
+
"math.erfc",
|
328
|
+
)
|
329
|
+
def math_erfc_node(a: float) -> float:
|
330
|
+
return math.erfc(a)
|
331
|
+
|
332
|
+
|
333
|
+
@NodeDecorator(
|
334
|
+
"math.exp",
|
335
|
+
)
|
336
|
+
def math_exp_node(a: float) -> float:
|
337
|
+
return math.exp(a)
|
338
|
+
|
339
|
+
|
340
|
+
@NodeDecorator(
|
341
|
+
"math.expm1",
|
342
|
+
)
|
343
|
+
def math_expm1_node(a: float) -> float:
|
344
|
+
return math.expm1(a)
|
345
|
+
|
346
|
+
|
347
|
+
@NodeDecorator(
|
348
|
+
"math.fabs",
|
349
|
+
)
|
350
|
+
def math_fabs_node(a: float) -> float:
|
351
|
+
return math.fabs(a)
|
352
|
+
|
353
|
+
|
354
|
+
@NodeDecorator(
|
355
|
+
"math.floor",
|
356
|
+
)
|
357
|
+
def math_floor_node(a: float) -> float:
|
358
|
+
return math.floor(a)
|
359
|
+
|
360
|
+
|
361
|
+
@NodeDecorator(
|
362
|
+
"math.gamma",
|
363
|
+
)
|
364
|
+
def math_gamma_node(a: float) -> float:
|
365
|
+
return math.gamma(a)
|
366
|
+
|
367
|
+
|
368
|
+
@NodeDecorator(
|
369
|
+
"math.lgamma",
|
370
|
+
)
|
371
|
+
def math_lgamma_node(a: float) -> float:
|
372
|
+
return math.lgamma(a)
|
373
|
+
|
374
|
+
|
375
|
+
@NodeDecorator(
|
376
|
+
"math.log",
|
377
|
+
)
|
378
|
+
def math_log_node(a: float) -> float:
|
379
|
+
return math.log(a)
|
380
|
+
|
381
|
+
|
382
|
+
@NodeDecorator(
|
383
|
+
"math.log10",
|
384
|
+
)
|
385
|
+
def math_log10_node(a: float) -> float:
|
386
|
+
return math.log10(a)
|
387
|
+
|
388
|
+
|
389
|
+
@NodeDecorator(
|
390
|
+
"math.log1p",
|
391
|
+
)
|
392
|
+
def math_log1p_node(a: float) -> float:
|
393
|
+
return math.log1p(a)
|
394
|
+
|
395
|
+
|
396
|
+
@NodeDecorator(
|
397
|
+
"math.log2",
|
398
|
+
)
|
399
|
+
def math_log2_node(a: float) -> float:
|
400
|
+
return math.log2(a)
|
401
|
+
|
402
|
+
|
403
|
+
@NodeDecorator(
|
404
|
+
"math.modf",
|
405
|
+
)
|
406
|
+
def math_modf_node(a: float) -> float:
|
407
|
+
return math.modf(a)
|
408
|
+
|
409
|
+
|
410
|
+
@NodeDecorator(
|
411
|
+
"math.radians",
|
412
|
+
)
|
413
|
+
def math_radians_node(a: float) -> float:
|
414
|
+
return math.radians(a)
|
415
|
+
|
416
|
+
|
417
|
+
@NodeDecorator(
|
418
|
+
"math.sin",
|
419
|
+
)
|
420
|
+
def math_sin_node(a: float) -> float:
|
421
|
+
return math.sin(a)
|
422
|
+
|
423
|
+
|
424
|
+
@NodeDecorator(
|
425
|
+
"math.sinh",
|
426
|
+
)
|
427
|
+
def math_sinh_node(a: float) -> float:
|
428
|
+
return math.sinh(a)
|
429
|
+
|
430
|
+
|
431
|
+
@NodeDecorator(
|
432
|
+
"math.sqrt",
|
433
|
+
)
|
434
|
+
def math_sqrt_node(a: float) -> float:
|
435
|
+
return math.sqrt(a)
|
436
|
+
|
437
|
+
|
438
|
+
@NodeDecorator(
|
439
|
+
"math.tan",
|
440
|
+
)
|
441
|
+
def math_tan_node(a: float) -> float:
|
442
|
+
return math.tan(a)
|
443
|
+
|
444
|
+
|
445
|
+
@NodeDecorator(
|
446
|
+
"math.tanh",
|
447
|
+
)
|
448
|
+
def math_tanh_node(a: float) -> float:
|
449
|
+
return math.tanh(a)
|
450
|
+
|
451
|
+
|
452
|
+
if sys.version_info >= (3, 11):
|
453
|
+
|
454
|
+
@NodeDecorator(
|
455
|
+
"math.exp2",
|
456
|
+
)
|
457
|
+
def math_exp2_node(a: float) -> float:
|
458
|
+
return math.exp2(a)
|
459
|
+
|
460
|
+
@NodeDecorator(
|
461
|
+
"math.cbrt",
|
462
|
+
)
|
463
|
+
def math_cbrt_node(a: float) -> float:
|
464
|
+
return math.cbrt(a)
|
465
|
+
|
466
|
+
|
467
|
+
# endregion 1 float in, 1 float out
|
468
|
+
|
469
|
+
|
470
|
+
# region 1 float in, 1 bool out
|
471
|
+
@NodeDecorator(
|
472
|
+
"math.isfinite",
|
473
|
+
)
|
474
|
+
def math_isfinite_node(a: float) -> bool:
|
475
|
+
return math.isfinite(a)
|
476
|
+
|
477
|
+
|
478
|
+
@NodeDecorator(
|
479
|
+
"math.isinf",
|
480
|
+
)
|
481
|
+
def math_isinf_node(a: float) -> bool:
|
482
|
+
return math.isinf(a)
|
483
|
+
|
484
|
+
|
485
|
+
@NodeDecorator(
|
486
|
+
"math.isnan",
|
487
|
+
)
|
488
|
+
def math_isnan_node(a: float) -> bool:
|
489
|
+
return math.isnan(a)
|
490
|
+
|
491
|
+
|
492
|
+
# endregion 1 float in, 1 bool out
|
493
|
+
|
494
|
+
|
495
|
+
# region 1 float in, 1 int out
|
496
|
+
@NodeDecorator(
|
497
|
+
"math.trunc",
|
498
|
+
)
|
499
|
+
def math_trunc_node(a: float) -> int:
|
500
|
+
return math.trunc(a)
|
501
|
+
|
502
|
+
|
503
|
+
# endregion 1 float in, 1 int out
|
504
|
+
|
505
|
+
|
506
|
+
# region 2 float in, 1 float out
|
507
|
+
@NodeDecorator(
|
508
|
+
"math.atan2",
|
509
|
+
)
|
510
|
+
def math_atan2_node(a: float, b: float) -> float:
|
511
|
+
return math.atan2(a, b)
|
512
|
+
|
513
|
+
|
514
|
+
@NodeDecorator(
|
515
|
+
"math.copysign",
|
516
|
+
)
|
517
|
+
def math_copysign_node(a: float, b: float) -> float:
|
518
|
+
return math.copysign(a, b)
|
519
|
+
|
520
|
+
|
521
|
+
@NodeDecorator(
|
522
|
+
"math.fmod",
|
523
|
+
)
|
524
|
+
def math_fmod_node(a: float, b: float) -> float:
|
525
|
+
return math.fmod(a, b)
|
526
|
+
|
527
|
+
|
528
|
+
@NodeDecorator(
|
529
|
+
"math.hypot",
|
530
|
+
)
|
531
|
+
def math_hypot_node(a: float, b: float) -> float:
|
532
|
+
return math.hypot(a, b)
|
533
|
+
|
534
|
+
|
535
|
+
@NodeDecorator(
|
536
|
+
"math.pow",
|
537
|
+
)
|
538
|
+
def math_pow_node(a: float, b: float) -> float:
|
539
|
+
return math.pow(a, b)
|
540
|
+
|
541
|
+
|
542
|
+
@NodeDecorator(
|
543
|
+
"math.remainder",
|
544
|
+
)
|
545
|
+
def math_remainder_node(a: float, b: float) -> float:
|
546
|
+
return math.remainder(a, b)
|
547
|
+
|
548
|
+
|
549
|
+
if sys.version_info >= (3, 9):
|
550
|
+
|
551
|
+
@NodeDecorator(
|
552
|
+
"math.nextafter",
|
553
|
+
)
|
554
|
+
def math_nextafter_node(a: float, b: float) -> float:
|
555
|
+
return math.nextafter(a, b)
|
556
|
+
|
557
|
+
|
558
|
+
# endregion 2 float in, 1 float out
|
559
|
+
|
560
|
+
|
561
|
+
# region 2 float in, 1 bool out
|
562
|
+
@NodeDecorator(
|
563
|
+
"math.isclose",
|
564
|
+
)
|
565
|
+
def math_isclose_node(a: float, b: float) -> bool:
|
566
|
+
return math.isclose(a, b)
|
567
|
+
|
568
|
+
|
569
|
+
# endregion 2 float in, 1 bool out
|
570
|
+
|
571
|
+
|
572
|
+
# region 2 float in, 1 int out
|
573
|
+
# endregion 2 float in, 1 int out
|
574
|
+
|
575
|
+
# region 1 int in, 1 int out
|
576
|
+
|
577
|
+
|
578
|
+
@NodeDecorator(
|
579
|
+
"math.factorial",
|
580
|
+
)
|
581
|
+
def math_factorial_node(a: int) -> int:
|
582
|
+
return math.factorial(a)
|
583
|
+
|
584
|
+
|
585
|
+
if sys.version_info >= (3, 8):
|
586
|
+
|
587
|
+
@NodeDecorator(
|
588
|
+
"math.isqrt",
|
589
|
+
)
|
590
|
+
def math_isqrt_node(a: int) -> int:
|
591
|
+
return math.isqrt(a)
|
592
|
+
|
593
|
+
|
594
|
+
# endregion 1 int in, 1 int out
|
595
|
+
|
596
|
+
|
597
|
+
# region 2 int in, 1 int out
|
598
|
+
@NodeDecorator(
|
599
|
+
"math.gcd",
|
600
|
+
)
|
601
|
+
def math_gcd_node(a: int, b: int) -> int:
|
602
|
+
return math.gcd(a, b)
|
603
|
+
|
604
|
+
|
605
|
+
if sys.version_info >= (3, 8):
|
606
|
+
|
607
|
+
@NodeDecorator(
|
608
|
+
"math.comb",
|
609
|
+
)
|
610
|
+
def math_comb_node(a: int, b: int) -> int:
|
611
|
+
return math.comb(a, b)
|
612
|
+
|
613
|
+
@NodeDecorator(
|
614
|
+
"math.perm",
|
615
|
+
)
|
616
|
+
def math_perm_node(a: int, b: int) -> int:
|
617
|
+
return math.perm(a, b)
|
618
|
+
|
619
|
+
|
620
|
+
if sys.version_info >= (3, 9):
|
621
|
+
|
622
|
+
@NodeDecorator(
|
623
|
+
"math.lcm",
|
624
|
+
)
|
625
|
+
def math_lcm_node(a: int, b: int) -> int:
|
626
|
+
return math.lcm(a, b)
|
627
|
+
|
628
|
+
|
629
|
+
# endregion 2 int in, 1 int out
|
630
|
+
|
631
|
+
|
632
|
+
# region float, int in float out
|
633
|
+
@NodeDecorator(
|
634
|
+
"math.ldexp",
|
635
|
+
)
|
636
|
+
def math_ldexp_node(a: float, b: int) -> float:
|
637
|
+
return math.ldexp(a, b)
|
638
|
+
|
639
|
+
|
640
|
+
# endregion float, int in float out
|
641
|
+
|
642
|
+
|
643
|
+
# region vector in float out
|
644
|
+
@NodeDecorator(
|
645
|
+
"math.fsum",
|
646
|
+
)
|
647
|
+
def math_fsum_node(a: List[float]) -> float:
|
648
|
+
return math.fsum(a)
|
649
|
+
|
650
|
+
|
651
|
+
if sys.version_info >= (3, 8):
|
652
|
+
|
653
|
+
@NodeDecorator(
|
654
|
+
"math.prod",
|
655
|
+
)
|
656
|
+
def math_prod_node(a: List[float]) -> float:
|
657
|
+
return math.prod(a)
|
658
|
+
|
659
|
+
|
660
|
+
# endregion vector in float out
|
661
|
+
|
662
|
+
# region vector, vector in float out
|
663
|
+
|
664
|
+
if sys.version_info >= (3, 8):
|
665
|
+
|
666
|
+
@NodeDecorator(
|
667
|
+
"math.dist",
|
668
|
+
)
|
669
|
+
def math_dist_node(a: List[float], b: List[float]) -> float:
|
670
|
+
return math.dist(a, b)
|
671
|
+
|
672
|
+
|
673
|
+
if sys.version_info >= (3, 12):
|
674
|
+
|
675
|
+
@NodeDecorator(
|
676
|
+
"math.sumprod",
|
677
|
+
)
|
678
|
+
def math_sumprod_node(a: List[float], b: List[float]) -> float:
|
679
|
+
return math.sumprod(a, b)
|
680
|
+
|
681
|
+
|
682
|
+
# endregion vector, vector in float out
|
683
|
+
|
684
|
+
NODE_SHELF = module_to_shelf(sys.modules[__name__], name="math")
|