Browse Source

Merge pull request #10778 from tagcup/basis_set_rotscale

Remove Basis::set_scale and Basis::set_rotation_* functions.
Rémi Verschelde 8 years ago
parent
commit
3e98835061
5 changed files with 1 additions and 67 deletions
  1. 0 33
      core/math/matrix3.cpp
  2. 0 4
      core/math/matrix3.h
  3. 0 6
      core/variant_call.cpp
  4. 0 23
      doc/base/classes.xml
  5. 1 1
      scene/3d/arvr_nodes.cpp

+ 0 - 33
core/math/matrix3.cpp

@@ -254,17 +254,6 @@ Vector3 Basis::get_scale() const {
 							  Vector3(elements[0][2], elements[1][2], elements[2][2]).length());
 }
 
-// Sets scaling while preserving rotation.
-// This requires some care when working with matrices with negative determinant,
-// since we're using a particular convention for "polar" decomposition in get_scale and get_rotation.
-// For details, see the explanation in get_scale.
-void Basis::set_scale(const Vector3 &p_scale) {
-	Vector3 e = get_euler();
-	Basis(); // reset to identity
-	scale(p_scale);
-	rotate(e);
-}
-
 // Multiplies the matrix from left by the rotation matrix: M -> R.M
 // Note that this does *not* rotate the matrix itself.
 //
@@ -316,28 +305,6 @@ void Basis::get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const {
 	m.get_axis_angle(p_axis, p_angle);
 }
 
-// Sets rotation while preserving scaling.
-// This requires some care when working with matrices with negative determinant,
-// since we're using a particular convention for "polar" decomposition in get_scale and get_rotation.
-// For details, see the explanation in get_scale.
-void Basis::set_rotation_euler(const Vector3 &p_euler) {
-	Vector3 s = get_scale();
-	Basis(); // reset to identity
-	scale(s);
-	rotate(p_euler);
-}
-
-// Sets rotation while preserving scaling.
-// This requires some care when working with matrices with negative determinant,
-// since we're using a particular convention for "polar" decomposition in get_scale and get_rotation.
-// For details, see the explanation in get_scale.
-void Basis::set_rotation_axis_angle(const Vector3 &p_axis, real_t p_angle) {
-	Vector3 s = get_scale();
-	Basis(); // reset to identity
-	scale(s);
-	rotate(p_axis, p_angle);
-}
-
 // get_euler_xyz returns a vector containing the Euler angles in the format
 // (a1,a2,a3), where a3 is the angle of the first rotation, and a1 is the last
 // (following the convention they are commonly defined in the literature).

+ 0 - 4
core/math/matrix3.h

@@ -81,9 +81,6 @@ public:
 	Vector3 get_rotation() const;
 	void get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const;
 
-	void set_rotation_euler(const Vector3 &p_euler);
-	void set_rotation_axis_angle(const Vector3 &p_axis, real_t p_angle);
-
 	Vector3 get_euler_xyz() const;
 	void set_euler_xyz(const Vector3 &p_euler);
 	Vector3 get_euler_yxz() const;
@@ -99,7 +96,6 @@ public:
 	Basis scaled(const Vector3 &p_scale) const;
 
 	Vector3 get_scale() const;
-	void set_scale(const Vector3 &p_scale);
 
 	// transposed dot products
 	_FORCE_INLINE_ real_t tdotx(const Vector3 &v) const {

+ 0 - 6
core/variant_call.cpp

@@ -729,9 +729,6 @@ struct _VariantCall {
 	VCALL_PTR1R(Basis, scaled);
 	VCALL_PTR0R(Basis, get_scale);
 	VCALL_PTR0R(Basis, get_euler);
-	VCALL_PTR1(Basis, set_scale);
-	VCALL_PTR1(Basis, set_rotation_euler);
-	VCALL_PTR2(Basis, set_rotation_axis_angle);
 	VCALL_PTR1R(Basis, tdotx);
 	VCALL_PTR1R(Basis, tdoty);
 	VCALL_PTR1R(Basis, tdotz);
@@ -1700,9 +1697,6 @@ void register_variant_methods() {
 	ADDFUNC0(BASIS, REAL, Basis, determinant, varray());
 	ADDFUNC2(BASIS, BASIS, Basis, rotated, VECTOR3, "axis", REAL, "phi", varray());
 	ADDFUNC1(BASIS, BASIS, Basis, scaled, VECTOR3, "scale", varray());
-	ADDFUNC1(BASIS, NIL, Basis, set_scale, VECTOR3, "scale", varray());
-	ADDFUNC1(BASIS, NIL, Basis, set_rotation_euler, VECTOR3, "euler", varray());
-	ADDFUNC2(BASIS, NIL, Basis, set_rotation_axis_angle, VECTOR3, "axis", REAL, "angle", varray());
 	ADDFUNC0(BASIS, VECTOR3, Basis, get_scale, varray());
 	ADDFUNC0(BASIS, VECTOR3, Basis, get_euler, varray());
 	ADDFUNC1(BASIS, REAL, Basis, tdotx, VECTOR3, "with", varray());

+ 0 - 23
doc/base/classes.xml

@@ -7741,29 +7741,6 @@
 				Introduce an additional scaling specified by the given 3D scaling factor. Only relevant when the matrix is being used as a part of [Transform].
 			</description>
 		</method>
-		<method name="set_rotation_axis_angle">
-			<argument index="0" name="axis" type="Vector3">
-			</argument>
-			<argument index="1" name="angle" type="float">
-			</argument>
-			<description>
-				Changes only the rotation part of the [Basis] to a rotation around given axis by phi, while preserving the scaling part (as determined by get_scale).
-			</description>
-		</method>
-		<method name="set_rotation_euler">
-			<argument index="0" name="euler" type="Vector3">
-			</argument>
-			<description>
-				Changes only the rotation part of the [Basis] to a rotation corresponding to given Euler angles, while preserving the scaling part (as determined by get_scale).
-			</description>
-		</method>
-		<method name="set_scale">
-			<argument index="0" name="scale" type="Vector3">
-			</argument>
-			<description>
-				Changes only the scaling part of the Basis to the specified scaling, while preserving the rotation part (as determined by get_rotation).
-			</description>
-		</method>
 		<method name="tdotx">
 			<return type="float">
 			</return>

+ 1 - 1
scene/3d/arvr_nodes.cpp

@@ -264,7 +264,7 @@ void ARVRAnchor::_notification(int p_what) {
 				// our basis is scaled to the size of the plane the anchor is tracking
 				// extract the size from our basis and reset the scale
 				size = transform.basis.get_scale() * world_scale;
-				transform.basis.set_scale(Vector3(1.0, 1.0, 1.0));
+				transform.basis.orthonormalize();
 
 				// apply our reference frame and set our transform
 				set_transform(arvr_server->get_reference_frame() * transform);