summaryrefslogtreecommitdiffstats
path: root/core/math/basis.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix copyright headers referring to GodotSpartan3222024-10-271-2/+2
|
* Rebrand preambles to RedotDubhghlas McLaughlin2024-10-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* Fix incorrect name of Basis global scale getterAaron Franke2024-04-161-1/+1
|
* Fix some uses of float and real_t in core/mathAaron Franke2024-03-291-1/+1
|
* [Core] Codestyle improvements to math typesA Thousand Ships2024-03-041-2/+2
|
* Remove word duplicates in comments and strings, and fix casing and punctuationRobert Yevdokimov2024-02-231-1/+1
|
* Display values in vector/quaternion math function errorsHugo Locurcio2024-01-281-2/+2
| | | | This can help track down the source of the error more easily.
* Fix Basis is_orthogonal and is_rotation methods, add is_orthonormalAaron Franke2023-12-061-4/+19
|
* Add `is_conformal` method to Basis and Transform2DAaron Franke2023-09-131-0/+8
|
* Fix for SkeletonIK3D interpolation and bone rollLyuma2023-06-051-1/+1
| | | | | Fix bug in internal Basis::rotate_to_align function (also used with identity Basis in scene/resources/curve.cpp) Use ChainItem children rather than local bone rest to determine IK bone roll to match Godot 3.x behavior
* Add the ability to look-at in model-space.Juan Linietsky2023-05-241-2/+5
| | | | | | | | | | This is a much simpler attempt to solve the same problem as #76060, but without breaking any compatibility. * Adds a description of what model space is in the Vector3 enums (MODEL_* constants). This has the proper axes laid out for imported 3D assets. * Adds the option to `look_at` using model_space, which uses Vector3.MODEL_FRONT as forward vector. The attempt of this PR is to still break the assumption that there is a single direction of forward (which is not the case in Godot) and make it easier to understand where 3D models are facing, as well as orienting them via look_at.
* Make acos and asin safelawnjelly2023-05-111-2/+2
| | | | | | A common bug with using acos and asin is that input outside -1 to 1 range will result in Nan output. This can occur due to floating point error in the input. The standard solution is to provide safe_acos function with clamped input. For Godot it may make more sense to make the standard functions safe.
* Fix scaled_orthogonal() & subgizmo global scalingSilc Renew2023-02-041-1/+6
|
* Cleanup unused engine code v2kobewi2023-01-191-25/+0
|
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
* Static analysis: remove "break" after "return"Andy Maloney2022-11-181-4/+4
| | | | Changes as requested to keep in sync with godotengine/godot-cpp#929
* Merge pull request #66747 from aaronfranke/move-euler-orderRémi Verschelde2022-11-021-12/+12
|\ | | | | | | Move EulerOrder enum to math_defs.h and global scope
| * Move EulerOrder enum to math_defs.h and global scopeAaron Franke2022-11-021-12/+12
| |
* | Style: Misc docs and comment style and language fixesRémi Verschelde2022-11-021-1/+1
|/ | | | | | | | | | - Removed empty paragraphs in XML. - Consistently use bold style for "Example:", on a new line. - Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`). - Fix invalid usage of backticks for inline code in BBCode. - Fix some American/British English spelling inconsistencies. - Other minor fixes spotted along the way, including typo fixes with codespell. - Don't specify `@GlobalScope` for `enum` and `constant`.
* Add `is_finite` method for checking built-in typesHaoyu Qiu2022-10-081-0/+4
|
* Use float literals for float calculations in ColorAaron Franke2022-10-071-1/+1
|
* Enhancements to includes in core data structuresAaron Franke2022-10-051-2/+2
|
* Test, refactor and fix a bug in Basis.get_axis_anglefabriceci2022-09-141-25/+26
|
* Add `is_zero_approx` methods to `Vector2`, `3`, and `4`Jonathan Nicholl2022-09-021-3/+3
|
* Expose Basis `set_orthogonal_index` method as a GridMap functionrafallus2022-08-201-61/+0
|
* Fix the calculation of the angular velocity when the rotation speed is not high.fabriceci2022-07-191-7/+6
|
* Fix VECTOR/LOCAL transitions in Node3Dreduz2022-06-271-6/+6
| | | | Fixes #62225, supersedes #62227
* Core: Rename math 'phi' arguments to 'angle'Rémi Verschelde2022-05-051-13/+13
|
* Rename Basis get_axis to get_column, remove redundant methodsAaron Franke2022-05-031-11/+11
|
* Rename Basis "elements" to "rows"Aaron Franke2022-04-291-140/+140
|
* Fix some issues found by cppcheck.bruvzg2022-04-061-1/+1
|
* Float literals - fix main primitives to use real_t castinglawnjelly2022-02-241-14/+14
| | | | Uses (real_t) casting to ensure appropriate calculations are done in 32 bit where real_t is compiled as 32 bit.
* Float literals - fix main primitives to use .flawnjelly2022-02-101-57/+57
| | | | Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations.
* Merge pull request #53684 from TokageItLab/orthogonal-modeRémi Verschelde2022-01-051-0/+39
|\
| * Fix some gizmo behavior to make more consistentSilc 'Tokage' Renew2021-12-251-0/+39
| |
* | Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
|/ | | | Happy new year to the wonderful Godot community!
* Rename built-in `SGN()` macro to `SIGN()`Hugo Locurcio2021-11-161-2/+2
| | | | | This matches the name of the GDScript function (except it's uppercase here).
* clang-format: Enable `BreakBeforeTernaryOperators`Rémi Verschelde2021-10-281-3/+3
| | | | | clang-format keeps breaking the way it handles break *after* ternary operators, so I give up and go with the only style they seem to actually test.
* clang-format: Disable alignment of operands, too unreliableRémi Verschelde2021-10-281-10/+7
| | | | | | | | | Sets `AlignOperands` to `DontAlign`. `clang-format` developers seem to mostly care about space-based indentation and every other version of clang-format breaks the bad mismatch of tabs and spaces that it seems to use for operand alignment. So it's better without, so that it respects our two-tabs `ContinuationIndentWidth`.
* Refactored Node3D rotation modesreduz2021-10-251-298/+210
| | | | | | | | | * Made the Basis euler orders indexed via enum. * Node3D has a new rotation_order property to choose Euler rotation order. * Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations. The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
* Replace Vector3.to_diagonal_matrix with Basis.from_scaleAaron Franke2021-09-171-8/+11
|
* Merge pull request #52229 from lawnjelly/basis_quat_warningMax Hilbrunner2021-09-101-1/+1
|\ | | | | Improve Basis::get_quaternion error message
| * Improve Basis::get_quaternion error messagelawnjelly2021-08-301-1/+1
| | | | | | | | The previous error message incorrectly suggested that any Basis could be fixed by calling get_rotation_quation() or orthonormalize(). This PR points out that only a valid rotation Basis can be fixed in this way.
* | New and improved IK system for Skeleton3DTwistedTwigleg2021-08-141-0/+12
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR and commit adds a new IK system for 3D with the Skeleton3D node that adds several new IK solvers, as well as additional changes and functionality for making bone manipulation in Godot easier. This work was sponsored by GSoC 2020 and TwistedTwigleg Full list of changes: * Adds a SkeletonModification3D resource * This resource is the base where all IK code is written and executed * Adds a SkeletonModificationStack3D resource * This node oversees the execution of the modifications and acts as a bridge of sorts for the modifications to the Skeleton3D node * Adds SkeletonModification3D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK * Each modification is in it's own file * Several changes to Skeletons, listed below: * Added local_pose_override, which acts just like global_pose_override but keeps bone-child relationships intract * So if you move a bone using local_pose_override, all of the bones that are children will also be moved. This is different than global_pose_override, which only affects the individual bone * Internally bones keep track of their children. This removes the need of a processing list, makes it possible to update just a few select bones at a time, and makes it easier to traverse down the bone chain * Additional functions added for converting from world transform to global poses, global poses to local poses, and all the same changes but backwards (local to global, global to world). This makes it much easier to work with bone transforms without needing to think too much about how to convert them. * New signal added, bone_pose_changed, that can be used to tell if a specific bone changed its transform. Needed for BoneAttachment3D * Added functions for getting the forward position of a bone * BoneAttachment3D node refactored heavily * BoneAttachment3D node is now completely standalone in its functionality. * This makes the code easier and less interconnected, as well as allowing them to function properly without being direct children of Skeleton3D nodes * BoneAttachment3D now can be set either using the index or the bone name. * BoneAttachment3D nodes can now set the bone transform instead of just following it. This is disabled by default for compatibility * BoneAttachment3D now shows a warning when not configured correctly * Added rotate_to_align function in Basis * Added class reference documentation for all changes
* Move code for looking_at to BasisAaron Franke2021-08-011-0/+18
|
* Reformat structure string operatorsAaron Franke2021-06-111-12/+3
| | | | | | The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant). For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
* Rename Quat to QuaternionMarcel Admiraal2021-06-041-19/+19
|
* Make is_equal_approx have explicit float and double versionsAaron Franke2021-05-201-1/+1
|
* Core: Drop custom `copymem`/`zeromem` definesRémi Verschelde2021-04-271-1/+0
| | | | | | | | We've been using standard C library functions `memcpy`/`memset` for these since 2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb. There was still the possibility for third-party platform ports to override the definitions with a custom header, but this doesn't seem useful anymore.
* Fixes small typos and grammar correctionAnshul7sp12021-03-121-3/+3
|