/
Basis.hx
510 lines (410 loc) · 14.9 KB
/
Basis.hx
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
// Automatically generated Godot externs: DO NOT EDIT
// MIT licensed, see LICENSE.md
package godot;
import cs.system.*;
/**
3×3 matrix used for 3D rotation and scale.
Almost always used as an orthogonal basis for a Transform.
Contains 3 vector fields X, Y and Z as its columns, which are typically
interpreted as the local basis vectors of a 3D transformation. For such use,
it is composed of a scaling and a rotation matrix, in that order (M = R.S).
Can also be accessed as array of 3D vectors. These vectors are normally
orthogonal to each other, but are not necessarily normalized (due to scaling).
For more information, read this documentation article:
https://docs.godotengine.org/en/3.4/tutorials/math/matrices_and_transforms.html
**/
#if doc_gen
@:struct
@:libType
@:csNative
@:native("Godot.Basis")
@:autoBuild(godot.Godot.buildUserClass())
extern class Basis extends cs.system.ValueType implements cs.system.IEquatable_1<godot.Basis> {
#else
@:forward
@:forwardStatics
extern abstract Basis(Basis_) from Basis_ to Basis_ {
#end
#if !doc_gen
/**
Constructs a pure rotation basis matrix from the given quaternion.
@param quaternion The quaternion to create the basis from.
**/
public overload inline function new(quaternion:godot.Quat) {
this = new Basis_(quaternion);
}
#end
#if !doc_gen
/**
Constructs a pure rotation basis matrix from the given Euler angles
(in the YXZ convention: when *composing*, first Y, then X, and Z last),
given in the vector format as (X angle, Y angle, Z angle).
Consider using the `godot.Basis.#ctor` constructor instead, which
uses a `godot.Quat` quaternion instead of Euler angles.
@param eulerYXZ The Euler angles to create the basis from.
**/
public overload inline function new(eulerYXZ:godot.Vector3) {
this = new Basis_(eulerYXZ);
}
#end
#if !doc_gen
/**
Constructs a pure rotation basis matrix, rotated around the given `axis`
by `phi` (in radians). The axis must be a normalized vector.
@param axis The axis to rotate around. Must be normalized.
@param phi The angle to rotate, in radians.
**/
public overload inline function new(axis:godot.Vector3, phi:Single) {
this = new Basis_(axis, phi);
}
#end
#if !doc_gen
/**
Constructs a basis matrix from 3 axis vectors (matrix columns).
@param column0 The X vector, or Column0.
@param column1 The Y vector, or Column1.
@param column2 The Z vector, or Column2.
**/
public overload inline function new(column0:godot.Vector3, column1:godot.Vector3, column2:godot.Vector3) {
this = new Basis_(column0, column1, column2);
}
#end
/**
Operator overload for `godot.Basis` * `godot.Basis`.
**/
@:op(A * B) static inline function op_Multiply(left:godot.Basis, right:godot.Basis):godot.Basis {
return cs.Syntax.code("{0} * {1}", left, right);
}
/**
Operator overload for `godot.Basis` == `godot.Basis`.
**/
@:op(A == B) static inline function op_Equality(left:godot.Basis, right:godot.Basis):Bool {
return cs.Syntax.code("{0} == {1}", left, right);
}
/**
Operator overload for `godot.Basis` != `godot.Basis`.
**/
@:op(A != B) static inline function op_Inequality(left:godot.Basis, right:godot.Basis):Bool {
return cs.Syntax.code("{0} != {1}", left, right);
}
#if !doc_gen
}
@:struct
@:libType
@:csNative
@:native("Godot.Basis")
@:autoBuild(godot.Godot.buildUserClass())
extern class Basis_ extends cs.system.ValueType implements cs.system.IEquatable_1<godot.Basis> {
#end
/**
The basis that will flip something along the Z axis when used in a transformation.
Value: Equivalent to `new Basis(Vector3.Right, Vector3.Up, Vector3.Forward)`.
**/
@:native("FlipZ")
public static var FLIP_Z(default, never):godot.Basis;
/**
The basis that will flip something along the Y axis when used in a transformation.
Value: Equivalent to `new Basis(Vector3.Right, Vector3.Down, Vector3.Back)`.
**/
@:native("FlipY")
public static var FLIP_Y(default, never):godot.Basis;
/**
The basis that will flip something along the X axis when used in a transformation.
Value: Equivalent to `new Basis(Vector3.Left, Vector3.Up, Vector3.Back)`.
**/
@:native("FlipX")
public static var FLIP_X(default, never):godot.Basis;
/**
The identity basis, with no rotation or scaling applied.
This is used as a replacement for `Basis()` in GDScript.
Do not use `new Basis()` with no arguments in C#, because it sets all values to zero.
Value: Equivalent to `new Basis(Vector3.Right, Vector3.Up, Vector3.Back)`.
**/
@:native("Identity")
public static var IDENTITY(default, never):godot.Basis;
/**
The scale of this basis.
Value: Equivalent to the lengths of each column vector, but negative if the determinant is negative.
**/
@:native("Scale")
public var scale:godot.Vector3;
/**
Column 2 of the basis matrix (the Z vector).
Value: Equivalent to `godot.Basis.z` and array index `[2]`.
**/
@:native("Column2")
public var column2:godot.Vector3;
/**
Column 1 of the basis matrix (the Y vector).
Value: Equivalent to `godot.Basis.y` and array index `[1]`.
**/
@:native("Column1")
public var column1:godot.Vector3;
/**
Column 0 of the basis matrix (the X vector).
Value: Equivalent to `godot.Basis.x` and array index `[0]`.
**/
@:native("Column0")
public var column0:godot.Vector3;
/**
The basis matrix's Z vector (column 2).
Value: Equivalent to `godot.Basis.column2` and array index `[2]`.
**/
@:native("z")
public var z:godot.Vector3;
/**
The basis matrix's Y vector (column 1).
Value: Equivalent to `godot.Basis.column1` and array index `[1]`.
**/
@:native("y")
public var y:godot.Vector3;
/**
The basis matrix's X vector (column 0).
Value: Equivalent to `godot.Basis.column0` and array index `[0]`.
**/
@:native("x")
public var x:godot.Vector3;
/**
Row 2 of the basis matrix. Shows which vectors contribute
to the Z direction. Rows are not very useful for user code,
but are more efficient for some internal calculations.
**/
@:native("Row2")
public var row2:godot.Vector3;
/**
Row 1 of the basis matrix. Shows which vectors contribute
to the Y direction. Rows are not very useful for user code,
but are more efficient for some internal calculations.
**/
@:native("Row1")
public var row1:godot.Vector3;
/**
Row 0 of the basis matrix. Shows which vectors contribute
to the X direction. Rows are not very useful for user code,
but are more efficient for some internal calculations.
**/
@:native("Row0")
public var row0:godot.Vector3;
/**
Returns the `godot.Basis`'s rotation in the form of a
`godot.Basis.quat`. See `godot.Basis.getEuler` if you
need Euler angles, but keep in mind quaternions should generally
be preferred to Euler angles.
@returns The basis rotation.
**/
@:native("RotationQuat")
public function rotationQuat():godot.Quat;
/**
Returns the determinant of the basis matrix. If the basis is
uniformly scaled, its determinant is the square of the scale.
A negative determinant means the basis has a negative scale.
A zero determinant means the basis isn't invertible,
and is usually considered invalid.
@returns The determinant of the basis matrix.
**/
@:native("Determinant")
public function determinant():Single;
/**
Returns the basis's rotation in the form of Euler angles
(in the YXZ convention: when *decomposing*, first Z, then X, and Y last).
The returned vector contains the rotation angles in
the format (X angle, Y angle, Z angle).
Consider using the `godot.Basis.quat` method instead, which
returns a `godot.Quat` quaternion instead of Euler angles.
@returns A `godot.Vector3` representing the basis rotation in Euler angles.
**/
@:native("GetEuler")
public function getEuler():godot.Vector3;
/**
Get rows by index. Rows are not very useful for user code,
but are more efficient for some internal calculations.
@param index Which row.@throws cs.system.IndexOutOfRangeException
@returns One of `Row0`, `Row1`, or `Row2`.
**/
@:native("GetRow")
public function getRow(index:Int):godot.Vector3;
/**
Sets rows by index. Rows are not very useful for user code,
but are more efficient for some internal calculations.
@param index Which row.
@param value The vector to set the row to.@throws cs.system.IndexOutOfRangeException
**/
@:native("SetRow")
public function setRow(index:Int, value:godot.Vector3):Void;
/**
Deprecated, please use the array operator instead.
@param index Which column.
@returns One of `Column0`, `Column1`, or `Column2`.
**/
@:native("GetColumn")
public function getColumn(index:Int):godot.Vector3;
/**
Deprecated, please use the array operator instead.
@param index Which column.
@param value The vector to set the column to.
**/
@:native("SetColumn")
public function setColumn(index:Int, value:godot.Vector3):Void;
/**
Deprecated, please use the array operator instead.
@param axis Which column.
@returns One of `Column0`, `Column1`, or `Column2`.
**/
@:native("GetAxis")
public function getAxis(axis:Int):godot.Vector3;
/**
This function considers a discretization of rotations into
24 points on unit sphere, lying along the vectors (x, y, z) with
each component being either -1, 0, or 1, and returns the index
of the point best representing the orientation of the object.
It is mainly used by the `godot.GridMap` editor.
For further details, refer to the Godot source code.
@returns The orthogonal index.
**/
@:native("GetOrthogonalIndex")
public function getOrthogonalIndex():Int;
/**
Returns the inverse of the matrix.
@returns The inverse matrix.
**/
@:native("Inverse")
public function inverse():godot.Basis;
/**
Returns the orthonormalized version of the basis matrix (useful to
call occasionally to avoid rounding errors for orthogonal matrices).
This performs a Gram-Schmidt orthonormalization on the basis of the matrix.
@returns An orthonormalized basis matrix.
**/
@:native("Orthonormalized")
public function orthonormalized():godot.Basis;
/**
Introduce an additional rotation around the given `axis`
by `phi` (in radians). The axis must be a normalized vector.
@param axis The axis to rotate around. Must be normalized.
@param phi The angle to rotate, in radians.
@returns The rotated basis matrix.
**/
@:native("Rotated")
public function rotated(axis:godot.Vector3, phi:Single):godot.Basis;
/**
Introduce an additional scaling specified by the given 3D scaling factor.
@param scale The scale to introduce.
@returns The scaled basis matrix.
**/
@:native("Scaled")
public function scaled(scale:godot.Vector3):godot.Basis;
/**
Assuming that the matrix is a proper rotation matrix, slerp performs
a spherical-linear interpolation with another rotation matrix.
@param target The destination basis for interpolation.
@param weight A value on the range of 0.0 to 1.0, representing the amount of interpolation.
@returns The resulting basis matrix of the interpolation.
**/
@:native("Slerp")
public function slerp(target:godot.Basis, weight:Single):godot.Basis;
/**
Transposed dot product with the X axis of the matrix.
@param with A vector to calculate the dot product with.
@returns The resulting dot product.
**/
@:native("Tdotx")
public function tdotx(with:godot.Vector3):Single;
/**
Transposed dot product with the Y axis of the matrix.
@param with A vector to calculate the dot product with.
@returns The resulting dot product.
**/
@:native("Tdoty")
public function tdoty(with:godot.Vector3):Single;
/**
Transposed dot product with the Z axis of the matrix.
@param with A vector to calculate the dot product with.
@returns The resulting dot product.
**/
@:native("Tdotz")
public function tdotz(with:godot.Vector3):Single;
/**
Returns the transposed version of the basis matrix.
@returns The transposed basis matrix.
**/
@:native("Transposed")
public function transposed():godot.Basis;
/**
Returns a vector transformed (multiplied) by the basis matrix.
@see `godot.Basis.xformInv`
@param v A vector to transform.
@returns The transformed vector.
**/
@:native("Xform")
public function xform(v:godot.Vector3):godot.Vector3;
/**
Returns a vector transformed (multiplied) by the transposed basis matrix.
Note: This results in a multiplication by the inverse of the
basis matrix only if it represents a rotation-reflection.
@see `godot.Basis.xform`
@param v A vector to inversely transform.
@returns The inversely transformed vector.
**/
@:native("XformInv")
public function xformInv(v:godot.Vector3):godot.Vector3;
/**
Returns the basis's rotation in the form of a quaternion.
See `godot.Basis.getEuler` if you need Euler angles, but keep in
mind that quaternions should generally be preferred to Euler angles.
@returns A `godot.Quat` representing the basis's rotation.
**/
@:native("Quat")
public function quat():godot.Quat;
/**
Constructs a pure rotation basis matrix from the given quaternion.
@param quaternion The quaternion to create the basis from.
**/
@:native("new")
public overload function new(quaternion:godot.Quat):Void;
/**
Constructs a pure rotation basis matrix from the given Euler angles
(in the YXZ convention: when *composing*, first Y, then X, and Z last),
given in the vector format as (X angle, Y angle, Z angle).
Consider using the `godot.Basis.#ctor` constructor instead, which
uses a `godot.Quat` quaternion instead of Euler angles.
@param eulerYXZ The Euler angles to create the basis from.
**/
@:native("new")
public overload function new(eulerYXZ:godot.Vector3):Void;
/**
Constructs a pure rotation basis matrix, rotated around the given `axis`
by `phi` (in radians). The axis must be a normalized vector.
@param axis The axis to rotate around. Must be normalized.
@param phi The angle to rotate, in radians.
**/
@:native("new")
public overload function new(axis:godot.Vector3, phi:Single):Void;
/**
Constructs a basis matrix from 3 axis vectors (matrix columns).
@param column0 The X vector, or Column0.
@param column1 The Y vector, or Column1.
@param column2 The Z vector, or Column2.
**/
@:native("new")
public overload function new(column0:godot.Vector3, column1:godot.Vector3, column2:godot.Vector3):Void;
/**
Returns `true` if this basis and `other` are approximately equal,
by running `godot.Vector3.isEqualApprox` on each component.
@param other The other basis to compare.
@returns Whether or not the bases are approximately equal.
**/
@:native("IsEqualApprox")
public function isEqualApprox(other:godot.Basis):Bool;
/**
Converts this `godot.Basis` to a string.
@returns A string representation of this basis.
**/
@:native("ToString")
public overload function toString():std.String;
/**
Converts this `godot.Basis` to a string with the given `format`.
@returns A string representation of this basis.
**/
@:native("ToString")
public overload function toString(format:std.String):std.String;
}