@@ -124,10 +124,15 @@ impl Basis {
124124 /// Create a `Basis` from a `Quaternion`.
125125 ///
126126 /// _Godot equivalent: `Basis(Quaternion from)`_
127- pub fn from_quat ( quat : Quaternion ) -> Self {
127+ pub fn from_quaternion ( quat : Quaternion ) -> Self {
128128 RMat3 :: from_quat ( quat. to_glam ( ) ) . to_front ( )
129129 }
130130
131+ #[ deprecated = "Renamed to `from_quaternion()`" ]
132+ pub fn from_quat ( quat : Quaternion ) -> Self {
133+ Self :: from_quaternion ( quat)
134+ }
135+
131136 /// Create a `Basis` from three angles `a`, `b`, and `c` interpreted
132137 /// as Euler angles according to the given `EulerOrder`.
133138 ///
@@ -162,23 +167,20 @@ impl Basis {
162167 /// (implies +X is right).
163168 ///
164169 /// _Godot equivalent: `Basis.looking_at()`_
165- pub fn new_looking_at ( target : Vector3 , up : Vector3 , use_model_front : bool ) -> Self {
170+ pub fn looking_at ( target : Vector3 , up : Vector3 , use_model_front : bool ) -> Self {
166171 super :: inner:: InnerBasis :: looking_at ( target, up, use_model_front)
167172 }
168173
174+ #[ deprecated = "Renamed to `looking_at()`" ]
175+ pub fn new_looking_at ( target : Vector3 , up : Vector3 , use_model_front : bool ) -> Self {
176+ Self :: looking_at ( target, up, use_model_front)
177+ }
178+
169179 /// Creates a `[Vector3; 3]` with the columns of the `Basis`.
170180 pub fn to_cols ( & self ) -> [ Vector3 ; 3 ] {
171181 self . transposed ( ) . rows
172182 }
173183
174- /// Creates a [`Quaternion`] representing the same rotation as this basis.
175- ///
176- /// _Godot equivalent: `Basis.get_rotation_quaternion()`_
177- #[ doc( alias = "get_rotation_quaternion" ) ]
178- pub fn to_quat ( & self ) -> Quaternion {
179- RQuat :: from_mat3 ( & self . orthonormalized ( ) . to_glam ( ) ) . to_front ( )
180- }
181-
182184 const fn to_rows_array ( self ) -> [ real ; 9 ] {
183185 let [ Vector3 {
184186 x : ax,
@@ -196,11 +198,24 @@ impl Basis {
196198 [ ax, bx, cx, ay, by, cy, az, bz, cz]
197199 }
198200
201+ /// Creates a [`Quaternion`] representing the same rotation as this basis.
202+ ///
203+ /// _Godot equivalent: `Basis.get_rotation_quaternion()`_
204+ #[ doc( alias = "get_rotation_quaternion" ) ]
205+ pub fn get_quaternion ( & self ) -> Quaternion {
206+ RQuat :: from_mat3 ( & self . orthonormalized ( ) . to_glam ( ) ) . to_front ( )
207+ }
208+
209+ #[ deprecated = "Renamed to `get_quaternion()`" ]
210+ pub fn to_quat ( & self ) -> Quaternion {
211+ self . get_quaternion ( )
212+ }
213+
199214 /// Returns the scale of the matrix.
200215 ///
201216 /// _Godot equivalent: `Basis.get_scale()`_
202217 #[ must_use]
203- pub fn scale ( & self ) -> Vector3 {
218+ pub fn get_scale ( & self ) -> Vector3 {
204219 let det = self . determinant ( ) ;
205220 let det_sign = if det < 0.0 { -1.0 } else { 1.0 } ;
206221
@@ -211,12 +226,24 @@ impl Basis {
211226 ) * det_sign
212227 }
213228
229+ #[ deprecated = "Renamed to `get_scale()`" ]
230+ pub fn scale ( & self ) -> Vector3 {
231+ self . get_scale ( )
232+ }
233+
234+ /// Returns the rotation of the matrix in euler angles, with the order `YXZ`.
235+ ///
236+ /// See [`get_euler_with()`](Self::get_euler_with) for custom angle orders.
237+ pub fn get_euler ( & self ) -> Vector3 {
238+ self . get_euler_with ( EulerOrder :: YXZ )
239+ }
240+
214241 /// Returns the rotation of the matrix in euler angles.
215242 ///
216- /// The order of the angles are given by `order`.
243+ /// The order of the angles are given by `order`. To use the default order `YXZ`, see [`get_euler()`](Self::get_euler).
217244 ///
218245 /// _Godot equivalent: `Basis.get_euler()`_
219- pub fn to_euler ( & self , order : EulerOrder ) -> Vector3 {
246+ pub fn get_euler_with ( & self , order : EulerOrder ) -> Vector3 {
220247 use glam:: swizzles:: Vec3Swizzles as _;
221248
222249 let col_a = self . col_a ( ) . to_glam ( ) ;
@@ -276,6 +303,11 @@ impl Basis {
276303 . to_front ( )
277304 }
278305
306+ #[ deprecated = "Renamed to `get_euler()` + `get_euler_with()`" ]
307+ pub fn to_euler ( & self , order : EulerOrder ) -> Vector3 {
308+ self . get_euler_with ( order)
309+ }
310+
279311 fn is_between_neg1_1 ( f : real ) -> Ordering {
280312 if f >= ( 1.0 - real:: CMP_EPSILON ) {
281313 Ordering :: Greater
@@ -416,10 +448,10 @@ impl Basis {
416448 /// _Godot equivalent: `Basis.slerp()`_
417449 #[ must_use]
418450 pub fn slerp ( & self , other : & Self , weight : real ) -> Self {
419- let from = self . to_quat ( ) ;
420- let to = other. to_quat ( ) ;
451+ let from = self . get_quaternion ( ) ;
452+ let to = other. get_quaternion ( ) ;
421453
422- let mut result = Self :: from_quat ( from. slerp ( to, weight) ) ;
454+ let mut result = Self :: from_quaternion ( from. slerp ( to, weight) ) ;
423455
424456 for i in 0 ..3 {
425457 result. rows [ i] *= self . rows [ i] . length ( ) . lerp ( other. rows [ i] . length ( ) , weight) ;
@@ -649,7 +681,7 @@ mod test {
649681 let to_rotation: Basis = Basis :: from_euler ( rot_order, original_euler) ;
650682
651683 // Euler from rotation
652- let euler_from_rotation: Vector3 = to_rotation. to_euler ( rot_order) ;
684+ let euler_from_rotation: Vector3 = to_rotation. get_euler_with ( rot_order) ;
653685 let rotation_from_computed_euler: Basis = Basis :: from_euler ( rot_order, euler_from_rotation) ;
654686
655687 let res: Basis = to_rotation. inverse ( ) * rotation_from_computed_euler;
@@ -670,7 +702,7 @@ mod test {
670702 ) ;
671703
672704 // Double check `to_rotation` decomposing with XYZ rotation order.
673- let euler_xyz_from_rotation: Vector3 = to_rotation. to_euler ( EulerOrder :: XYZ ) ;
705+ let euler_xyz_from_rotation: Vector3 = to_rotation. get_euler_with ( EulerOrder :: XYZ ) ;
674706 let rotation_from_xyz_computed_euler: Basis =
675707 Basis :: from_euler ( EulerOrder :: XYZ , euler_xyz_from_rotation) ;
676708
0 commit comments