forked from Gr3q/types-cjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphene-1.0.d.ts
3675 lines (3649 loc) · 119 KB
/
Graphene-1.0.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
/** Generated with https://github.com/Gr3q/GIR2TS - If possible do not modify. */
declare namespace imports.gi.Graphene {
export interface BoxInitOptions {}
/**
* A 3D box, described as the volume between a minimum and
* a maximum vertices.
*/
interface Box {}
class Box {
public constructor(options?: Partial<BoxInitOptions>);
/**
* Allocates a new #graphene_box_t.
*
* The contents of the returned structure are undefined.
* @returns the newly allocated #graphene_box_t structure.
* Use {@link Graphene.Box.free} to free the resources allocated by this function
*/
public static alloc(): Box;
/**
* A degenerate #graphene_box_t that can only be expanded.
*
* The returned value is owned by Graphene and should not be modified or freed.
* @returns a #graphene_box_t
*/
public static empty(): Box;
/**
* A degenerate #graphene_box_t that cannot be expanded.
*
* The returned value is owned by Graphene and should not be modified or freed.
* @returns a #graphene_box_t
*/
public static infinite(): Box;
/**
* A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the
* maximum vertex set at (0, 0, 0).
*
* The returned value is owned by Graphene and should not be modified or freed.
* @returns a #graphene_box_t
*/
public static minus_one(): Box;
/**
* A #graphene_box_t with the minimum vertex set at (0, 0, 0) and the
* maximum vertex set at (1, 1, 1).
*
* The returned value is owned by Graphene and should not be modified or freed.
* @returns a #graphene_box_t
*/
public static one(): Box;
/**
* A #graphene_box_t with the minimum vertex set at (-1, -1, -1) and the
* maximum vertex set at (1, 1, 1).
*
* The returned value is owned by Graphene and should not be modified or freed.
* @returns a #graphene_box_t
*/
public static one_minus_one(): Box;
/**
* A #graphene_box_t with both the minimum and maximum vertices set at (0, 0, 0).
*
* The returned value is owned by Graphene and should not be modified or freed.
* @returns a #graphene_box_t
*/
public static zero(): Box;
public readonly min: Vec3;
public readonly max: Vec3;
/**
* Checks whether the #graphene_box_t #a contains the given
* #graphene_box_t #b.
* @param b a #graphene_box_t
* @returns `true` if the box is contained in the given box
*/
public contains_box(b: Box): boolean;
/**
* Checks whether #box contains the given #point.
* @param point the coordinates to check
* @returns `true` if the point is contained in the given box
*/
public contains_point(point: Point3D): boolean;
/**
* Checks whether the two given boxes are equal.
* @param b a #graphene_box_t
* @returns `true` if the boxes are equal
*/
public equal(b: Box): boolean;
/**
* Expands the dimensions of #box to include the coordinates at #point.
* @param point the coordinates of the point to include
* @returns return location for the expanded box
*/
public expand(point: Point3D): Box;
/**
* Expands the dimensions of #box by the given #scalar value.
*
* If #scalar is positive, the #graphene_box_t will grow; if #scalar is
* negative, the #graphene_box_t will shrink.
* @param scalar a scalar value
* @returns return location for the expanded box
*/
public expand_scalar(scalar: number): Box;
/**
* Expands the dimensions of #box to include the coordinates of the
* given vector.
* @param vec the coordinates of the point to include, as a #graphene_vec3_t
* @returns return location for the expanded box
*/
public expand_vec3(vec: Vec3): Box;
/**
* Frees the resources allocated by {@link Graphene.Box.alloc}.
*/
public free(): void;
/**
* Computes the bounding #graphene_sphere_t capable of containing the given
* #graphene_box_t.
* @returns return location for the bounding sphere
*/
public get_bounding_sphere(): Sphere;
/**
* Retrieves the coordinates of the center of a #graphene_box_t.
* @returns return location for the coordinates of
* the center
*/
public get_center(): Point3D;
/**
* Retrieves the size of the #box on the Z axis.
* @returns the depth of the box
*/
public get_depth(): number;
/**
* Retrieves the size of the #box on the Y axis.
* @returns the height of the box
*/
public get_height(): number;
/**
* Retrieves the coordinates of the maximum point of the given
* #graphene_box_t.
* @returns return location for the maximum point
*/
public get_max(): Point3D;
/**
* Retrieves the coordinates of the minimum point of the given
* #graphene_box_t.
* @returns return location for the minimum point
*/
public get_min(): Point3D;
/**
* Retrieves the size of the box on all three axes, and stores
* it into the given #size vector.
* @returns return location for the size
*/
public get_size(): Vec3;
/**
* Computes the vertices of the given #graphene_box_t.
* @returns return location for an array
* of 8 #graphene_vec3_t
*/
public get_vertices(): Vec3[];
/**
* Retrieves the size of the #box on the X axis.
* @returns the width of the box
*/
public get_width(): number;
/**
* Initializes the given #graphene_box_t with two vertices.
* @param min the coordinates of the minimum vertex
* @param max the coordinates of the maximum vertex
* @returns the initialized #graphene_box_t
*/
public init(min?: Point3D | null, max?: Point3D | null): Box;
/**
* Initializes the given #graphene_box_t with the vertices of
* another #graphene_box_t.
* @param src a #graphene_box_t
* @returns the initialized #graphene_box_t
*/
public init_from_box(src: Box): Box;
/**
* Initializes the given #graphene_box_t with the given array
* of vertices.
*
* If #n_points is 0, the returned box is initialized with
* {@link Graphene.box.empty}.
* @param points an array of #graphene_point3d_t
* @returns the initialized #graphene_box_t
*/
public init_from_points(points: Point3D[]): Box;
/**
* Initializes the given #graphene_box_t with two vertices
* stored inside #graphene_vec3_t.
* @param min the coordinates of the minimum vertex
* @param max the coordinates of the maximum vertex
* @returns the initialized #graphene_box_t
*/
public init_from_vec3(min?: Vec3 | null, max?: Vec3 | null): Box;
/**
* Initializes the given #graphene_box_t with the given array
* of vertices.
*
* If #n_vectors is 0, the returned box is initialized with
* {@link Graphene.box.empty}.
* @param vectors an array of #graphene_vec3_t
* @returns the initialized #graphene_box_t
*/
public init_from_vectors(vectors: Vec3[]): Box;
/**
* Intersects the two given #graphene_box_t.
*
* If the two boxes do not intersect, #res will contain a degenerate box
* initialized with {@link Graphene.box.empty}.
* @param b a #graphene_box_t
* @returns true if the two boxes intersect
*
* return location for the result
*/
public intersection(b: Box): [ boolean, Box | null ];
/**
* Unions the two given #graphene_box_t.
* @param b the box to union to #a
* @returns return location for the result
*/
public union(b: Box): Box;
}
export interface EulerInitOptions {}
/**
* Describe a rotation using Euler angles.
*
* The contents of the #graphene_euler_t structure are private
* and should never be accessed directly.
*/
interface Euler {}
class Euler {
public constructor(options?: Partial<EulerInitOptions>);
/**
* Allocates a new #graphene_euler_t.
*
* The contents of the returned structure are undefined.
* @returns the newly allocated #graphene_euler_t
*/
public static alloc(): Euler;
public readonly angles: Vec3;
public readonly order: EulerOrder;
/**
* Checks if two #graphene_euler_t are equal.
* @param b a #graphene_euler_t
* @returns `true` if the two #graphene_euler_t are equal
*/
public equal(b: Euler): boolean;
/**
* Frees the resources allocated by {@link Graphene.Euler.alloc}.
*/
public free(): void;
/**
* Retrieves the first component of the Euler angle vector,
* depending on the order of rotation.
*
* See also: {@link Graphene.Euler.get_x}
* @returns the first component of the Euler angle vector, in radians
*/
public get_alpha(): number;
/**
* Retrieves the second component of the Euler angle vector,
* depending on the order of rotation.
*
* See also: {@link Graphene.Euler.get_y}
* @returns the second component of the Euler angle vector, in radians
*/
public get_beta(): number;
/**
* Retrieves the third component of the Euler angle vector,
* depending on the order of rotation.
*
* See also: {@link Graphene.Euler.get_z}
* @returns the third component of the Euler angle vector, in radians
*/
public get_gamma(): number;
/**
* Retrieves the order used to apply the rotations described in the
* #graphene_euler_t structure, when converting to and from other
* structures, like #graphene_quaternion_t and #graphene_matrix_t.
*
* This function does not return the %GRAPHENE_EULER_ORDER_DEFAULT
* enumeration value; it will return the effective order of rotation
* instead.
* @returns the order used to apply the rotations
*/
public get_order(): EulerOrder;
/**
* Retrieves the rotation angle on the X axis, in degrees.
* @returns the rotation angle
*/
public get_x(): number;
/**
* Retrieves the rotation angle on the Y axis, in degrees.
* @returns the rotation angle
*/
public get_y(): number;
/**
* Retrieves the rotation angle on the Z axis, in degrees.
* @returns the rotation angle
*/
public get_z(): number;
/**
* Initializes a #graphene_euler_t using the given angles.
*
* The order of the rotations is %GRAPHENE_EULER_ORDER_DEFAULT.
* @param x rotation angle on the X axis, in degrees
* @param y rotation angle on the Y axis, in degrees
* @param z rotation angle on the Z axis, in degrees
* @returns the initialized #graphene_euler_t
*/
public init(x: number, y: number, z: number): Euler;
/**
* Initializes a #graphene_euler_t using the angles and order of
* another #graphene_euler_t.
*
* If the #graphene_euler_t #src is %NULL, this function is equivalent
* to calling {@link Graphene.Euler.init} with all angles set to 0.
* @param src a #graphene_euler_t
* @returns the initialized #graphene_euler_t
*/
public init_from_euler(src?: Euler | null): Euler;
/**
* Initializes a #graphene_euler_t using the given rotation matrix.
*
* If the #graphene_matrix_t #m is %NULL, the #graphene_euler_t will
* be initialized with all angles set to 0.
* @param m a rotation matrix
* @param order the order used to apply the rotations
* @returns the initialized #graphene_euler_t
*/
public init_from_matrix(m: Matrix | null, order: EulerOrder): Euler;
/**
* Initializes a #graphene_euler_t using the given normalized quaternion.
*
* If the #graphene_quaternion_t #q is %NULL, the #graphene_euler_t will
* be initialized with all angles set to 0.
* @param q a normalized #graphene_quaternion_t
* @param order the order used to apply the rotations
* @returns the initialized #graphene_euler_t
*/
public init_from_quaternion(q: Quaternion | null, order: EulerOrder): Euler;
/**
* Initializes a #graphene_euler_t using the given angles
* and order of rotation.
* @param x rotation angle on the X axis, in radians
* @param y rotation angle on the Y axis, in radians
* @param z rotation angle on the Z axis, in radians
* @param order order of rotations
* @returns the initialized #graphene_euler_t
*/
public init_from_radians(x: number, y: number, z: number, order: EulerOrder): Euler;
/**
* Initializes a #graphene_euler_t using the angles contained in a
* #graphene_vec3_t.
*
* If the #graphene_vec3_t #v is %NULL, the #graphene_euler_t will be
* initialized with all angles set to 0.
* @param v a #graphene_vec3_t containing the rotation
* angles in degrees
* @param order the order used to apply the rotations
* @returns the initialized #graphene_euler_t
*/
public init_from_vec3(v: Vec3 | null, order: EulerOrder): Euler;
/**
* Initializes a #graphene_euler_t with the given angles and #order.
* @param x rotation angle on the X axis, in degrees
* @param y rotation angle on the Y axis, in degrees
* @param z rotation angle on the Z axis, in degrees
* @param order the order used to apply the rotations
* @returns the initialized #graphene_euler_t
*/
public init_with_order(x: number, y: number, z: number, order: EulerOrder): Euler;
/**
* Reorders a #graphene_euler_t using #order.
*
* This function is equivalent to creating a #graphene_quaternion_t from the
* given #graphene_euler_t, and then converting the quaternion into another
* #graphene_euler_t.
* @param order the new order
* @returns return location for the reordered
* #graphene_euler_t
*/
public reorder(order: EulerOrder): Euler;
/**
* Converts a #graphene_euler_t into a transformation matrix expressing
* the extrinsic composition of rotations described by the Euler angles.
*
* The rotations are applied over the reference frame axes in the order
* associated with the #graphene_euler_t; for instance, if the order
* used to initialize #e is %GRAPHENE_EULER_ORDER_XYZ:
*
* * the first rotation moves the body around the X axis with
* an angle φ
* * the second rotation moves the body around the Y axis with
* an angle of ϑ
* * the third rotation moves the body around the Z axis with
* an angle of ψ
*
* The rotation sign convention is right-handed, to preserve compatibility
* between Euler-based, quaternion-based, and angle-axis-based rotations.
* @returns return location for a #graphene_matrix_t
*/
public to_matrix(): Matrix;
/**
* Converts a #graphene_euler_t into a #graphene_quaternion_t.
* @returns return location for a #graphene_quaternion_t
*/
public to_quaternion(): Quaternion;
/**
* Retrieves the angles of a #graphene_euler_t and initializes a
* #graphene_vec3_t with them.
* @returns return location for a #graphene_vec3_t
*/
public to_vec3(): Vec3;
}
export interface FrustumInitOptions {}
/**
* A 3D volume delimited by 2D clip planes.
*
* The contents of the `graphene_frustum_t` are private, and should not be
* modified directly.
*/
interface Frustum {}
class Frustum {
public constructor(options?: Partial<FrustumInitOptions>);
/**
* Allocates a new #graphene_frustum_t structure.
*
* The contents of the returned structure are undefined.
* @returns the newly allocated #graphene_frustum_t
* structure. Use {@link Graphene.Frustum.free} to free the resources
* allocated by this function.
*/
public static alloc(): Frustum;
public readonly planes: Plane[];
/**
* Checks whether a point is inside the volume defined by the given
* #graphene_frustum_t.
* @param point a #graphene_point3d_t
* @returns `true` if the point is inside the frustum
*/
public contains_point(point: Point3D): boolean;
/**
* Checks whether the two given #graphene_frustum_t are equal.
* @param b a #graphene_frustum_t
* @returns `true` if the given frustums are equal
*/
public equal(b: Frustum): boolean;
/**
* Frees the resources allocated by {@link Graphene.Frustum.alloc}.
*/
public free(): void;
/**
* Retrieves the planes that define the given #graphene_frustum_t.
* @returns return location for an array
* of 6 #graphene_plane_t
*/
public get_planes(): Plane[];
/**
* Initializes the given #graphene_frustum_t using the provided
* clipping planes.
* @param p0 a clipping plane
* @param p1 a clipping plane
* @param p2 a clipping plane
* @param p3 a clipping plane
* @param p4 a clipping plane
* @param p5 a clipping plane
* @returns the initialized frustum
*/
public init(p0: Plane, p1: Plane, p2: Plane, p3: Plane, p4: Plane, p5: Plane): Frustum;
/**
* Initializes the given #graphene_frustum_t using the clipping
* planes of another #graphene_frustum_t.
* @param src a #graphene_frustum_t
* @returns the initialized frustum
*/
public init_from_frustum(src: Frustum): Frustum;
/**
* Initializes a #graphene_frustum_t using the given #matrix.
* @param matrix a #graphene_matrix_t
* @returns the initialized frustum
*/
public init_from_matrix(matrix: Matrix): Frustum;
/**
* Checks whether the given #box intersects a plane of
* a #graphene_frustum_t.
* @param box a #graphene_box_t
* @returns `true` if the box intersects the frustum
*/
public intersects_box(box: Box): boolean;
/**
* Checks whether the given #sphere intersects a plane of
* a #graphene_frustum_t.
* @param sphere a #graphene_sphere_t
* @returns `true` if the sphere intersects the frustum
*/
public intersects_sphere(sphere: Sphere): boolean;
}
export interface MatrixInitOptions {}
/**
* A structure capable of holding a 4x4 matrix.
*
* The contents of the #graphene_matrix_t structure are private and
* should never be accessed directly.
*/
interface Matrix {}
class Matrix {
public constructor(options?: Partial<MatrixInitOptions>);
/**
* Allocates a new #graphene_matrix_t.
* @returns the newly allocated matrix
*/
public static alloc(): Matrix;
public readonly value: Simd4X4F;
/**
* Decomposes a transformation matrix into its component transformations.
*
* The algorithm for decomposing a matrix is taken from the
* [CSS3 Transforms specification](http://dev.w3.org/csswg/css-transforms/);
* specifically, the decomposition code is based on the equivalent code
* published in "Graphics Gems II", edited by Jim Arvo, and
* [available online](http://web.archive.org/web/20150512160205/http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c).
* @returns `true` if the matrix could be decomposed
*
* the translation vector
*
* the scale vector
*
* the rotation quaternion
*
* the shear vector
*
* the perspective vector
*/
public decompose(): [ boolean, Vec3, Vec3, Quaternion, Vec3, Vec4 ];
/**
* Computes the determinant of the given matrix.
* @returns the value of the determinant
*/
public determinant(): number;
/**
* Checks whether the two given #graphene_matrix_t matrices are equal.
* @param b a #graphene_matrix_t
* @returns `true` if the two matrices are equal, and `false` otherwise
*/
public equal(b: Matrix): boolean;
/**
* Checks whether the two given #graphene_matrix_t matrices are
* byte-by-byte equal.
*
* While this function is faster than {@link Graphene.Matrix.equal}, it
* can also return false negatives, so it should be used in
* conjuction with either graphene_matrix_equal() or
* graphene_matrix_near(). For instance:
*
* |[<!-- language="C" -->
* if (graphene_matrix_equal_fast (a, b))
* {
* // matrices are definitely the same
* }
* else
* {
* if (graphene_matrix_equal (a, b))
* // matrices contain the same values within an epsilon of FLT_EPSILON
* else if (graphene_matrix_near (a, b, 0.0001))
* // matrices contain the same values within an epsilon of 0.0001
* else
* // matrices are not equal
* }
* ]|
* @param b a #graphene_matrix_t
* @returns `true` if the matrices are equal. and `false` otherwise
*/
public equal_fast(b: Matrix): boolean;
/**
* Frees the resources allocated by {@link Graphene.Matrix.alloc}.
*/
public free(): void;
/**
* Retrieves the given row vector at #index_ inside a matrix.
* @param index_ the index of the row vector, between 0 and 3
* @returns return location for the #graphene_vec4_t
* that is used to store the row vector
*/
public get_row(index_: number): Vec4;
/**
* Retrieves the value at the given #row and #col index.
* @param row the row index
* @param col the column index
* @returns the value at the given indices
*/
public get_value(row: number, col: number): number;
/**
* Retrieves the scaling factor on the X axis in #m.
* @returns the value of the scaling factor
*/
public get_x_scale(): number;
/**
* Retrieves the translation component on the X axis from #m.
* @returns the translation component
*/
public get_x_translation(): number;
/**
* Retrieves the scaling factor on the Y axis in #m.
* @returns the value of the scaling factor
*/
public get_y_scale(): number;
/**
* Retrieves the translation component on the Y axis from #m.
* @returns the translation component
*/
public get_y_translation(): number;
/**
* Retrieves the scaling factor on the Z axis in #m.
* @returns the value of the scaling factor
*/
public get_z_scale(): number;
/**
* Retrieves the translation component on the Z axis from #m.
* @returns the translation component
*/
public get_z_translation(): number;
/**
* Initializes a #graphene_matrix_t from the values of an affine
* transformation matrix.
*
* The arguments map to the following matrix layout:
*
* |[<!-- language="plain" -->
* ⎛ xx yx ⎞ ⎛ a b 0 ⎞
* ⎜ xy yy ⎟ = ⎜ c d 0 ⎟
* ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
* ]|
*
* This function can be used to convert between an affine matrix type
* from other libraries and a #graphene_matrix_t.
* @param xx the xx member
* @param yx the yx member
* @param xy the xy member
* @param yy the yy member
* @param x_0 the x0 member
* @param y_0 the y0 member
* @returns the initialized matrix
*/
public init_from_2d(xx: number, yx: number, xy: number, yy: number, x_0: number, y_0: number): Matrix;
/**
* Initializes a #graphene_matrix_t with the given array of floating
* point values.
* @param v an array of at least 16 floating
* point values
* @returns the initialized matrix
*/
public init_from_float(v: number[]): Matrix;
/**
* Initializes a #graphene_matrix_t using the values of the
* given matrix.
* @param src a #graphene_matrix_t
* @returns the initialized matrix
*/
public init_from_matrix(src: Matrix): Matrix;
/**
* Initializes a #graphene_matrix_t with the given four row
* vectors.
* @param v0 the first row vector
* @param v1 the second row vector
* @param v2 the third row vector
* @param v3 the fourth row vector
* @returns the initialized matrix
*/
public init_from_vec4(v0: Vec4, v1: Vec4, v2: Vec4, v3: Vec4): Matrix;
/**
* Initializes a #graphene_matrix_t compatible with #graphene_frustum_t.
*
* See also: {@link Graphene.Frustum.init_from_matrix}
* @param left distance of the left clipping plane
* @param right distance of the right clipping plane
* @param bottom distance of the bottom clipping plane
* @param top distance of the top clipping plane
* @param z_near distance of the near clipping plane
* @param z_far distance of the far clipping plane
* @returns the initialized matrix
*/
public init_frustum(left: number, right: number, bottom: number, top: number, z_near: number, z_far: number): Matrix;
/**
* Initializes a #graphene_matrix_t with the identity matrix.
* @returns the initialized matrix
*/
public init_identity(): Matrix;
/**
* Initializes a #graphene_matrix_t so that it positions the "camera"
* at the given #eye coordinates towards an object at the #center
* coordinates. The top of the camera is aligned to the direction
* of the #up vector.
*
* Before the transform, the camera is assumed to be placed at the
* origin, looking towards the negative Z axis, with the top side of
* the camera facing in the direction of the Y axis and the right
* side in the direction of the X axis.
*
* In theory, one could use #m to transform a model of such a camera
* into world-space. However, it is more common to use the inverse of
* #m to transform another object from world coordinates to the view
* coordinates of the camera. Typically you would then apply the
* camera projection transform to get from view to screen
* coordinates.
* @param eye the vector describing the position to look from
* @param center the vector describing the position to look at
* @param up the vector describing the world's upward direction; usually,
* this is the {@link Graphene.vec3.y_axis} vector
* @returns the initialized matrix
*/
public init_look_at(eye: Vec3, center: Vec3, up: Vec3): Matrix;
/**
* Initializes a #graphene_matrix_t with an orthographic projection.
* @param left the left edge of the clipping plane
* @param right the right edge of the clipping plane
* @param top the top edge of the clipping plane
* @param bottom the bottom edge of the clipping plane
* @param z_near the distance of the near clipping plane
* @param z_far the distance of the far clipping plane
* @returns the initialized matrix
*/
public init_ortho(left: number, right: number, top: number, bottom: number, z_near: number, z_far: number): Matrix;
/**
* Initializes a #graphene_matrix_t with a perspective projection.
* @param fovy the field of view angle, in degrees
* @param aspect the aspect value
* @param z_near the near Z plane
* @param z_far the far Z plane
* @returns the initialized matrix
*/
public init_perspective(fovy: number, aspect: number, z_near: number, z_far: number): Matrix;
/**
* Initializes #m to represent a rotation of #angle degrees on
* the axis represented by the #axis vector.
* @param angle the rotation angle, in degrees
* @param axis the axis vector as a #graphene_vec3_t
* @returns the initialized matrix
*/
public init_rotate(angle: number, axis: Vec3): Matrix;
/**
* Initializes a #graphene_matrix_t with the given scaling factors.
* @param x the scale factor on the X axis
* @param y the scale factor on the Y axis
* @param z the scale factor on the Z axis
* @returns the initialized matrix
*/
public init_scale(x: number, y: number, z: number): Matrix;
/**
* Initializes a #graphene_matrix_t with a skew transformation
* with the given factors.
* @param x_skew skew factor, in radians, on the X axis
* @param y_skew skew factor, in radians, on the Y axis
* @returns the initialized matrix
*/
public init_skew(x_skew: number, y_skew: number): Matrix;
/**
* Initializes a #graphene_matrix_t with a translation to the
* given coordinates.
* @param p the translation coordinates
* @returns the initialized matrix
*/
public init_translate(p: Point3D): Matrix;
/**
* Linearly interpolates the two given #graphene_matrix_t by
* interpolating the decomposed transformations separately.
*
* If either matrix cannot be reduced to their transformations
* then the interpolation cannot be performed, and this function
* will return an identity matrix.
* @param b a #graphene_matrix_t
* @param factor the linear interpolation factor
* @returns return location for the
* interpolated matrix
*/
public interpolate(b: Matrix, factor: number): Matrix;
/**
* Inverts the given matrix.
* @returns `true` if the matrix is invertible
*
* return location for the
* inverse matrix
*/
public inverse(): [ boolean, Matrix ];
/**
* Checks whether the given #graphene_matrix_t is compatible with an
* a 2D affine transformation matrix.
* @returns `true` if the matrix is compatible with an affine
* transformation matrix
*/
public is_2d(): boolean;
/**
* Checks whether a #graphene_matrix_t has a visible back face.
* @returns `true` if the back face of the matrix is visible
*/
public is_backface_visible(): boolean;
/**
* Checks whether the given #graphene_matrix_t is the identity matrix.
* @returns `true` if the matrix is the identity matrix
*/
public is_identity(): boolean;
/**
* Checks whether a matrix is singular.
* @returns `true` if the matrix is singular
*/
public is_singular(): boolean;
/**
* Multiplies two #graphene_matrix_t.
*
* Matrix multiplication is not commutative in general; the order of the factors matters.
* The product of this multiplication is (#a × #b)
* @param b a #graphene_matrix_t
* @returns return location for the matrix
* result
*/
public multiply(b: Matrix): Matrix;
/**
* Compares the two given #graphene_matrix_t matrices and checks
* whether their values are within the given #epsilon of each
* other.
* @param b a #graphene_matrix_t
* @param epsilon the threshold between the two matrices
* @returns `true` if the two matrices are near each other, and
* `false` otherwise
*/
public near(b: Matrix, epsilon: number): boolean;
/**
* Normalizes the given #graphene_matrix_t.
* @returns return location for the normalized matrix
*/
public normalize(): Matrix;
/**
* Applies a perspective of #depth to the matrix.
* @param depth the depth of the perspective
* @returns return location for the
* perspective matrix
*/
public perspective(depth: number): Matrix;
/**
* Prints the contents of a matrix to the standard error stream.
*
* This function is only useful for debugging; there are no guarantees
* made on the format of the output.
*/
public print(): void;
/**
* Projects a #graphene_point_t using the matrix #m.
* @param p a #graphene_point_t
* @returns return location for the projected
* point
*/
public project_point(p: Point): Point;
/**
* Projects all corners of a #graphene_rect_t using the given matrix.
*
* See also: {@link Graphene.Matrix.project_point}
* @param r a #graphene_rect_t
* @returns return location for the projected
* rectangle
*/
public project_rect(r: Rect): Quad;
/**
* Projects a #graphene_rect_t using the given matrix.
*
* The resulting rectangle is the axis aligned bounding rectangle capable
* of fully containing the projected rectangle.
* @param r a #graphene_rect_t
* @returns return location for the projected
* rectangle
*/
public project_rect_bounds(r: Rect): Rect;
/**
* Adds a rotation transformation to #m, using the given #angle
* and #axis vector.
*
* This is the equivalent of calling {@link Graphene.Matrix.init_rotate} and
* then multiplying the matrix #m with the rotation matrix.
* @param angle the rotation angle, in degrees
* @param axis the rotation axis, as a #graphene_vec3_t
*/
public rotate(angle: number, axis: Vec3): void;
/**
* Adds a rotation transformation to #m, using the given
* #graphene_euler_t.
* @param e a rotation described by a #graphene_euler_t
*/
public rotate_euler(e: Euler): void;
/**
* Adds a rotation transformation to #m, using the given
* #graphene_quaternion_t.
*
* This is the equivalent of calling {@link Graphene.Quaternion.to_matrix} and
* then multiplying #m with the rotation matrix.
* @param q a rotation described by a #graphene_quaternion_t
*/
public rotate_quaternion(q: Quaternion): void;
/**
* Adds a rotation transformation around the X axis to #m, using
* the given #angle.
*
* See also: {@link Graphene.Matrix.rotate}
* @param angle the rotation angle, in degrees
*/
public rotate_x(angle: number): void;
/**
* Adds a rotation transformation around the Y axis to #m, using
* the given #angle.
*
* See also: {@link Graphene.Matrix.rotate}
* @param angle the rotation angle, in degrees
*/
public rotate_y(angle: number): void;
/**
* Adds a rotation transformation around the Z axis to #m, using
* the given #angle.
*
* See also: {@link Graphene.Matrix.rotate}
* @param angle the rotation angle, in degrees
*/
public rotate_z(angle: number): void;
/**
* Adds a scaling transformation to #m, using the three
* given factors.
*
* This is the equivalent of calling {@link Graphene.Matrix.init_scale} and then
* multiplying the matrix #m with the scale matrix.
* @param factor_x scaling factor on the X axis
* @param factor_y scaling factor on the Y axis
* @param factor_z scaling factor on the Z axis
*/
public scale(factor_x: number, factor_y: number, factor_z: number): void;
/**
* Adds a skew of #factor on the X and Y axis to the given matrix.
* @param factor skew factor
*/
public skew_xy(factor: number): void;
/**
* Adds a skew of #factor on the X and Z axis to the given matrix.
* @param factor skew factor
*/
public skew_xz(factor: number): void;
/**
* Adds a skew of #factor on the Y and Z axis to the given matrix.
* @param factor skew factor
*/
public skew_yz(factor: number): void;
/**
* Converts a #graphene_matrix_t to an affine transformation
* matrix, if the given matrix is compatible.
*
* The returned values have the following layout:
*
* |[<!-- language="plain" -->
* ⎛ xx yx ⎞ ⎛ a b 0 ⎞
* ⎜ xy yy ⎟ = ⎜ c d 0 ⎟
* ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠
* ]|
*
* This function can be used to convert between a #graphene_matrix_t
* and an affine matrix type from other libraries.
* @returns `true` if the matrix is compatible with an affine
* transformation matrix
*
* return location for the xx member
*
* return location for the yx member
*
* return location for the xy member
*
* return location for the yy member
*
* return location for the x0 member
*
* return location for the y0 member
*/
public to_2d(): [ boolean, number, number, number, number, number, number ];
/**
* Converts a #graphene_matrix_t to an array of floating point
* values.
* @returns return location
* for an array of floating point values. The array must be capable
* of holding at least 16 values.
*/
public to_float(): number[];
/**
* Transforms each corner of a #graphene_rect_t using the given matrix #m.
*
* The result is the axis aligned bounding rectangle containing the coplanar
* quadrilateral.
*
* See also: {@link Graphene.Matrix.transform_point}
* @param r a #graphene_rect_t
* @returns return location for the bounds
* of the transformed rectangle
*/
public transform_bounds(r: Rect): Rect;
/**
* Transforms the vertices of a #graphene_box_t using the given matrix #m.