-
Notifications
You must be signed in to change notification settings - Fork 0
/
Box2DWeb.d.ts
5526 lines (4583 loc) · 145 KB
/
Box2DWeb.d.ts
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
// Type definitions for bootstrap.timepicker
// Project: http://code.google.com/p/box2dweb/
// Definitions by: jbaldwin <https://github.com/jbaldwin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Box2DWeb-2.1.d.ts Copyright (c) 2012-2013 Josh Baldwin https://github.com/jbaldwin/box2dweb.d.ts
* There are a few competing javascript Box2D ports.
* This definitions file is for Box2dWeb.js ->
* http://code.google.com/p/box2dweb/
*
* Box2D C++ Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
declare namespace Box2D.Common {
/**
* Color for debug drawing. Each value has the range [0, 1].
**/
export class b2Color {
/**
* Red
**/
public r: number;
/**
* Green
**/
public g: number;
/**
* Blue
**/
public b: number;
/**
* RGB color as hex.
* @type uint
**/
public color: number;
/**
* Constructor
* @param rr Red value
* @param gg Green value
* @param bb Blue value
**/
constructor(rr: number, gg: number, bb: number);
/**
* Sets the Color to new RGB values.
* @param rr Red value
* @param gg Green value
* @param bb Blue value
**/
public Set(rr: number, gg: number, bb: number): void;
}
}
declare namespace Box2D.Common {
/**
* Controls Box2D global settings.
**/
export class b2Settings {
/**
* b2Assert is used internally to handle assertions. By default, calls are commented out to save performance, so they serve more as documentation than anything else.
* @param a Asset an expression is true.
**/
public static b2Assert(a: boolean): void;
/**
* Friction mixing law. Feel free to customize this.
* Friction values are usually set between 0 and 1. (0 = no friction, 1 = high friction)
* By default this is `return Math.sqrt(friction1, friction2);`
* @param friction1 Friction 1 to mix.
* @param friction2 Friction 2 to mix.
* @return The two frictions mixed as one value.
**/
public static b2MixFriction(friction1: number, friction2: number): number;
/**
* Restitution mixing law. Feel free to customize this. Restitution is used to make objects bounce.
* Restitution values are usually set between 0 and 1. (0 = no bounce (inelastic), 1 = perfect bounce (perfectly elastic))
* By default this is `return Math.Max(restitution1, restitution2);`
* @param restitution1 Restitution 1 to mix.
* @param restitution2 Restitution 2 to mix.
* @return The two restitutions mixed as one value.
**/
public static b2MixRestitution(restitution1: number, restitution2: number): number;
/**
* This is used to fatten AABBs in the dynamic tree. This allows proxies to move by a small amount without triggering a tree adjustment. This is in meters.
**/
public static b2_aabbExtension: number;
/**
* This is used to fatten AABBs in the dynamic tree. This is used to predict the future position based on the current displacement. This is a dimensionless multiplier.
**/
public static b2_aabbMultiplier: number;
/**
* A body cannot sleep if its angular velocity is above this tolerance.
**/
public static b2_angularSleepTolerance: number;
/**
* A small angle used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.
**/
public static b2_angularSlop: number;
/**
* This scale factor controls how fast overlap is resolved. Ideally this would be 1 so that overlap is removed in one time step. However using values close to 1 often lead to overshoot.
**/
public static b2_contactBaumgarte: number;
/**
* A body cannot sleep if its linear velocity is above this tolerance.
**/
public static b2_linearSleepTolerance: number;
/**
* A small length used as a collision and constraint tolerance. Usually it is chosen to be numerically significant, but visually insignificant.
**/
public static b2_linearSlop: number;
/**
* The maximum angular position correction used when solving constraints. This helps to prevent overshoot.
**/
public static b2_maxAngularCorrection: number;
/**
* The maximum linear position correction used when solving constraints. This helps to prevent overshoot.
**/
public static b2_maxLinearCorrection: number;
/**
* Number of manifold points in a b2Manifold. This should NEVER change.
**/
public static b2_maxManifoldPoints: number;
/**
* The maximum angular velocity of a body. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.
**/
public static b2_maxRotation: number;
/**
* b2_maxRotation squared
**/
public static b2_maxRotationSquared: number;
/**
* Maximum number of contacts to be handled to solve a TOI island.
**/
public static b2_maxTOIContactsPerIsland: number;
/**
* Maximum number of joints to be handled to solve a TOI island.
**/
public static b2_maxTOIJointsPerIsland: number;
/**
* The maximum linear velocity of a body. This limit is very large and is used to prevent numerical problems. You shouldn't need to adjust this.
**/
public static b2_maxTranslation: number;
/**
* b2_maxTranslation squared
**/
public static b2_maxTranslationSquared: number;
/**
* 3.141592653589793
**/
public static b2_pi: number;
/**
* The radius of the polygon/edge shape skin. This should not be modified. Making this smaller means polygons will have and insufficient for continuous collision. Making it larger may create artifacts for vertex collision.
**/
public static b2_polygonRadius: number;
/**
* The time that a body must be still before it will go to sleep.
**/
public static b2_timeToSleep: number;
/**
* Continuous collision detection (CCD) works with core, shrunken shapes. This is the amount by which shapes are automatically shrunk to work with CCD. This must be larger than b2_linearSlop.
* @see also b2_linearSlop
**/
public static b2_toiSlop: number;
/**
* A velocity threshold for elastic collisions. Any collision with a relative linear velocity below this threshold will be treated as inelastic.
**/
public static b2_velocityThreshold: number;
/**
* Maximum unsigned short value.
**/
public static USHRT_MAX: number;
/**
* The current version of Box2D.
**/
public static VERSION: string;
}
}
declare namespace Box2D.Common.Math {
/**
* A 2-by-2 matrix. Stored in column-major order.
**/
export class b2Mat22 {
/**
* Column 1
**/
public col1: b2Vec2;
/**
* Column 2
**/
public col2: b2Vec2;
/**
* Empty constructor
**/
constructor();
/**
* Sets all internal matrix values to absolute values.
**/
public Abs(): void;
/**
* Adds the two 2x2 matricies together and stores the result in this matrix.
* @param m 2x2 matrix to add.
**/
public AddM(m: b2Mat22): void;
/**
* Creates a copy of the matrix.
* @return Copy of this 2x2 matrix.
**/
public Copy(): b2Mat22;
/**
* Creates a rotation 2x2 matrix from the given angle.
* R(theta) = [ cos(theta) -sin(theta) ]
* [ sin(theta) cos(theta) ]
* @param angle Matrix angle (theta).
* @return 2x2 matrix.
**/
public static FromAngle(angle: number): b2Mat22;
/**
* Creates a 2x2 matrix from two columns.
* @param c1 Column 1 vector.
* @param c2 Column 2 vector.
* @return 2x2 matrix.
**/
public static FromVV(c1: b2Vec2, c2: b2Vec2): b2Mat22;
/**
* Gets the rotation matrix angle.
* R(theta) = [ cos(theta) -sin(theta) ]
* [ sin(theta) cos(theta) ]
* @return The rotation matrix angle (theta).
**/
public GetAngle(): number;
/**
* Compute the inverse of this matrix, such that inv(A) A = identity.
* @param out Inverse matrix.
* @return Inverse matrix.
**/
public GetInverse(out: b2Mat22): b2Mat22;
/**
* Sets the 2x2 rotation matrix from the given angle.
* R(theta) = [ cos(theta) -sin(theta) ]
* [ sin(theta) cos(theta) ]
* @param angle Matrix angle (theta).
**/
public Set(angle: number): void;
/**
* Sets the 2x2 matrix to identity.
**/
public SetIdentity(): void;
/**
* Sets the 2x2 matrix from a 2x2 matrix.
* @param m 2x2 matrix values.
**/
public SetM(m: b2Mat22): void;
/**
* Sets the 2x2 matrix from 2 column vectors.
* @param c1 Column 1 vector.
* @param c2 Column 2 vector.
**/
public SetVV(c1: b2Vec2, c2: b2Vec2): void;
/**
* Sets the 2x2 matrix to all zeros.
**/
public SetZero(): void;
/**
* TODO, has something to do with the determinant
* @param out Solved vector
* @param bX
* @param bY
* @return Solved vector
**/
public Solve(out: b2Vec2, bX: number, bY: number): b2Vec2;
}
}
declare namespace Box2D.Common.Math {
/**
* A 3-by3 matrix. Stored in column-major order.
**/
export class b2Mat33 {
/**
* Column 1
**/
public col1: b2Vec3;
/**
* Column 2
**/
public col2: b2Vec3;
/**
* Column 3
**/
public col3: b2Vec3;
/**
* Constructor
* @param c1 Column 1
* @param c2 Column 2
* @param c3 Column 3
**/
constructor(c1: b2Vec3, c2: b2Vec3, c3: b2Vec3);
/**
* Adds the two 3x3 matricies together and stores the result in this matrix.
* @param m 3x3 matrix to add.
**/
public AddM(m: b2Mat33): void;
/**
* Creates a copy of the matrix.
* @return Copy of this 3x3 matrix.
**/
public Copy(): b2Mat33;
/**
* Sets the 3x3 matrix to identity.
**/
public SetIdentity(): void;
/**
* Sets the 3x3 matrix from a 3x3 matrix.
* @param m 3x3 matrix values.
**/
public SetM(m: b2Mat33): void;
/**
* Sets the 3x3 matrix from 3 column vectors.
* @param c1 Column 1 vector.
* @param c2 Column 2 vector.
* @param c3 Column 2 vector.
**/
public SetVVV(c1: b2Vec3, c2: b2Vec3, c3: b2Vec3): void;
/**
* Sets the 3x3 matrix to all zeros.
**/
public SetZero(): void;
/**
* TODO, has something to do with the determinant
* @param out Solved vector
* @param bX
* @param bY
* @return Solved vector
**/
public Solve22(out: b2Vec2, bX: number, bY: number): b2Vec2;
/**
* TODO, has something to do with the determinant
* @param out Solved vector
* @param bX
* @param bY
* @param bZ
* @return Solved vector
**/
public Solve33(out: b2Vec3, bX: number, bY: number, bZ: number): b2Vec3;
}
}
declare namespace Box2D.Common.Math {
/**
* Math utility functions.
**/
export class b2Math {
/**
* Determines if a number is valid. A number is valid if it is finite.
* @param x Number to check for validity.
* @return True if x is valid, otherwise false.
**/
public static IsValid(x: number): boolean;
/**
* Dot product of two vector 2s.
* @param a Vector 2 to use in dot product.
* @param b Vector 2 to use in dot product.
* @return Dot product of a and b.
**/
public static Dot(a: b2Vec2, b: b2Vec2): number;
/**
* Cross product of two vector 2s.
* @param a Vector 2 to use in cross product.
* @param b Vector 2 to use in cross product.
* @return Cross product of a and b.
**/
public static CrossVV(a: b2Vec2, b: b2Vec2): number;
/**
* Cross product of vector 2 and s.
* @param a Vector 2 to use in cross product.
* @param s s value.
* @return Cross product of a and s.
**/
public static CrossVF(a: b2Vec2, s: number): b2Vec2;
/**
* Cross product of s and vector 2.
* @param s s value.
* @param a Vector 2 to use in cross product.
* @return Cross product of s and a.
**/
public static CrossFV(s: number, a: b2Vec2): b2Vec2;
/**
* Multiply matrix and vector.
* @param A Matrix.
* @param v Vector.
* @return Result.
**/
public static MulMV(A: b2Mat22, v: b2Vec2): b2Vec2;
/**
*
* @param A
* @param v
* @return
**/
public static MulTMV(A: b2Mat22, v: b2Vec2): b2Vec2;
/**
*
* @param T
* @param v
* @return
**/
public static MulX(T: b2Transform, v: b2Vec2): b2Vec2;
/**
*
* @param T
* @param v
* @return
**/
public static MulXT(T: b2Transform, v: b2Vec2): b2Vec2;
/**
* Adds two vectors.
* @param a First vector.
* @param b Second vector.
* @return a + b.
**/
public static AddVV(a: b2Vec2, b: b2Vec2): b2Vec2;
/**
* Subtracts two vectors.
* @param a First vector.
* @param b Second vector.
* @return a - b.
**/
public static SubtractVV(a: b2Vec2, b: b2Vec2): b2Vec2;
/**
* Calculates the distance between two vectors.
* @param a First vector.
* @param b Second vector.
* @return Distance between a and b.
**/
public static Distance(a: b2Vec2, b: b2Vec2): number;
/**
* Calculates the squared distance between two vectors.
* @param a First vector.
* @param b Second vector.
* @return dist^2 between a and b.
**/
public static DistanceSquared(a: b2Vec2, b: b2Vec2): number;
/**
*
* @param s
* @param a
* @return
**/
public static MulFV(s: number, a: b2Vec2): b2Vec2;
/**
*
* @param A
* @param B
* @return
**/
public static AddMM(A: b2Mat22, B: b2Mat22): b2Mat22;
/**
*
* @param A
* @param B
* @return
**/
public static MulMM(A: b2Mat22, B: b2Mat22): b2Mat22;
/**
*
* @param A
* @param B
* @return
**/
public static MulTMM(A: b2Mat22, B: b2Mat22): b2Mat22;
/**
* Creates an ABS number.
* @param a Number to ABS.
* @return Absolute value of a.
**/
public static Abs(a: number): number;
/**
* Creates an ABS vector.
* @param a Vector to ABS all values.
* @return Vector with all positive values.
**/
public static AbsV(a: b2Vec2): b2Vec2;
/**
* Creates an ABS matrix.
* @param A Matrix to ABS all values.
* @return Matrix with all positive values.
**/
public static AbsM(A: b2Mat22): b2Mat22;
/**
* Determines the minimum number.
* @param a First number.
* @param b Second number.
* @return a or b depending on which is the minimum.
**/
public static Min(a: number, b: number): number;
/**
* Determines the minimum vector.
* @param a First vector.
* @param b Second vector.
* @return a or b depending on which is the minimum.
**/
public static MinV(a: b2Vec2, b: b2Vec2): b2Vec2;
/**
* Determines the max number.
* @param a First number.
* @param b Second number.
* @return a or b depending on which is the maximum.
**/
public static Max(a: number, b: number): number;
/**
* Determines the max vector.
* @param a First vector.
* @param b Second vector.
* @return a or b depending on which is the maximum.
**/
public static MaxV(a: b2Vec2, b: b2Vec2): b2Vec2;
/**
* Clamp a number to the range of low to high.
* @param a Number to clamp.
* @param low Low range.
* @param high High range.
* @return Number a clamped to range of low to high.
**/
public static Clamp(a: number, low: number, high: number): number;
/**
* Clamps a vector to the range of low to high.
* @param a Vector to clamp.
* @param low Low range.
* @param high High range.
* @return Vector a clamped to range of low to high.
**/
public static ClampV(a: b2Vec2, low: b2Vec2, high: b2Vec2): b2Vec2;
/**
* Swaps a and b objects.
* @param a a -> b.
* @param b b -> a.
**/
public static Swap(a: any, b: any): void;
/**
* Generates a random number.
* @param return Random number.
**/
public static Random(): number;
/**
* Returns a random number between lo and hi.
* @param lo Lowest random number.
* @param hi Highest random number.
* @return Number between lo and hi.
**/
public static RandomRange(lo: number, hi: number): number;
/**
* Calculates the next power of 2 after the given number.
* @param x Number to start search for the next power of 2.
* @return The next number that is a power of 2.
**/
public static NextPowerOfTwo(x: number): number;
/**
* Check if a number is a power of 2.
* @param x Number to check if it is a power of 2.
* @return True if x is a power of 2, otherwise false.
**/
public static IsPowerOfTwo(x: number): boolean;
/**
* Global instance of a zero'ed vector. Use as read-only.
**/
public static b2Vec2_zero: b2Vec2;
/**
* Global instance of a 2x2 identity matrix. Use as read-only.
**/
public static b2Mat22_identity: b2Mat22;
/**
* Global instance of an identity transform. Use as read-only.
**/
public static b2Transform_identity: b2Transform;
}
}
declare namespace Box2D.Common.Math {
/**
* This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may no coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.
**/
export class b2Sweep {
/**
* World angle.
**/
public a: number;
/**
* World angle.
**/
public a0: number;
/**
* Center world position.
**/
public c: b2Vec2;
/**
* Center world position.
**/
public c0: b2Vec2;
/**
* Local center of mass position.
**/
public localCenter: b2Vec2;
/**
* Time interval = [t0,1], where t0 is in [0,1].
**/
public t0: b2Vec2;
/**
* Advance the sweep forward, yielding a new initial state.
* @t The new initial time.
**/
public Advance(t: number): void;
/**
* Creates a copy of the sweep.
**/
public Copy(): b2Sweep;
/**
* Get the interpolated transform at a specific time.
* @param xf Transform at specified time, this is an out parameter.
* @param alpha Is a factor in [0,1], where 0 indicates t0.
**/
public GetTransform(xf: b2Transform, alpha: number): void;
/**
* Sets the sweep from a sweep.
* @param other Sweep values to copy from.
**/
public Set(other: b2Sweep): void;
}
}
declare namespace Box2D.Common.Math {
/**
* A transform contains translation and rotation. It is used to represent the position and orientation of rigid frames.
**/
export class b2Transform {
/**
* Transform position.
**/
public position: b2Vec2;
/**
* Transform rotation.
**/
public R: b2Mat22;
/**
* The default constructor does nothing (for performance).
* @param pos Position
* @param r Rotation
**/
constructor(pos: b2Vec2, r: b2Mat22);
/**
* Calculate the angle that the rotation matrix represents.
* @return Rotation matrix angle.
**/
public GetAngle(): number;
/**
* Initialize using a position vector and rotation matrix.
* @param pos Position
* @param r Rotation
**/
public Initialize(pos: b2Vec2, r: b2Mat22): void;
/**
* Sets the transfrom from a transfrom.
* @param x Transform to copy values from.
**/
public Set(x: b2Transform): void;
/**
* Set this to the identity transform.
**/
public SetIdentity(): void;
}
}
declare namespace Box2D.Common.Math {
/**
* A 2D column vector.
**/
export class b2Vec2 {
/**
* x value
**/
public x: number;
/**
* y value
**/
public y: number;
/**
* Creates a new vector 2.
* @param x x value, default = 0.
* @param y y value, default = 0.
**/
constructor(x?: number, y?: number);
/**
* Sets x and y to absolute values.
**/
public Abs(): void;
/**
* Adds the vector 2 to this vector 2. The result is stored in this vector 2.
* @param v Vector 2 to add.
**/
public Add(v: b2Vec2): void;
/**
* Creates a copy of the vector 2.
* @return Copy of this vector 2.
**/
public Copy(): b2Vec2;
/**
* Cross F V
* @param s
**/
public CrossFV(s: number): void;
/**
* Cross V F
* @param s
**/
public CrossVF(s: number): void;
/**
* Gets the negative of this vector 2.
* @return Negative copy of this vector 2.
**/
public GetNegative(): b2Vec2;
/**
* True if the vector 2 is valid, otherwise false. A valid vector has finite values.
* @return True if the vector 2 is valid, otherwise false.
**/
public IsValid(): boolean;
/**
* Calculates the length of the vector 2.
* @return The length of the vector 2.
**/
public Length(): number;
/**
* Calculates the length squared of the vector2.
* @return The length squared of the vector 2.
**/
public LengthSquared(): number;
/**
* Creates a new vector 2 from the given values.
* @param x x value.
* @param y y value.
**/
public static Make(x: number, y: number): b2Vec2;
/**
* Calculates which vector has the maximum values and sets this vector to those values.
* @param b Vector 2 to compare for maximum values.
**/
public MaxV(b: b2Vec2): void;
/**
* Calculates which vector has the minimum values and sets this vector to those values.
* @param b Vector 2 to compare for minimum values.
**/
public MinV(b: b2Vec2): void;
/**
* Matrix multiplication. Stores the result in this vector 2.
* @param A Matrix to muliply by.
**/
public MulM(A: b2Mat22): void;
/**
* Vector multiplication. Stores the result in this vector 2.
* @param a Value to multiple the vector's values by.
**/
public Multiply(a: number): void;
/**
* Dot product multiplication. Stores the result in this vector 2.
* @param A Matrix to multiply by.
**/
public MulTM(A: b2Mat22): void;
/**
* Sets this vector 2 to its negative.
**/
public NegativeSelf(): void;
/**
* Normalizes the vector 2 [0,1].
* @return Length.
**/
public Normalize(): number;
/**
* Sets the vector 2.
* @param x x value, default is 0.
* @param y y value, default is 0.
**/
public Set(x?: number, y?: number): void;
/**
* Sets the vector 2 from a vector 2.
* @param v Vector 2 to copy values from.
**/
public SetV(v: b2Vec2): void;
/**
* Sets the vector 2 to zero values.
**/
public SetZero(): void;
/**
* Subtracts the vector 2 from this vector 2. The result is stored in this vector 2.
* @param v Vector 2 to subtract.
**/
public Subtract(v: b2Vec2): void;
}
}
declare namespace Box2D.Common.Math {
/**
* A 2D column vector with 3 elements.
**/
export class b2Vec3 {
/**
* x value.
**/
public x: number;
/**
* y value.
**/
public y: number;
/**
* z value.
**/
public z: number;
/**
* Construct using coordinates x,y,z.
* @param x x value, default = 0.
* @param y y value, default = 0.
* @param z z value, default = 0.
**/
constructor(x?: number, y?: number, z?: number);
/**
* Adds the vector 3 to this vector 3. The result is stored in this vector 3.
* @param v Vector 3 to add.
**/
public Add(v: b2Vec3): void;
/**
* Creates a copy of the vector 3.
* @return Copy of this vector 3.
**/
public Copy(): b2Vec3;
/**
* Gets the negative of this vector 3.
* @return Negative copy of this vector 3.