summaryrefslogtreecommitdiffstats
path: root/core/math/transform_2d.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>
* [Core] Codestyle improvements to math typesA Thousand Ships2024-03-041-13/+13
|
* Add and expose Basis/Transform2D/3D division by float operatorAaron Franke2023-12-201-0/+12
|
* Add `is_conformal` method to Basis and Transform2DAaron Franke2023-09-131-0/+12
|
* Expose `determinant` in Transform2D, rename internal methodAaron Franke2023-04-221-5/+5
|
* More codespell fixes, do more changes from previous ignore listRémi Verschelde2023-02-011-4/+4
|
* Add support for interpolating skewed transformsAaron Franke2023-01-281-33/+6
|
* Cleanup unused engine code v2kobewi2023-01-191-6/+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".
* 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
|
* Fix consistency of translated/scaled/rotated in Transform2D and Transform3DFabian Keller2022-08-021-10/+24
|
* rename translate(d) to translate(d)_local in Transform 2D/3DFabian Keller2022-07-161-5/+5
|
* Core: Rename math 'phi' arguments to 'angle'Rémi Verschelde2022-05-051-4/+4
|
* Rename Transform2D "elements" to "columns"Aaron Franke2022-04-291-58/+58
|
* Float literals - fix main primitives to use real_t castinglawnjelly2022-02-241-2/+2
| | | | 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-5/+5
| | | | Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations.
* Core: Move Rect2i to its own `rect2i.h` headerRémi Verschelde2022-02-041-0/+2
| | | | | And take the opportunity to improve interdependencies a bit with forward declares where possible.
* 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-3/+3
| | | | | This matches the name of the GDScript function (except it's uppercase here).
* clang-format: Disable alignment of operands, too unreliableRémi Verschelde2021-10-281-2/+2
| | | | | | | | | 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`.
* Merge pull request #52430 from AnilBK/vector2-replacementsRémi Verschelde2021-09-241-1/+1
|\
| * Use builtin Vector2 functions for calculation of angles.Anilforextra2021-09-071-1/+1
| | | | | | | | .
* | Expose get_skew for transform2d and add new constructorVincent D2021-09-191-7/+15
|/ | | | | | | | | | Expose set_scale and set_skew for transform2d Replacing float by real_t Adding const parameters Updated transform2d doc
* Allow multiplying Transforms and Basis by numbersAaron Franke2021-06-151-0/+12
|
* Reformat structure string operatorsAaron Franke2021-06-111-1/+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)
* New and improved IK system for Skeleton2DTwistedTwigleg2021-06-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR and commit adds a new IK system for 2D with the Skeleton2D node that adds several new IK solvers, a way to control bones in a Skeleton2D node similar to that in Skeleton3D. It also adds additional changes and functionality. This work was sponsored by GSoC 2020 and TwistedTwigleg. Full list of changes: * Adds a SkeletonModifier2D resource * This resource is the base where all IK code is written and executed * Has a function for clamping angles, since it is so commonly used * Modifiers are unique when duplicated so it works with instancing * Adds a SkeletonModifierStack2D resource * This resource manages a series of SkeletonModification2Ds * This is what the Skeleton2D directly interfaces with to make IK possible * Adds SkeletonModifier2D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK * Each modification is in its own file * There is also a SkeletonModifier2D resource that acts as a stack for using multiple stacks together * Adds a PhysicalBone2D node * Works similar to the PhysicalBone3D node, but uses a RigidBody2D node * Changes to Skeleton2D listed below: * Skeleton2D now holds a single SkeletonModificationStack2D for IK * Skeleton2D now has a local_pose_override, which overrides the Bone2D position similar to how the overrides work in Skeleton3D * Changes to Bone2D listed below: * The default_length property has been changed to length. Length is the length of the bone to its child bone node * New bone_angle property, which is the angle the bone has to its first child bone node * Bone2D caches its transform when not modified by IK for IK interpolation purposes * Bone2D draws its own editor gizmo, though this is stated to change in the future * Changes to CanvasItemEditor listed below: * Bone2D gizmo drawing code removed * The 2D IK code is removed. Now Bone2D is the only bone system for 2D * Transform2D now has a looking_at function for rotating to face a position * Two new node notifications: NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE * These notifications only are called in the editor right before and after saving a scene * Needed for not saving the IK position when executing IK in the editor * Documentation for all the changes listed above.
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Minor clamp and float fixesAaron Franke2020-11-101-1/+1
|
* Simplify Transform2D get_rotationAaron Franke2020-06-171-6/+1
|
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-2/+4
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-24/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Implement Skew in Node2DJuan Linietsky2020-05-011-0/+12
| | | | Skew is x-axis only, because it must be bidirectionally convertible to a 2x3 matrix, but you can subtract it to the rotation to get the effect on y-axis
* [Core] Rename linear_interpolate to lerpAaron Franke2020-04-291-3/+3
|
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
* Make is_equal_approx separate for structuresAaron Franke2019-10-141-0/+6
| | | | This commit adds exposed behavior for C#
* Added ability for multiple images to be imported as an atlasJuan Linietsky2019-04-191-1/+1
| | | | | This adds support for groups in the import system, which point to a single file. Add property hint for saving files in file field
* [Core] Transform2D add set_scale and fix set_rotationAaron Franke2019-02-121-2/+10
| | | | Note: These are still not exposed to GDScript
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* [Core] Move Rect2 and Transform2D to their own filesAaron Franke2018-08-101-0/+272
Math2D includes Transform2D, which includes Rect2, which includes Vector2.