-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsed_functions.json
1805 lines (1805 loc) · 126 KB
/
parsed_functions.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"version": "3.09",
"functions": [
{
"name": "AutoNoteFrequency",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoNoteFrequency(baseline)\nlocal f = {\nC = 261.63,\nCs = 277.18,\nD = 293.66,\nDs = 311.13,\nE = 329.63,\nF = 349.23,\nFs = 369.99,\nG = 392.00,\nGs = 415.30,\nA = 440.00,\nAs = 466.16,\nB = 493.88,\n}\n\nlocal tuned = {}\nfor note, freq in pairs(f) do\ntuned[note] = freq / f[baseline]\nend\n\nreturn tuned\nend",
"tables": {},
"function_definition": "#endregion\n#region Arithmetic\n-Sigmoid"
},
{
"name": "AutoSigmoid",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSigmoid(v, max, steep, offset)\nv = AutoDefault(v, math.random(0, 10000) / 10000)\nreturn (max or 1) / (1 + math.exp((v - (offset or 0.5)) * (steep or -10)))\nend",
"tables": {},
"function_definition": "-Rounds a number.\n-\n-This was a Challenge by @TallTim and @1ssnl to make the smallest rounding"
},
{
"name": "AutoRound",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoRound(v, increment)\nincrement = AutoDefault(increment, 1)\nif increment == 0 then return v end\nlocal s = 1 / increment\nreturn math.floor(v * s + 0.5) / s\nend",
"tables": {},
"function_definition": "-Maps a value from range a1-a2 to range b1-b2\n-@param v number Input number\n-@param a1 number Goes from the range of number a1\n-@param a2 number To number a2\n-@param b1 number To the range of b1\n-@param b2 number To number b2\n-@param clamp boolean? Clamp the number between b1 and b2, Default is false\n-@return number"
},
{
"name": "AutoMap",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoMap(v, a1, a2, b1, b2, clamp)\nclamp = AutoDefault(clamp, false)\nif a1 == a2 then return b2 end\nlocal mapped = b1 + ((v - a1) * (b2 - b1)) / (a2 - a1)\nreturn clamp and AutoClamp(mapped, math.min(b1, b2), math.max(b1, b2)) or mapped\nend",
"tables": {},
"function_definition": "-Limits a value from going below the min and above the max\n-@param v number The number to clamp\n-@param min number? The minimum the number can be, Default is 0\n-@param max number? The maximum the number can be, Default is 1\n-@return number"
},
{
"name": "AutoClamp",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoClamp(v, min, max)\nmin = AutoDefault(min, 0)\nmax = AutoDefault(max, 1)\nreturn math.max(math.min(v, max), min)\nend",
"tables": {},
"function_definition": "-Limits a value from going below the min and above the max\n-@param v number The number to clamp\n-@param max number? The maximum the length of the number can be, Default is 1\n-@return number"
},
{
"name": "AutoClampLength",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoClampLength(v, max)\nmax = AutoDefault(max, 1)\nif v < -max then\nreturn -max\nelseif v > max then\nreturn max\nelse\nreturn v\nend\nend",
"tables": {},
"function_definition": "-Wraps a value inbetween a range, Thank you iaobardar for the Optimization\n-@param v number The number to wrap\n-@param min number? The minimum range\n-@param max number? The maximum range\n-@return number"
},
{
"name": "AutoWrap",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoWrap(v, min, max)\nmin = AutoDefault(min, 0)\nmax = AutoDefault(max, 1)\n\nreturn (v - min) % ((max + 1) - min) + min\nend",
"tables": {},
"function_definition": "-Linerarly Iterpolates between `a` and `b` by fraction `t`\n-\n-Does not clamp\n-@param a number Goes from number A\n-@param b number To number B\n-@param t number Interpolated by T\n-@return number"
},
{
"name": "AutoLerp",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoLerp(a, b, t)\nreturn (1 - t) * a + t * b\nend",
"tables": {},
"function_definition": "-Spherically Iterpolates between `a` and `b` by fraction `t`.\n-\n-Basically Lerp but with wrapping\n-@param a number Goes from number A\n-@param b number To number B\n-@param t number Interpolated by T\n-@param w number Wraps at\n-@return number"
},
{
"name": "AutoLerpWrap",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoLerpWrap(a, b, t, w)\nlocal m = w\nlocal da = (b - a) % m\nlocal n = (da * 2) % m - da\nreturn a + n * t\nend",
"tables": {},
"function_definition": "-Moves `a` towards `b` by amount `t`\n-\n-Will clamp as to not overshoot\n-@param a number Goes from number A\n-@param b number To number B\n-@param t number Moved by T\n-@return number"
},
{
"name": "AutoMove",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoMove(a, b, t)\noutput = a\nif a == b then\nreturn a\nelseif a > b then\noutput = math.max(a - t, b)\nelse\noutput = math.min(a + t, b)\nend\n\nreturn output\nend",
"tables": {},
"function_definition": "-Return the Distance between the numbers `a` and `b`\n-@param a number\n-@param b number\n-@return number"
},
{
"name": "AutoDist",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoDist(a, b)\nreturn math.abs(a - b)\nend",
"tables": {},
"function_definition": "-Normalizes all values in a table to have a magnitude of 1 - Scales every number to still represent the same \"direction\"\n-@param t table<number>\n-@param scale number?\n-@return table"
},
{
"name": "AutoNormalize",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoNormalize(t, scale)\nlocal norm = {}\nlocal maxabs = 0\nfor i = 1, #t do\nlocal abs = math.abs(t[i])\nmaxabs = abs > maxabs and abs or maxabs\nend\n\nfor i = 1, #t do\nnorm[i] = t[i] / maxabs * (scale or 1)\nend\nreturn norm\nend",
"tables": {},
"function_definition": "-Takes a table of weights, like {1, 2, 0.5, 0.5}, and produces a table of how much space each weight would take up if it were to span over a given length.\n-If given the weights {1, 2, 0.5, 0.5}, with a span length of 100, the resulting table would be = {25, 50, 12.5, 12.5}.\n-A padding parameter can also be added which can be used to make Ui easier. Iterate through the resulting table, after each UiRect, move the width + the padding parameter\n-@param weights table<number>|number weights\n-@param span number\n-@param padding number?\n-@return table"
},
{
"name": "AutoFlex",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoFlex(weights, span, padding)\nlocal istable = type(weights) == \"table\"\nweights = not istable and (",
"tables": {},
"function_definition": ""
},
{
"name": "AutoBias",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoBias(weights)\nlocal T = {}\nlocal max = 0\nfor i = 1, #weights do\nmax = max + weights[i]\nT[i] = {}\nT[i].i = i\nT[i].w = weights[i]\nend\n\ntable.sort(T,",
"tables": {},
"function_definition": ""
},
{
"name": "AutoSwizzle",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSwizzle(vec, swizzle)\nlocal swizzleMap = { x = 1, y = 2, z = 3, w = 4, r = 1, g = 2, b = 3, a = 4 }\nlocal built = {}\nfor i = 1, #swizzle do\nlocal axis = swizzle:sub(i, i)\nlocal asnum = tonumber(axis)\nbuilt[i] = vec[asnum or swizzleMap[axis]]\nend\nreturn built\nend",
"tables": {},
"function_definition": "-Returns true if each axis of vector `a` is equal to each axis of vector `b`\n-@param a vector\n-@param b vector\n-@return boolean"
},
{
"name": "AutoVecEquals",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecEquals(a, b)\nfor i, va in pairs(a) do\nif va ~= b[i] then return false end\nend\n\nreturn true\nend",
"tables": {},
"function_definition": "-Return a Random Vector with an optional offset and scale\n-@param param1 number|vector\n-@param param2 number?\n-@return vector"
},
{
"name": "AutoVecRnd",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecRnd(param1, param2)\nlocal offset, scale\nif type(param1) == \"table\" then\noffset = param1\nscale = param2 or 1\nelse\noffset = { 0, 0, 0 }\nscale = param1\nend\n\nlocal rndVec = VecNormalize({\n(math.random() * 2 - 1),\n(math.random() * 2 - 1),\n(math.random() * 2 - 1),\n})\n\nlocal v = VecAdd(offset, VecScale(rndVec, scale))\nreturn v\nend",
"tables": {},
"function_definition": "-Return the Distance between Two Vectors\n-@param a vector\n-@param b vector\n-@return number"
},
{
"name": "AutoVecDist",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecDist(a, b)\nreturn VecLength(VecSub(b, a))\nend",
"tables": {},
"function_definition": "-Return the Distance between Two Vectors, without considering the X component\n-@param a vector\n-@param b vector\n-@return number"
},
{
"name": "AutoVecDistNoX",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecDistNoX(a, b)\nreturn math.sqrt((b[2] - a[2])^2 + (b[3] - a[3])^2)\nend",
"tables": {},
"function_definition": "-Return the Distance between Two Vectors, without considering the Y component\n-@param a vector\n-@param b vector\n-@return number"
},
{
"name": "AutoVecDistNoY",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecDistNoY(a, b)\nreturn math.sqrt((b[1] - a[1])^2 + (b[3] - a[3])^2)\nend",
"tables": {},
"function_definition": "-Return the Distance between Two Vectors, without considering the Z component\n-@param a vector\n-@param b vector\n-@return number"
},
{
"name": "AutoVecDistNoZ",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecDistNoZ(a, b)\nreturn math.sqrt((b[1] - a[1])^2 + (b[2] - a[2])^2)\nend",
"tables": {},
"function_definition": "-Moves a vector in a direction by a given amount\n-\n-Equivalent to `VecAdd(vec, VecScale(dir, dist))`\n-@param vec any\n-@param dir any\n-@param dist any\n-@return vector"
},
{
"name": "AutoVecMove",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecMove(vec, dir, dist)\nreturn VecAdd(vec, VecScale(dir, dist))\nend",
"tables": {},
"function_definition": "-Returns a Vector Rounded to a number\n-@param vec vector\n-@param r number?\n-@return vector"
},
{
"name": "AutoVecRound",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecRound(vec, r)\nreturn Vec(AutoRound(vec[1], r), AutoRound(vec[2], r), AutoRound(vec[3], r))\nend",
"tables": {},
"function_definition": "-Returns a Vector where all numbers are floored\n-@param vec vector\n-@return vector"
},
{
"name": "AutoVecFloor",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecFloor(vec)\nreturn Vec(math.floor(vec[1]), math.floor(vec[2]), math.floor(vec[3]))\nend",
"tables": {},
"function_definition": "-Returns a Vector where all numbers are ceiled\n-@param vec vector\n-@return vector"
},
{
"name": "AutoVecCeil",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecCeil(vec)\nreturn Vec(math.ceil(vec[1]), math.ceil(vec[2]), math.ceil(vec[3]))\nend",
"tables": {},
"function_definition": "-Return a vector that has the magnitude of `b`, but with the direction of `a`\n-\n-Equivalent to `VecScale(VecNormalize(a), b)`\n-@param a vector\n-@param b number\n-@return vector"
},
{
"name": "AutoVecRescale",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecRescale(a, b)\nreturn VecScale(VecNormalize(a), b)\nend",
"tables": {},
"function_definition": "-Maps a Vector from range a1-a2 to range b1-b2\n-@param v vector Input Vector\n-@param a1 number Goes from the range of number a1\n-@param a2 number To number a2\n-@param b1 number To the range of b1\n-@param b2 number To number b2\n-@return vector"
},
{
"name": "AutoVecMap",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecMap(v, a1, a2, b1, b2)\nif a1 == a2 then return AutoVecRescale(v, b2) end\nlocal out = {\nAutoMap(v[1], a1, a2, b1, b2),\nAutoMap(v[2], a1, a2, b1, b2),\nAutoMap(v[3], a1, a2, b1, b2),\n}\nreturn out\nend",
"tables": {},
"function_definition": "-Limits the magnitude of a vector to be between min and max\n-@param v vector The Vector to clamp\n-@param min number? The minimum the magnitude can be, Default is 0\n-@param max number? The maximum the magnitude can be, Default is 1\n-@return vector"
},
{
"name": "AutoVecClampMagnitude",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecClampMagnitude(v, min, max)\nmin, max = AutoDefault(min, 0), AutoDefault(max, 1)\nlocal l = VecLength(v)\nif l > max then\nreturn AutoVecRescale(v, max)\nelseif l < min then\nreturn AutoVecRescale(v, min)\nelse\nreturn v\nend\nend",
"tables": {},
"function_definition": "-Limits a vector to be between min and max\n-@param v vector The Vector to clamp\n-@param min number? The minimum, Default is 0\n-@param max number? The maximum, Default is 1\n-@return vector"
},
{
"name": "AutoVecClamp",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecClamp(v, min, max)\nmin, max = AutoDefault(min, 0), AutoDefault(max, 1)\nreturn {\nAutoClamp(v[1], min, max),\nAutoClamp(v[2], min, max),\nAutoClamp(v[3], min, max)\n}\nend",
"tables": {},
"function_definition": "-Return Vec(1, 1, 1) scaled by length\n-@param length number return the vector of size length, Default is 1\n-@return vector"
},
{
"name": "AutoVecOne",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecOne(length)\nreturn VecScale(Vec(1, 1, 1), length or 1)\nend",
"tables": {},
"function_definition": "-Returns the midpoint between two vectors\n-\n-Equivalent to `VecScale(VecAdd(a, b), 0.5)`\n-@param a any\n-@param b any\n-@return vector"
},
{
"name": "AutoVecMidpoint",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecMidpoint(a, b)\nreturn VecScale(VecAdd(a, b), 0.5)\nend",
"tables": {},
"function_definition": "-Return Vec `a` multiplied by Vec `b`\n-@param a vector\n-@param b vector\n-@return vector"
},
{
"name": "AutoVecMulti",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecMulti(a, b)\nreturn {\na[1] * b[1],\na[2] * b[2],\na[3] * b[3],\n}\nend",
"tables": {},
"function_definition": "-Return Vec `a` divided by Vec `b`\n-@param a vector\n-@param b vector\n-@return vector"
},
{
"name": "AutoVecDiv",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecDiv(a, b)\nreturn {\na[1] / b[1],\na[2] / b[2],\na[3] / b[3],\n}\nend",
"tables": {},
"function_definition": "-Return Vec `a` to the Power of `b`\n-@param a vector\n-@param b number\n-@return vector"
},
{
"name": "AutoVecPow",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecPow(a, b)\nreturn {\na[1] ^ b,\na[2] ^ b,\na[3] ^ b,\n}\nend",
"tables": {},
"function_definition": "-Return Vec `a` to the Power of Vec `b`\n-@param a vector\n-@param b vector\n-@return vector"
},
{
"name": "AutoVecPowVec",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecPowVec(a, b)\nreturn {\na[1] ^ b[1],\na[2] ^ b[2],\na[3] ^ b[3],\n}\nend",
"tables": {},
"function_definition": "-Returns the absolute value of an vector\n-@param v vector\n-@return vector"
},
{
"name": "AutoVecAbs",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecAbs(v)\nreturn {\nmath.abs(v[1]),\nmath.abs(v[2]),\nmath.abs(v[3]),\n}\nend",
"tables": {},
"function_definition": "-Equivalent to `math.min(unpack(v))`\n-@param v vector\n-@return number"
},
{
"name": "AutoVecMin",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecMin(v)\nreturn math.min(unpack(v))\nend",
"tables": {},
"function_definition": "-Equivalent to `math.max(unpack(v))`\n-@param v vector\n-@return number"
},
{
"name": "AutoVecMax",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecMax(v)\nreturn math.max(unpack(v))\nend",
"tables": {},
"function_definition": "- Rotates a vector around an axis by a given angle\n- @param vec vector The vector to rotate\n- @param axis vector The rotation axis, a unit vector\n- @param angle number The rotation angle in degrees\n- @return vector vec The rotated vector"
},
{
"name": "AutoVecRotate",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecRotate(vec, axis, angle)\nlocal quat = QuatAxisAngle(axis, angle)\nreturn QuatRotateVec(quat, vec)\nend",
"tables": {},
"function_definition": "-Return `v` with it's `x` value replaced by `subx`\n-@param v vector\n-@param subx number"
},
{
"name": "AutoVecSubsituteX",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecSubsituteX(v, subx)\nlocal new = VecCopy(v)\nnew[1] = subx\nreturn new\nend",
"tables": {},
"function_definition": "-Return `v` with it's `y` value replaced by `suby`\n-@param v vector\n-@param suby number"
},
{
"name": "AutoVecSubsituteY",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecSubsituteY(v, suby)\nlocal new = VecCopy(v)\nnew[2] = suby\nreturn new\nend",
"tables": {},
"function_definition": "-Return `v` with it's `z` value replaced by `subz`\n-@param v vector\n-@param subz number"
},
{
"name": "AutoVecSubsituteZ",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecSubsituteZ(v, subz)\nlocal new = VecCopy(v)\nnew[3] = subz\nreturn new\nend",
"tables": {},
"function_definition": "-Converts the output of VecDot with normalized vectors to an angle\n-@param dot number\n-@return number"
},
{
"name": "AutoDotToAngle",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoDotToAngle(dot)\nreturn math.deg(math.acos(dot))\nend",
"tables": {},
"function_definition": "#endregion\n#region Quat Functions\n-Equivalent to `QuatRotateVec(rot, Vec(0, 0, 1))`\n-@param rot quaternion\n-@return vector"
},
{
"name": "AutoQuatFwd",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQuatFwd(rot)\nreturn QuatRotateVec(rot, Vec(0, 0, 1))\nend",
"tables": {},
"function_definition": "-Returns a random quaternion\n-@param angle number degrees\n-@return quaternion"
},
{
"name": "AutoRandomQuat",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoRandomQuat(angle)\nlocal axis = { math.random() - 0.5, math.random() - 0.5, math.random() - 0.5 }\nlocal sinHalfAngle = math.sin(math.rad(angle) / 2)\nlocal cosHalfAngle = math.cos(math.rad(angle) / 2)\nreturn Quat(\naxis[1] * sinHalfAngle,\naxis[2] * sinHalfAngle,\naxis[3] * sinHalfAngle,\ncosHalfAngle\n)\nend",
"tables": {},
"function_definition": "-Computes the dot product of two quaternions.\n-@param a quaternion\n-@param b quaternion\n-@return number"
},
{
"name": "AutoQuatDot",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQuatDot(a, b)\nreturn a[1] * b[1] + a[2] * b[2] + a[3] * b[3] + a[4] * b[4]\nend",
"tables": {},
"function_definition": "-Returns the Conjugate of the given quaternion.\n-@param quat quaternion\n-@return quaternion quat"
},
{
"name": "AutoQuatConjugate",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQuatConjugate(quat)\nreturn { -quat[1], -quat[2], -quat[3], quat[4] }\nend",
"tables": {},
"function_definition": "-Returns the Inverse of the given quaternion.\n-@param quat quaternion\n-@return quaternion quat"
},
{
"name": "AutoQuatInverse",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQuatInverse(quat)\nlocal norm = quat[1] ^ 2 + quat[2] ^ 2 + quat[3] ^ 2 + quat[4] ^ 2\nlocal inverse = { -quat[1] / norm, -quat[2] / norm, -quat[3] / norm, quat[4] / norm }\nreturn inverse\nend",
"tables": {},
"function_definition": "-Between -a and a, picks the quaternion nearest to b\n-@param a quaternion\n-@param b quaternion\n-@return quaternion\n-\n-Thankyou to Mathias for this"
},
{
"name": "AutoQuatNearest",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQuatNearest(a, b)\nreturn AutoQuatDot(a, b) < 0 and { -a[1], -a[2], -a[3], -a[4] } or { a[1], a[2], a[3], a[4] }\nend",
"tables": {},
"function_definition": "-Same as `QuatAxisAngle()` but takes a single vector instead of a unit vector + an angle, for convenience\n-\n-Thankyou to Mathias for this"
},
{
"name": "AutoQuatFromAxisAngle",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQuatFromAxisAngle(v)\nlocal xyz = VecScale(v, 0.5)\nlocal angle = VecLength(xyz)\n\nif angle == 0 then\nreturn Quat()\nend\n\nlocal co = math.cos(angle)\nlocal si = math.sin(angle)\nlocal qXYZ = VecScale(xyz, si / angle)\nreturn Quat(qXYZ[1], qXYZ[2], qXYZ[3], co)\nend",
"tables": {},
"function_definition": "-Converts a quaternion to an axis angle representation\n-Returns a rotation vector where axis is the direction and angle is the length\n-\n-Thankyou to Mathias for this"
},
{
"name": "AutoQuatToAxisAngle",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQuatToAxisAngle(q)\nlocal qXYZ = Vec(q[1], q[2], q[3])\nlocal co = q[4]\nlocal si = VecLength(qXYZ)\n\nif si == 0 then\nreturn VecScale(qXYZ, 2.0 / co)\nend\n\nlocal angle = math.atan2(si, co)\nreturn VecScale(qXYZ, 2.0 * angle / si)\nend",
"tables": {},
"function_definition": "#endregion\n#region AABB Bounds Functions\n-Get the center of a body's bounds\n-@param body body_handle\n-@return vector"
},
{
"name": "AutoBodyCenter",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoBodyCenter(body)\nlocal aa, bb = GetBodyBounds(body)\nreturn VecScale(VecAdd(aa, bb), 0.5)\nend",
"tables": {},
"function_definition": "-Get the center of a shapes's bounds\n-@param shape shape_handle\n-@return vector"
},
{
"name": "AutoShapeCenter",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoShapeCenter(shape)\nlocal aa, bb = GetShapeBounds(shape)\nreturn VecScale(VecAdd(aa, bb), 0.5)\nend",
"tables": {},
"function_definition": "-Expands a given boudns to include a point\n-@param aa vector\n-@param bb vector\n-@param ... vector Points, can be one or multiple\n-@return vector\n-@return vector"
},
{
"name": "AutoAABBInclude",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBInclude(aa, bb, ...)\nfor _, point in ipairs(arg) do\naa, bb = {\nmath.min(aa[1], point[1]),\nmath.min(aa[2], point[2]),\nmath.min(aa[3], point[3]),\n}, {\nmath.max(bb[1], point[1]),\nmath.max(bb[2], point[2]),\nmath.max(bb[3], point[3]),\n}\nend\n\nreturn aa, bb\nend",
"tables": {},
"function_definition": "-Returns a Axis ALigned Bounding Box with the center of pos\n-@param pos vector\n-@param halfextents vector|number\n-@return vector lower-bound\n-@return vector upper-bound"
},
{
"name": "AutoAABBBoxFromPoint",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBBoxFromPoint(pos, halfextents)\nif type(halfextents) == \"number\" then\nhalfextents = AutoVecOne(halfextents)\nend\n\nreturn VecSub(pos, halfextents), VecAdd(pos, halfextents)\nend",
"tables": {},
"function_definition": "-Takes two vectors and modifys them so they can be used in other bound"
},
{
"name": "AutoAABBCorrection",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBCorrection(aa, bb)\nlocal min, max = VecCopy(aa), VecCopy(bb)\n\nif bb[1] < aa[1] then\nmin[1] = bb[1]\nmax[1] = aa[1]\nend\nif bb[2] < aa[2] then\nmin[2] = bb[2]\nmax[2] = aa[2]\nend\nif bb[3] < aa[3] then\nmin[3] = bb[3]\nmax[3] = aa[3]\nend\n\nreturn min, max\nend",
"tables": {},
"function_definition": "-Get a position inside or on the Input Bounds\n-@param aa vector lower-bound\n-@param bb vector upper-bound\n-@param vec vector? A normalized Vector pointing towards the position that should be retrieved, Default is Vec(0, 0, 0)\n-@return vector"
},
{
"name": "AutoAABBGetPos",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBGetPos(aa, bb, vec)\nvec = AutoDefault(vec, Vec(0, 0, 0))\n\nvec = AutoVecMap(vec, -1, 1, 0, 1)\nlocal sizevec = VecSub(bb, aa)\n\nlocal size = VecLength(sizevec)\nlocal scaled = AutoVecMulti(vec, sizevec)\nreturn VecAdd(scaled, aa)\nend",
"tables": {},
"function_definition": "-Get the corners of the given Bounds\n-@param aa vector lower-bound\n-@param bb vector upper-bound\n-@return table"
},
{
"name": "AutoAABBGetCorners",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBGetCorners(aa, bb)\nlocal mid = {}\nfor i = 1, 3 do\nmid[i] = (aa[i] + bb[i]) / 2\nend\n\nlocal corners = {\n{ bb[1], mid[2], mid[3] },\n{ aa[1], mid[2], mid[3] },\n{ mid[1], bb[2], mid[3] },\n{ mid[1], aa[2], mid[3] },\n{ mid[1], mid[2], bb[3] },\n{ mid[1], mid[2], aa[3] },\n{ aa[1], bb[2], mid[3] },\n{ bb[1], aa[2], mid[3] }\n}\n\nreturn corners\nend",
"tables": {},
"function_definition": "-Get data about the size of the given Bounds\n-@param aa vector lower-bound\n-@param bb vector upper-bound\n-@return table representing the size of the Bounds\n-@return number smallest smallest edge size of the Bounds\n-@return number longest longest edge size of the Bounds"
},
{
"name": "AutoAABBSize",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBSize(aa, bb)\nlocal size = VecSub(bb, aa)\nlocal minval = math.min(unpack(size))\nlocal maxval = math.max(unpack(size))\n\nreturn size, minval, maxval\nend",
"tables": {},
"function_definition": "-Takes a given AABB and subdivides into new AABBs\n-@param aa vector lower-bound\n-@param bb vector upper-bound\n-@param levels number?\n-@return table"
},
{
"name": "AutoAABBSubdivideBounds",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBSubdivideBounds(aa, bb, levels)\nlevels = levels or 1\nlocal bounds = { { aa, bb } }\n\nfor level = 1, levels do\nlocal newBounds = {}\n\nfor _, bound in ipairs(bounds) do\nlocal mid = {}\nfor i = 1, 3 do\nmid[i] = (bound[1][i] + bound[2][i]) / 2\nend\n\ntable.insert(newBounds, { { bound[1][1], mid[2], mid[3] }, { mid[1], bound[2][2], bound[2][3] } })\ntable.insert(newBounds, { { mid[1], mid[2], mid[3] }, { bound[2][1], bound[2][2], bound[2][3] } })\ntable.insert(newBounds, { { mid[1], bound[1][2], mid[3] }, { bound[2][1], mid[2], bound[2][3] } })\ntable.insert(newBounds, { { bound[1][1], bound[1][2], mid[3] }, { mid[1], mid[2], bound[2][3] } })\ntable.insert(newBounds, { { bound[1][1], mid[2], bound[1][3] }, { mid[1], bound[2][2], mid[3] } })\ntable.insert(newBounds, { { mid[1], mid[2], bound[1][3] }, { bound[2][1], bound[2][2], mid[3] } })\ntable.insert(newBounds, { { mid[1], bound[1][2], bound[1][3] }, { bound[2][1], mid[2], mid[3] } })\ntable.insert(newBounds, { { bound[1][1], bound[1][2], bound[1][3] }, { mid[1], mid[2], mid[3] } })\nend\n\nbounds = newBounds\nend\n\nreturn bounds\nend",
"tables": {},
"function_definition": "-Draws a given Axis Aligned Bounding Box\n-@param aa vector lower-bound\n-@param bb vector upper-bound\n-@param colorR number?\n-@param colorG number?\n-@param colorB number?\n-@param alpha number?\n-@param rgbcolors boolean?\n-@param draw boolean?"
},
{
"name": "AutoDrawAABB",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoDrawAABB(aa, bb, colorR, colorG, colorB, alpha, rgbcolors, draw)\ncolorR = AutoDefault(colorR, 0)\ncolorG = AutoDefault(colorG, 0)\ncolorB = AutoDefault(colorB, 0)\nalpha = AutoDefault(alpha, 1)\nrgbcolors = AutoDefault(rgbcolors, false)\ndraw = AutoDefault(draw, false)\n\nlocal min, max = {\n[1] = Vec(aa[1], aa[2], aa[3]),\n[2] = Vec(bb[1], aa[2], aa[3]),\n[3] = Vec(bb[1], aa[2], bb[3]),\n[4] = Vec(aa[1], aa[2], bb[3]),\n}, {\n[1] = Vec(aa[1], bb[2], aa[3]),\n[2] = Vec(bb[1], bb[2], aa[3]),\n[3] = Vec(bb[1], bb[2], bb[3]),\n[4] = Vec(aa[1], bb[2], bb[3]),\n}\n\nlocal lines = {\n{ min[2], min[3], colorR, colorG, colorB, alpha },\n{ min[3], min[4], colorR, colorG, colorB, alpha },\n{ max[1], max[2], colorR, colorG, colorB, alpha },\n{ max[4], max[1], colorR, colorG, colorB, alpha },\n{ min[2], max[2], colorR, colorG, colorB, alpha },\n{ min[4], max[4], colorR, colorG, colorB, alpha },\n\n{ min[1], min[2], rgbcolors and 1 or colorR, rgbcolors and 0 or colorG, rgbcolors and 0 or colorB, alpha },\n{ max[2], max[3], rgbcolors and 0 or colorR, rgbcolors and 1 or colorG, rgbcolors and 0 or colorB, alpha },\n{ max[3], max[4], rgbcolors and 1 or colorR, rgbcolors and 0 or colorG, rgbcolors and 0 or colorB, alpha },\n{ min[1], max[1], rgbcolors and 0 or colorR, rgbcolors and 0 or colorG,\nrgbcolors and 1 or rgbcolors and 0 or colorB, alpha },\n{ min[3], max[3], rgbcolors and 0 or colorR, rgbcolors and 0 or colorG,\nrgbcolors and 1 or rgbcolors and 0 or colorB, alpha },\n{ min[4], min[1], rgbcolors and 0 or colorR, rgbcolors and 1 or colorG, rgbcolors and 0 or colorB, alpha },\n}\n\nlocal DrawLine = DrawLine\nlocal DebugLine = DebugLine\n\nfor i, v in ipairs(lines) do\nif draw then\nDrawLine(unpack(v))\nelse\nDebugLine(unpack(v))\nend\nend\nend",
"tables": {},
"function_definition": "This code made me want to give up\n#endregion\n#region OBB Bounds Functions\n-@class OBB: { pos:vector, rot:quaternion, size:vector }|transform\n-Converts an Axis Aligned Bounding Box to a Oriented Bounding Box\n-@param aa vector\n-@param bb vector\n-@return OBB"
},
{
"name": "AutoAABBToOBB",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoAABBToOBB(aa, bb)\nlocal center = VecLerp(bb, aa, 0.5)\nlocal size = VecSub(bb, aa)\nreturn { pos = center, rot = QuatEuler(), size = size }\nend",
"tables": {},
"function_definition": "-Defines a Oriented Bounding Box\n-@param center vector\n-@param rot quaternion\n-@param size vector|number?\n-@return table"
},
{
"name": "AutoOBB",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoOBB(center, rot, size)\nreturn {\npos = center or Vec(),\nrot = rot or QuatEuler(),\nsize = type(size) == 'table' and size or AutoVecOne(size or 1)\n}\nend",
"tables": {},
"function_definition": "-Returns the corners of a Oriented Bounding Box\n-@param obb OBB\n-@return { xyz:table, Xyz:table, xYz:table, xyZ:table, XYz:table, XyZ:table, xYZ:table, XYZ:table }"
},
{
"name": "AutoGetOBBCorners",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoGetOBBCorners(obb)\nlocal corners = {}\n\nlocal hs = VecScale(obb.size, 0.5)\ncorners.xyz = TransformToParentPoint(obb, VecScale(hs, -1))\ncorners.Xyz = TransformToParentPoint(obb, Vec(hs[1], -hs[2], -hs[3]))\ncorners.xYz = TransformToParentPoint(obb, Vec(-hs[1], hs[2], -hs[3]))\ncorners.xyZ = TransformToParentPoint(obb, Vec(-hs[1], -hs[2], hs[3]))\ncorners.XYz = TransformToParentPoint(obb, Vec(hs[1], hs[2], -hs[3]))\ncorners.XyZ = TransformToParentPoint(obb, Vec(hs[1], -hs[2], hs[3]))\ncorners.xYZ = TransformToParentPoint(obb, Vec(-hs[1], hs[2], hs[3]))\ncorners.XYZ = TransformToParentPoint(obb, hs)\n\nreturn corners\nend",
"tables": {},
"function_definition": "Calculate the eight corner points of the OBB based on the center, dimensions, and orientation\n-Returns the planes and corners representing the faces of a Oriented Bounding Box\n-@param obb OBB\n-@return { z:plane, zn:plane, x:plane, xn:plane, y:plane, yn:plane }\n-@return { xyz:table, Xyz:table, xYz:table, xyZ:table, XYz:table, XyZ:table, xYZ:table, XYZ:table }"
},
{
"name": "AutoGetOBBFaces",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoGetOBBFaces(obb)\nlocal corners = AutoGetOBBCorners(obb)\n\nlocal faces = {}\nfaces.z = AutoPlane(\nVecLerp(corners.xyZ, corners.XYZ, 0.5),\nQuatRotateQuat(obb.rot, QuatEuler(180, 0, 0)),\n{ obb.size[1], obb.size[2] }\n)\nfaces.zn = AutoPlane(\nVecLerp(corners.xyz, corners.XYz, 0.5),\nQuatRotateQuat(obb.rot, QuatEuler(0, 0, 0)),\n{ obb.size[1], obb.size[2] }\n)\nfaces.x = AutoPlane(\nVecLerp(corners.Xyz, corners.XYZ, 0.5),\nQuatRotateQuat(obb.rot, QuatEuler(0, -90, -90)),\n{ obb.size[2], obb.size[3] }\n)\nfaces.xn = AutoPlane(\nVecLerp(corners.xyz, corners.xYZ, 0.5),\nQuatRotateQuat(obb.rot, QuatEuler(0, 90, 90)),\n{ obb.size[2], obb.size[3] }\n)\nfaces.y = AutoPlane(\nVecLerp(corners.xYz, corners.XYZ, 0.5),\nQuatRotateQuat(obb.rot, QuatEuler(90, 0, 0)),\n{ obb.size[1], obb.size[3] }\n)\nfaces.yn = AutoPlane(\nVecLerp(corners.xyz, corners.XyZ, 0.5),\nQuatRotateQuat(obb.rot, QuatEuler(-90, 180, 0)),\n{ obb.size[1], obb.size[3] }\n)\n\nreturn faces, corners\nend",
"tables": {},
"function_definition": "-Returns a table representing the lines connecting the sides of a Oriented Bounding Box\n-@param obb OBB\n-@return table<{ [1]:vector, [2]:vector }>"
},
{
"name": "AutoOBBLines",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoOBBLines(obb)\nlocal c = AutoGetOBBCorners(obb)\n\nreturn {\n{ c.xyz, c.Xyz },\n{ c.xYz, c.XYz },\n{ c.xyZ, c.XyZ },\n{ c.xYZ, c.XYZ },\n\n{ c.xyz, c.xYz },\n{ c.Xyz, c.XYz },\n{ c.xyZ, c.xYZ },\n{ c.XyZ, c.XYZ },\n\n{ c.xyz, c.xyZ },\n{ c.Xyz, c.XyZ },\n{ c.xYz, c.xYZ },\n{ c.XYz, c.XYZ },\n}\nend",
"tables": {},
"function_definition": "-@param shape shape_handle\n-@return OBB"
},
{
"name": "AutoGetShapeOBB",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoGetShapeOBB(shape)\nlocal transform = GetShapeWorldTransform(shape)\nlocal x, y, z, scale = GetShapeSize(shape)\nlocal size = VecScale(Vec(x, y, z), scale)\n\nlocal center = TransformToParentPoint(transform, VecScale(size, 0.5))\nreturn AutoOBB(center, transform.rot, size)\nend",
"tables": {},
"function_definition": "-Draws a given Oriented Bounding Box\n-@param obb OBB\n-@param red number? Default is 0\n-@param green number? Default is 0\n-@param blue number? Default is 0\n-@param alpha number? Default is 1\n-@param line"
},
{
"name": "AutoPlane",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoPlane(pos, rot, size)\nreturn { pos = pos or Vec(), rot = rot or Quat(), size = size or { 1, 1 } }\nend",
"tables": {},
"function_definition": "-@param plane plane\n-@return { [1]:vector, [2]:vector, [3]:vector, [4]:vector }"
},
{
"name": "AutoGetPlaneCorners",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoGetPlaneCorners(plane)\nlocal size = VecScale(plane.size, 0.5)\n\nlocal corner1 = Vec(-size[1], -size[2])\nlocal corner2 = Vec(size[1], -size[2])\nlocal corner3 = Vec(size[1], size[2])\nlocal corner4 = Vec(-size[1], size[2])\n\ncorner1 = TransformToParentPoint(plane, corner1)\ncorner2 = TransformToParentPoint(plane, corner2)\ncorner3 = TransformToParentPoint(plane, corner3)\ncorner4 = TransformToParentPoint(plane, corner4)\n\nreturn { corner1, corner2, corner3, corner4 }\nend",
"tables": {},
"function_definition": "Rotate corners using the quaternion rotation from the plane object\n-@param plane plane\n-@param startPos vector\n-@param direction vector\n-@param oneway boolean?\n-@return { hit:boolean, intersection:vector, normal:vector, dist:number, dot:number }"
},
{
"name": "AutoRaycastPlane",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoRaycastPlane(plane, startPos, direction, oneway)\nlocal pos = plane.pos or Vec(0, 0, 0)\nlocal rot = plane.rot or Quat()\nlocal size = plane.size or Vec(1, 1, 1)\n\nlocal halfsize = VecScale(size, 0.5)\nlocal corner1 = VecAdd(pos, QuatRotateVec(rot, Vec(-halfsize[1], -halfsize[2], 0)))\nlocal corner2 = VecAdd(pos, QuatRotateVec(rot, Vec(halfsize[1], -halfsize[2], 0)))\nlocal corner3 = VecAdd(pos, QuatRotateVec(rot, Vec(halfsize[1], halfsize[2], 0)))\nlocal corner4 = VecAdd(pos, QuatRotateVec(rot, Vec(-halfsize[1], halfsize[2], 0)))\n\nlocal normal = QuatRotateVec(rot, { 0, 0, -1 })\n\nlocal rayDirDotNormal = VecDot(direction, normal)\nif (oneway and rayDirDotNormal or math.abs(rayDirDotNormal)) < 0 then\nreturn { hit = false, normal = normal, dist = 1 / 0, dot = rayDirDotNormal }\nelse\nlocal rayToPlane = VecSub(startPos, pos)\nlocal t = -VecDot(rayToPlane, normal) / rayDirDotNormal\nlocal intersection = VecAdd(startPos, VecScale(direction, t))\n\nlocal dist = AutoVecDist(startPos, intersection)\n\nlocal edge1 = VecSub(corner2, corner1)\nlocal edge2 = VecSub(corner3, corner2)\nlocal edge3 = VecSub(corner4, corner3)\nlocal edge4 = VecSub(corner1, corner4)\nlocal vec1 = VecSub(intersection, corner1)\nlocal vec2 = VecSub(intersection, corner2)\nlocal vec3 = VecSub(intersection, corner3)\nlocal vec4 = VecSub(intersection, corner4)\n\nlocal isInside = true\nlocal",
"tables": {},
"function_definition": "Ray is parallel to plane, or wrong way; no intersection\nCheck if the intersection is inside the plane's bounds"
},
{
"name": "checkInsideEdge",
"arguments": [],
"returns": [],
"examples": [],
"description": "function checkInsideEdge(vec, edge)\nif VecDot(edge, vec) < 0 then\nisInside = false\nend\nend\n\ncheckInsideEdge(vec1, edge1)\ncheckInsideEdge(vec2, edge2)\ncheckInsideEdge(vec3, edge3)\ncheckInsideEdge(vec4, edge4)\n\nreturn {\nhit = isInside and t > 0,\nintersection = intersection,\nnormal = normal,\ndist = dist,\ndot = rayDirDotNormal,\n}\nend\nend",
"tables": {},
"function_definition": "-@param plane plane\n-@param pattern 0|1|2|3\n-@param patternstrength number\n-@param oneway boolean?\n-@param r number?\n-@param g number?\n-@param b number?\n-@param a number?\n-@param line"
},
{
"name": "AutoProcessOctree",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoProcessOctree(BoundsAA, BoundsBB, Layers, conditionalFuction, _layer)\n_layer = _layer or 1\nif _layer >= (Layers or 5) + 1 then return end\n\nconditionalFuction = AutoDefault(conditionalFuction, AutoQueryBoundsForBody)\n\nlocal check, querydata = conditionalFuction(BoundsAA, BoundsBB)\nlocal node = {\naa = BoundsAA,\nbb = BoundsBB,\ncheck = check,\nquerydata = querydata,\nlayer = _layer,\nchildren = {},\n}\n\nif check then\nfor _, nb in ipairs(AutoAABBSubdivideBounds(BoundsAA, BoundsBB)) do\nlocal aa, bb = unpack(nb)\nnode.children[#node.children + 1] = AutoProcessOctree(aa, bb, Layers, conditionalFuction, _layer + 1)\nend\nend\n\nreturn node\nend",
"tables": {},
"function_definition": "-Undocumented\n-@param aa vector\n-@param bb vector\n-@return boolean\n-@return table"
},
{
"name": "AutoQueryBoundsForBody",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoQueryBoundsForBody(aa, bb)\nQueryRequire('physical large')\nlocal mid = VecLerp(aa, bb, 0.5)\nlocal radius = AutoVecDist(aa, bb) * 0.707 / 2\nlocal hit, point, normal, shape = QueryClosestPoint(mid, radius)\nreturn hit, { pos = point, normal = normal, shape }\nend",
"tables": {},
"function_definition": "-Draws the Octree from AutoProcessOctree\n-@param node table\n-@param layer number\n-@param draw"
},
{
"name": "AutoSimInstance",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSimInstance()\nlocal t = {\nPoints = {\n\n},\nSettings = {\nSteps = 1,\nPointsAffectBodies = true,\n}\n}",
"tables": {},
"function_definition": "-Creates a Point to be Simulated with SimInstance:CreatePoint(), you can add parameters after it is created and change existing ones, such as point.reflectivity, and point.mass\n-@param Position vector? Default is Vec(0, 0, 0)\n-@param Velocity vector? Default is Vec(0, 0, 0)\n-@return table point\n-@return number newindex"
},
{
"name": "AutoSM_Define",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_Define(initial, frequency, dampening, response, raw_k)\nlocal sosdata = {\ntype = type(initial) == 'table' and 'table' or 'single',\ndata = {},\nk_values = {\nraw_k and frequency or (dampening / (math.pi * frequency)),\nraw_k and dampening or (1 / (2 * math.pi * frequency) ^ 2),\nraw_k and response or (response * dampening / (2 * math.pi * frequency)),\n}\n}\n\nif sosdata.type ~= 'single' then\nfor k, v in pairs(initial) do\nsosdata.data[k] = {\ncurrent = v,\nprevious = v,\nvelocity = 0\n}\nend\nelse\nsosdata.data = {\ncurrent = initial,\nprevious = initial,\nvelocity = 0\n}\nend\n\n\nreturn sosdata\nend",
"tables": {},
"function_definition": "-Returns a table representing a Second Order System (SOS) that can be used to make secondary motion\n-@param initial number|table<number>\n-@param frequency number\n-@param dampening number\n-@param response number\n-@param raw_k boolean?\n-@return Secondary_Motion_Data"
},
{
"name": "AutoSM_DefineQuat",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_DefineQuat(initial, frequency, dampening, response, raw_k)\nlocal sosdata = {\ntype = 'quaternion',\ndata = {\ncurrent = QuatCopy(initial),\nprevious = QuatCopy(initial),\nvelocity = Vec(), -- Angular velocity as a vector\n},\nk_values = {\nraw_k and frequency or (dampening / (math.pi * frequency)),\nraw_k and dampening or (1 / ((2 * math.pi * frequency) ^ 2)),\nraw_k and response or (dampening * response / (2 * math.pi * frequency)),\n}\n}\n\nreturn sosdata\nend",
"tables": {},
"function_definition": "-Updates the state of the Second Order System (SOS) towards the target value, over the specified timestep.\n-This"
},
{
"name": "AutoSM_Update",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_Update(sm, target, timestep)\ntimestep = timestep or GetTimeStep()\n\nif sm.type ~= 'quaternion' then\nlocal",
"tables": {},
"function_definition": ""
},
{
"name": "update",
"arguments": [],
"returns": [],
"examples": [],
"description": "function update(v, t)\nlocal xd = (t - v.previous) / timestep\nv.previous = t\n\nlocal k2_stable = math.max(sm.k_values[2], timestep ^ 2 / 2 + timestep * sm.k_values[1] / 2,\ntimestep * sm.k_values[1])\nv.current = v.current + timestep * v.velocity\nv.velocity = v.velocity +\ntimestep * (t + sm.k_values[3] * xd - v.current - sm.k_values[1] * v.velocity) / k2_stable\nend\n\nif sm.type == 'single' then\nupdate(sm.data, target)\nelse\nfor k, v in pairs(sm.data) do\nupdate(v, target[k])\nend\nend\nelse\nlocal q = QuatRotateQuat(AutoQuatConjugate(sm.data.previous), AutoQuatNearest(target, sm.data.previous))\nlocal dx = AutoQuatToAxisAngle(q)\ndx = VecScale(dx, 1 / timestep)\n\nsm.data.previous = QuatCopy(target)\n\nlocal qVel = AutoQuatFromAxisAngle(VecScale(sm.data.velocity, timestep))\nsm.data.current = QuatRotateQuat(sm.data.current, qVel) -- Rotate\n\nlocal q2 = QuatRotateQuat(AutoQuatConjugate(sm.data.current), AutoQuatNearest(target, sm.data.current))\nlocal s = AutoQuatToAxisAngle(q2)\nlocal k2_stable = math.max(sm.k_values[2], timestep * timestep / 2 + timestep * sm.k_values[1] / 2, timestep * sm.k_values[1])\n\nsm.data.velocity = VecAdd(sm.data.velocity, VecScale(VecScale(VecAdd(s, VecSub(VecScale(dx, sm.k_values[3]), VecScale(sm.data.velocity, sm.k_values[1]))), timestep), 1 / k2_stable))\nend\nend",
"tables": {},
"function_definition": "Compute the quaternion that will rotate the last quaternion to the desired quaternion\nConvert it to an axis-angle rotation vector\nConvert our angular velocity to a quaternion\ndesired - sos.data.current, in quaternion form\n- \"wtf\" - Autumn\n-Returns the current value of a Second Order System\n-@param sm Secondary_Motion_Data\n-@return number|table<number>|quaternion"
},
{
"name": "AutoSM_Get",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_Get(sm)\nif sm.type ~= 'table' then\nreturn sm.data.current\nelse\nlocal values = {}\nfor k, v in pairs(sm.data) do\nvalues[k] = v.current\nend\n\nreturn values\nend\nend",
"tables": {},
"function_definition": "-Returns the current velocity of a Second Order System\n-@param sm Secondary_Motion_Data\n-@return number|table<number>"
},
{
"name": "AutoSM_GetVelocity",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_GetVelocity(sm)\nif sm.type ~= 'table' then\nreturn sm.data.velocity\nelse\nreturn AutoTableSubi(sm.data, 'velocity')\nend\nend",
"tables": {},
"function_definition": "-Sets the current values of a Second Order System\n-@param sm Secondary_Motion_Data\n-@param target number|table<number>|quaternion\n-@param keep_velocity boolean?"
},
{
"name": "AutoSM_Set",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_Set(sm, target, keep_velocity)\nif sm.type ~= 'table' then\nsm.data.current = target\nsm.data.previous = target\nif not keep_velocity then\n\nsm.data.velocity = 0\nend\nelse\nfor k, v in pairs(sm.data) do\nv.current = target[k]\nv.previous = target[k]\n\nif not keep_velocity then\nv.velocity = 0\nend\nend\nend\nend",
"tables": {},
"function_definition": "-Sets the current velocity of a Second Order System\n-@param sm Secondary_Motion_Data\n-@param velocity number|table<number>"
},
{
"name": "AutoSM_SetVelocity",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_SetVelocity(sm, velocity)\nif sm.type == 'single' then\nsm.data.velocity = velocity\nelseif sm.type == 'quaternion' then\nsm.data.velocity = AutoEulerTable(velocity)\nelse\nfor k, v in pairs(sm.data) do\nv.velocity = velocity[k]\nend\nend\nend",
"tables": {},
"function_definition": "-Adds a amount to the current velocity of a Second Order System\n-@param sm Secondary_Motion_Data\n-@param velocity number|table<number>"
},
{
"name": "AutoSM_AddVelocity",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_AddVelocity(sm, velocity)\nif sm.type == 'single' then\nsm.data.velocity = sm.data.velocity + velocity\nelseif sm.type == 'quaternion' then\nsm.data.velocity = VecAdd(sm.data.velocity, AutoEulerTable(velocity))\nelse\nfor k, v in pairs(sm.data) do\nv.velocity = v.velocity + velocity[k]\nend\nend\nend",
"tables": {},
"function_definition": "-Recalculates The K values for a Second Order System\n-@param sm Secondary_Motion_Data\n-@param frequency number\n-@param dampening number\n-@param response number\n-@param raw_k boolean?"
},
{
"name": "AutoSM_RecalculateK",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSM_RecalculateK(sm, frequency, dampening, response, raw_k)\nsm.k_values = {\nraw_k and frequency or (dampening / (math.pi * frequency)),\nraw_k and dampening or (1 / (2 * math.pi * frequency) ^ 2),\nraw_k and response or (response * dampening / (2 * math.pi * frequency)),\n}\nend",
"tables": {},
"function_definition": "#endregion\n#region Table Functions\n-Returns the amount of elements in the given list.\n-@param t table\n-@return integer"
},
{
"name": "AutoTableCount",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableCount(t)\nlocal c = 0\nfor i in pairs(t) do\nc = c + 1\nend\n\nreturn c\nend",
"tables": {},
"function_definition": "-Repeats a value `v`, `r` amount of times\n-@param v any\n-@param r integer\n-@return table"
},
{
"name": "AutoTableRepeatValue",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableRepeatValue(v, r)\nlocal t = {}\nfor i=1,r do\nt[#t+1] = type(v) == 'table' and AutoTableDeepCopy(v) or v\nend\nreturn t\nend",
"tables": {},
"function_definition": "-Concats Table 2 onto the end of Table 1, does not return anything\n-@param t1 table\n-@param t2 table"
},
{
"name": "AutoTableConcat",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableConcat(t1, t2)\nfor i = 1, #t2 do\nt1[#t1 + 1] = t2[i]\nend\nend",
"tables": {},
"function_definition": "-Merges two tables together, does not return anything\n-@param base table\n-@param overwrite table"
},
{
"name": "AutoTableMerge",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableMerge(base, overwrite)\nfor k, v in pairs(overwrite) do\nif type(v) == \"table\" then\nif type(base[k] or false) == \"table\" then\nAutoTableMerge(base[k], v)\nelse\nbase[k] = v\nend\nelse\nbase[k] = v\nend\nend\nend",
"tables": {},
"function_definition": "-A lambda like"
},
{
"name": "AutoTableSub",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableSub(t, key)\nlocal _t = {}\nfor i, v in pairs(t) do\n_t[i] = v[key]\nend\nreturn _t\nend",
"tables": {},
"function_definition": "-A lambda like"
},
{
"name": "AutoTableSubi",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableSubi(t, key)\nlocal _t = {}\nfor i, v in ipairs(t) do\n_t[i] = v[key]\nend\nreturn _t\nend",
"tables": {},
"function_definition": "-Swaps the keys and the values of a table\n-@param t table\n-@return table"
},
{
"name": "AutoTableSwapKeysAndValues",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableSwapKeysAndValues(t)\nlocal _t = {}\nfor k, v in pairs(t) do\n_t[v] = k\nend\nreturn _t\nend",
"tables": {},
"function_definition": "-Equivalent to\n-```\n-for i, v in pairs(t) do\n- v[key] = tset[i]\n-end\n-```\n-@param t table\n-@param key any\n-@param tset table"
},
{
"name": "AutoTableAppend",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableAppend(t, key, tset)\nfor i, v in pairs(t) do\nv[key] = tset[i]\nend\nend",
"tables": {},
"function_definition": "-Returns true and the index if the v is in t, otherwise returns false and nil\n-@param t table\n-@param v any\n-@return boolean, unknown"
},
{
"name": "AutoTableContains",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableContains(t, v)\nfor i, v2 in ipairs(t) do\nif v == v2 then\nreturn true, i\nend\nend\nreturn false, nil\nend",
"tables": {},
"function_definition": "-Returns the Last item of a given list\n-@param t table\n-@return any"
},
{
"name": "AutoTableLast",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableLast(t)\nreturn t[AutoTableCount(t)]\nend",
"tables": {},
"function_definition": "-Copy a Table Recursivly Stolen from http://lua-users.org/wiki/CopyTable\n-@generic T : table\n-@param orig T\n-@param copies table?\n-@return T"
},
{
"name": "AutoTableDeepCopy",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableDeepCopy(orig, copies)\ncopies = copies or {}\nlocal orig_type = type(orig)\nlocal copy\nif orig_type == 'table' then\nif copies[orig] then\ncopy = copies[orig]\nelse\ncopy = {}\ncopies[orig] = copy\nfor orig_key, orig_value in next, orig, nil do\ncopy[AutoTableDeepCopy(orig_key, copies)] = AutoTableDeepCopy(orig_value, copies)\nend\nsetmetatable(copy, AutoTableDeepCopy(getmetatable(orig), copies))\nend\nelse -- number, string, boolean, etc\ncopy = orig\nend\nreturn copy\nend",
"tables": {},
"function_definition": "#endregion\n#region Utility Functions\n-If val is nil, return default instead\n-@param v any\n-@param default any\n-@return any"
},
{
"name": "AutoDefault",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoDefault(v, default)\nif v == nil then return default else return v end\nend",
"tables": {},
"function_definition": "-Calls"
},
{
"name": "AutoExecute",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoExecute(f, ...)\nif not f then return end\n\nif type(f) == \"",
"tables": {},
"function_definition": ""
},
{
"name": "AutoVecTableLerp",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecTableLerp(a, b, t)\nlocal c = {}\nfor k, _ in pairs(a) do\nc[k] = VecLerp(a[k], b[k], t)\nend\nreturn c\nend",
"tables": {},
"function_definition": "-Calls VecLerp on a table of Vectors\n-@param a table A table of values\n-@param b table A table of values the same size of a\n-@param t number\n-@return table"
},
{
"name": "AutoTableLerp",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTableLerp(a, b, t)\nlocal c = {}\nfor k, _ in pairs(a) do\nc[k] = AutoLerp(a[k], b[k], t)\nend\nreturn c\nend",
"tables": {},
"function_definition": "-Returns a Linear Interpolated Transform, Interpolated by t.\n-@param a transform\n-@param b transform\n-@param t number\n-@param t2 number?\n-@return table"
},
{
"name": "AutoTransformLerp",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTransformLerp(a, b, t, t2)\nif t2 == nil then\nt2 = t\nend\nreturn Transform(\nVecLerp(a.pos, b.pos, t),\nQuatSlerp(a.rot, b.rot, t2)\n)\nend",
"tables": {},
"function_definition": "-Equivalent to `QuatRotateVec(t.rot, Vec(0, 0, -(scale or 1)))`\n-@param t transform\n-@param scale number?\n-@return vector"
},
{
"name": "AutoTransformFwd",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTransformFwd(t, scale)\nreturn QuatRotateVec(t.rot, Vec(0, 0, -(scale or 1)))\nend",
"tables": {},
"function_definition": "-Equivalent to `QuatRotateVec(t.rot, Vec(0, scale or 1))`\n-@param t transform\n-@param scale number?\n-@return vector"
},
{
"name": "AutoTransformUp",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTransformUp(t, scale)\nreturn QuatRotateVec(t.rot, Vec(0, scale or 1))\nend",
"tables": {},
"function_definition": "-Equivalent to `QuatRotateVec(t.rot, Vec(scale or 1))`\n-@param t transform\n-@param scale number?\n-@return vector"
},
{
"name": "AutoTransformRight",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTransformRight(t, scale)\nreturn QuatRotateVec(t.rot, Vec(scale or 1))\nend",
"tables": {},
"function_definition": "-Equivalent to `Transform(TransformToParentPoint(t, offset), t.rot)`\n-@param t transform\n-@param offset vector\n-@return transform"
},
{
"name": "AutoTransformOffset",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoTransformOffset(t, offset)\nreturn Transform(TransformToParentPoint(t, offset), t.rot)\nend",
"tables": {},
"function_definition": "-Equivalent to `{ GetQuatEuler(quat) }`\n-@param quat quaternion\n-@return vector"
},
{
"name": "AutoEulerTable",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoEulerTable(quat)\nreturn { GetQuatEuler(quat) }\nend",
"tables": {},
"function_definition": "-Returns a Vector for easy use when put into a parameter for xml\n-@param vec any\n-@param round number\n-@return string"
},
{
"name": "AutoVecToXML",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoVecToXML(vec, round)\nround = AutoDefault(round, 0)\nreturn AutoRound(vec[1], round) .. ' ' .. AutoRound(vec[2], round) .. ' ' .. AutoRound(vec[3], round)\nend",
"tables": {},
"function_definition": "-Splits a string by a separator\n-@param inputstr string\n-@param sep string\n-@return table"
},
{
"name": "AutoSplit",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoSplit(inputstr, sep, number)\nif sep == nil then\nsep = \"%s\"\nend\nlocal t = {}\nfor str in string.gmatch(inputstr, \"([^\" .. sep .. \"]+)\") do\ntable.insert(t, number and tonumber(str) or str)\nend\nreturn t\nend",
"tables": {},
"function_definition": "-Converts a string to be capitalized following the Camel Case pattern\n-@param str string\n-@return string"
},
{
"name": "AutoCamelCase",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoCamelCase(str)\nlocal subbed = str:gsub('_', ' ')\nreturn string.gsub(\" \" .. subbed, \"%W%l\", string.upper):sub(2)\nend",
"tables": {},
"function_definition": "-Returns 3 values from HSV color space from RGB color space\n-@param hue number? The hue from 0 to 1\n-@param sat number? The saturation from 0 to 1\n-@param val number? The value from 0 to 1\n-@return number, number, number Returns the red, green, blue of the given hue, saturation, value"
},
{
"name": "AutoHSVToRGB",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoHSVToRGB(hue, sat, val)\nlocal r, g, b\n\nlocal i = math.floor(hue * 6);\nlocal f = hue * 6 - i;\nlocal p = val * (1 - sat);\nlocal q = val * (1 - f * sat);\nlocal t = val * (1 - (1 - f) * sat);\n\ni = i % 6\n\nif i == 0 then r, g, b = val, t, p\nelseif i == 1 then r, g, b = q, val, p\nelseif i == 2 then r, g, b = p, val, t\nelseif i == 3 then r, g, b = p, q, val\nelseif i == 4 then r, g, b = t, p, val\nelseif i == 5 then r, g, b = val, p, q\nend\n\nreturn r, g, b\nend",
"tables": {},
"function_definition": "-Returns 3 values from RGB color space from HSV color space\n-@param r number? The red from 0 to 1\n-@param g number? The green from 0 to 1\n-@param b number? The blue from 0 to 1\n-@return number, number, number Returns the hue, the saturation, and the value"
},
{
"name": "AutoRGBToHSV",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoRGBToHSV(r, g, b)\nr, g, b = r, g, b\nlocal max, min = math.max(r, g, b), math.min(r, g, b)\nlocal h, s, v\nv = max\n\nlocal d = max - min\nif max == 0 then s = 0 else s = d / max end\n\nif max == min then\nh = 0 -- achromatic\nelse\nif max == r then\nh = (g - b) / d\nif g < b then h = h + 6 end\nelseif max == g then h = (b - r) / d + 2\nelseif max == b then h = (r - g) / d + 4\nend\nh = h / 6\nend\n\nreturn h, s, v\nend",
"tables": {},
"function_definition": "-Converts a hex code or a table of hex codes to RGB color space\n-@param hex string|table<string>\n-@return number|table"
},
{
"name": "AutoHEXtoRGB",
"arguments": [],
"returns": [],
"examples": [],
"description": "function AutoHEXtoRGB(hex)\nlocal",
"tables": {},