Merge pull request #10778 from tagcup/basis_set_rotscale
Remove Basis::set_scale and Basis::set_rotation_* functions.
This commit is contained in:
commit
3e98835061
5 changed files with 1 additions and 67 deletions
|
@ -254,17 +254,6 @@ Vector3 Basis::get_scale() const {
|
||||||
Vector3(elements[0][2], elements[1][2], elements[2][2]).length());
|
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
|
// Multiplies the matrix from left by the rotation matrix: M -> R.M
|
||||||
// Note that this does *not* rotate the matrix itself.
|
// 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);
|
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
|
// 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
|
// (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).
|
// (following the convention they are commonly defined in the literature).
|
||||||
|
|
|
@ -81,9 +81,6 @@ public:
|
||||||
Vector3 get_rotation() const;
|
Vector3 get_rotation() const;
|
||||||
void get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) 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;
|
Vector3 get_euler_xyz() const;
|
||||||
void set_euler_xyz(const Vector3 &p_euler);
|
void set_euler_xyz(const Vector3 &p_euler);
|
||||||
Vector3 get_euler_yxz() const;
|
Vector3 get_euler_yxz() const;
|
||||||
|
@ -99,7 +96,6 @@ public:
|
||||||
Basis scaled(const Vector3 &p_scale) const;
|
Basis scaled(const Vector3 &p_scale) const;
|
||||||
|
|
||||||
Vector3 get_scale() const;
|
Vector3 get_scale() const;
|
||||||
void set_scale(const Vector3 &p_scale);
|
|
||||||
|
|
||||||
// transposed dot products
|
// transposed dot products
|
||||||
_FORCE_INLINE_ real_t tdotx(const Vector3 &v) const {
|
_FORCE_INLINE_ real_t tdotx(const Vector3 &v) const {
|
||||||
|
|
|
@ -729,9 +729,6 @@ struct _VariantCall {
|
||||||
VCALL_PTR1R(Basis, scaled);
|
VCALL_PTR1R(Basis, scaled);
|
||||||
VCALL_PTR0R(Basis, get_scale);
|
VCALL_PTR0R(Basis, get_scale);
|
||||||
VCALL_PTR0R(Basis, get_euler);
|
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, tdotx);
|
||||||
VCALL_PTR1R(Basis, tdoty);
|
VCALL_PTR1R(Basis, tdoty);
|
||||||
VCALL_PTR1R(Basis, tdotz);
|
VCALL_PTR1R(Basis, tdotz);
|
||||||
|
@ -1700,9 +1697,6 @@ void register_variant_methods() {
|
||||||
ADDFUNC0(BASIS, REAL, Basis, determinant, varray());
|
ADDFUNC0(BASIS, REAL, Basis, determinant, varray());
|
||||||
ADDFUNC2(BASIS, BASIS, Basis, rotated, VECTOR3, "axis", REAL, "phi", varray());
|
ADDFUNC2(BASIS, BASIS, Basis, rotated, VECTOR3, "axis", REAL, "phi", varray());
|
||||||
ADDFUNC1(BASIS, BASIS, Basis, scaled, VECTOR3, "scale", 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_scale, varray());
|
||||||
ADDFUNC0(BASIS, VECTOR3, Basis, get_euler, varray());
|
ADDFUNC0(BASIS, VECTOR3, Basis, get_euler, varray());
|
||||||
ADDFUNC1(BASIS, REAL, Basis, tdotx, VECTOR3, "with", varray());
|
ADDFUNC1(BASIS, REAL, Basis, tdotx, VECTOR3, "with", varray());
|
||||||
|
|
|
@ -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].
|
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>
|
</description>
|
||||||
</method>
|
</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">
|
<method name="tdotx">
|
||||||
<return type="float">
|
<return type="float">
|
||||||
</return>
|
</return>
|
||||||
|
|
|
@ -264,7 +264,7 @@ void ARVRAnchor::_notification(int p_what) {
|
||||||
// our basis is scaled to the size of the plane the anchor is tracking
|
// our basis is scaled to the size of the plane the anchor is tracking
|
||||||
// extract the size from our basis and reset the scale
|
// extract the size from our basis and reset the scale
|
||||||
size = transform.basis.get_scale() * world_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
|
// apply our reference frame and set our transform
|
||||||
set_transform(arvr_server->get_reference_frame() * transform);
|
set_transform(arvr_server->get_reference_frame() * transform);
|
||||||
|
|
Loading…
Reference in a new issue