summaryrefslogtreecommitdiff
path: root/core/math/matrix3.cpp
AgeCommit message (Collapse)Author
2018-06-25Merge pull request #19193 from tagcup/quat_normJuan Linietsky
Fixed Basis -> Quat conversions, added a few safety checks.
2018-05-31Style: Apply clang-format (5.0) to some missed filesRémi Verschelde
2018-05-27Fixed Basis -> Quat conversions, added a few safety checks.tagcup
Fixes #19027.
2018-05-12Add SLERP to Vector{2,3}, optimize Quat's Vector3 rotation.tagcup
Also even out Basis and Quat APIs a little.
2018-04-14Avoid converting Quat to Euler angles when not necessary.tagcup
Also ensure that get_scale doesn't arbitrarlity change the signs of scales, ensuring that the combination of get_rotation and get_scale gives the correct basis. Added various missing functions and constructors. Should close #17968.
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
2018-01-02Merge pull request #15083 from tagcup/spatial_rot_fixJuan Linietsky
Restore the behavior of Spatial rotations recently changed in c1153f5.
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-12-27Restore the behavior of Spatial rotations recently changed in c1153f5.tagcup
That change was borne out of a confusion regarding the meaning of "local" in #14569. Affine transformations in Spatial simply correspond to affine operations of its Transform. Such operations take place in a coordinate system that is defined by the parent Spatial. When there is no parent, they correspond to operations in the global coordinate system. This coordinate system, which is relative to the parent, has been referred to as the local coordinate system in the docs so far, but this sloppy language has apparently confused some users, making them think that the local coordinate system refers to the one whose axes are "painted" on the Spatial node itself. To avoid such conceptual conflations and misunderstandings in the future, the parent-relative local system is now referred to as "parent-local", and the object-relative local system is called "object-local" in the docs. This commit adds the functionality "requested" in #14569, not by changing how rotate/scale/translate works, but by adding new rotate_object_local, scale_object_local and translate_object_local functions. Also, for completeness, there is now global_scale. This commit also updates another part of the docs regarding the rotation property of Spatial, which also leads to confusion among some users.
2017-12-26Change the rotate function of Spatial to be local, makes more sense. Closes ↵Juan Linietsky
#14569
2017-10-31Merge pull request #11249 from m4nu3lf/bugfix/get_eulerRémi Verschelde
Fix inertia tensor update & Generic6DOFJoint & Simplify Basis::get_euler()
2017-10-11Added Basis::get_quat() and set_quat().Ferenc Arn
2017-09-22Fix Basis::get_euler_xyz()m4nu3lf
2017-09-04-Changed KinematicBody API yet again to make it friendlierJuan Linietsky
-Fixed get_scale functions (and added set_scale) to make it more coherent when decomposing and composing (fixes bugs in transform interpolation)
2017-08-30Add a new decomposition to Basis.Ferenc Arn
This new decomposition splits the basis into a rotation-reflection matrix and a positive scaling matrix, which is required for physics calculations.
2017-08-29Remove Basis::set_scale and Basis::set_rotation_* functions.Ferenc Arn
Those functions were added in #8277 but they did more harm than good. They're subtle, don't do what people think and requires users to understand the non-uniqueness of polar decomposition. They ended up confusing people. Until we store additional information enough to make a unique polar decomposition, these functions shouldn't be a part of Basis.
2017-08-27Use HTTPS URL for Godot's website in the headersRémi Verschelde
2017-08-18Fix incorrect workaround for pure Y (X) rotations in XYZ (YXZ) convention.Ferenc Arn
Fixes #10352.
2017-08-09Use YXZ convention for Euler angles.Ferenc Arn
As discussed in issues #1479 and #9782, choosing the up axis (which is Y in Godot) as the axis of the last (or first) rotation is helpful in practical use cases. This also aligns Godot's convention with Unity, helping with a smoother transition for people who are used to working with Unity (issue #9905). Internally, both XYZ and YXZ functions are kept, for potential future applications.
2017-08-07Display the Y angle properly when rotating from gizmo, partially helps #1479Juan Linietsky
2017-07-04Implemented environment arrays for skybox reflection and roughness, quality ↵Juan Linietsky
increase is enormous.
2017-04-24Merge pull request #8277 from tagcup/math_checksRémi Verschelde
Added various functions basic math classes. Also enabled math checks …
2017-04-08Add "Godot Engine contributors" copyright lineRémi Verschelde
2017-04-06Added various functions basic math classes. Also enabled math checks only ↵Ferenc Arn
for debug builds. Added set_scale, set_rotation_euler, set_rotation_axis_angle. Addresses #2565 directly. Added an euler angle constructor for Basis in GDScript and also exposed is_normalized for vectors and quaternions. Various other changes mostly cosmetic in nature.
2017-03-24Merge pull request #8122 from tagcup/axis_check_normalizationRémi Verschelde
Explicitly documented that Transform.basis is not necessarily an orth…
2017-03-24Fix typos in source code using codespellRémi Verschelde
From https://github.com/lucasdemarchi/codespell
2017-03-23Explicitly documented that Transform.basis is not necessarily an orthogonal ↵Ferenc Arn
matrix. Also added a check that in axis-angle rotations, axis is a normalized vector, and modified the docs accordingly. Fixes #8113.
2017-03-05A Whole New World (clang-format edition)Rémi Verschelde
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
2017-01-16Overloaded basic math funcs (double and float variants). Use real_t rather ↵Ferenc Arn
than float or double in generic functions (core/math) whenever possible. Also inlined some more math functions.
2017-01-11Type renames:Juan Linietsky
Matrix32 -> Transform2D Matrix3 -> Basis AABB -> Rect3 RawArray -> PoolByteArray IntArray -> PoolIntArray FloatArray -> PoolFloatArray Vector2Array -> PoolVector2Array Vector3Array -> PoolVector3Array ColorArray -> PoolColorArray
2017-01-10Merge pull request #7426 from m4nu3lf/bugfix/physicsJuan Linietsky
Fixed inertia tensor computation and center of mass
2017-01-09Fixed inertia tensor computation and center of massm4nu3lf
2017-01-08Fix the order in which additional transformations are applied in Matrix3 and ↵Ferenc Arn
Transform. This is a part of the breaking changes proposed in PR #6865, solving the issue regarding the order of affine transformations described in #2565. This PR also fixes the affected code within Godot codebase. Includes improvements to documentation too. Another change is, Matrix3::get_scale() will now return negative scaling when the determinant of the matrix is negative. The rationale behind this is simple: when performing a polar decomposition on a basis matrix M = R.S, we have to ensure that the determinant of R is +1, such that it is a proper rotation matrix (with no reflections) which can be represented by Euler angles or a quaternion. Also replaced the few instances of float with real_t in Matrix3 and Transform. Furthermore, this PR fixes an issue introduced due to the API breakage in #6865. Namely Matrix3::get_euler() now only works with proper rotation matrices. As a result, the code that wants to get the rotation portion of a transform needs to use Matrix3::get_rotation() introduced in this commit, which complements Matrix3::get_scaled(), providing both parts of the polar decomposition. Finally, it is now possible to construct a rotation matrix from Euler angles using the new constructor Matrix3::Matrix3(const Vector3 &p_euler).
2017-01-03Use right handed coordinate system for rotation matrices and quaternions. ↵Ferenc Arn
Also fixes Euler angles (XYZ convention, which is used as default by Blender). Furthermore, functions which expect a rotation matrix will now give an error simply, rather than trying to orthonormalize such matrices. The documentation for such functions has be updated accordingly. This commit breaks code using 3D rotations, and is a part of the breaking changes in 2.1 -> 3.0 transition. The code affected within Godot code base is fixed in this commit.
2017-01-01Welcome in 2017, dear changelog reader!Rémi Verschelde
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer with state-of-the-art rendering techniques tuned to work as low as middle end handheld devices - without compromising with the possibilities given for higher end desktop games of course. Great times ahead for the Godot community and the gamers that will play our games!
2016-03-09remove trailing whitespaceHubert Jarosz
2016-01-01Update copyright to 2016 in headersGeorge Marques
2015-04-18Updated copyright year in all headersJuan Linietsky
2014-02-09GODOT IS OPEN SOURCEJuan Linietsky