summaryrefslogtreecommitdiffstats
path: root/core/math/rect2.h
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>
* Simplify and fix Rect2/AABB get_support functionAaron Franke2024-08-191-7/+9
|
* Merge pull request #90582 from Repiteo/core/remove-macro-_NO_DISCARD_Rémi Verschelde2024-06-251-1/+1
|\ | | | | | | Core: Replace `_NO_DISCARD_` macro with `[[nodiscard]]`
| * Core: Replace `_NO_DISCARD_` macro with attributeThaddeus Crews2024-04-121-1/+1
| |
* | [Core] Add scalar versions of `Vector*` `min/max/clamp/snap(ped)`A Thousand Ships2024-05-021-1/+1
|/ | | | Convenience for a number of cases operating on single values
* Fix some uses of float and real_t in core/mathAaron Franke2024-03-291-4/+4
|
* Use `Vector*` component-wise `min/max/clamp` functions where applicableA Thousand Ships2024-03-201-9/+5
|
* [Core] Codestyle improvements to math typesA Thousand Ships2024-03-041-1/+1
|
* Rework blending method in Variant animation for Int/Array/StringSilc Lizard (Tokage) Renew2023-11-161-0/+4
|
* Minor typo and docs URL fixesRémi Verschelde2023-02-281-1/+1
|
* 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/+1
|
* Use float literals for float calculations in ColorAaron Franke2022-10-071-5/+5
|
* Enhancements to includes in core data structuresAaron Franke2022-10-051-1/+1
|
* Replace Rect2(i) has_no_area with has_areaAaron Franke2022-09-041-2/+2
|
* 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 Vector2i to its own `vector2i.h` headerRémi Verschelde2022-02-041-0/+1
| | | | Also reduce interdependencies and clean up a bit.
* Core: Move Rect2i to its own `rect2i.h` headerRémi Verschelde2022-02-041-211/+6
| | | | | And take the opportunity to improve interdependencies a bit with forward declares where possible.
* Fix incorrect Rect2i calculations: intersects and enclosesMarkus Sauermann2022-01-311-6/+6
| | | | Clarify expand documentation
* Add nodiscard to core math classes to catch c++ errors.lawnjelly2022-01-201-2/+2
| | | | A common source of errors is to call functions (such as round()) expecting them to work in place, but them actually being designed only to return the processed value. Not using the return value in this case in indicative of a bug, and can be flagged as a warning by using the [[nodiscard]] attribute.
* Remove zero size checks from Rect2 grow methodsAaron Franke2022-01-141-20/+0
|
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Warn when using an AABB or Rect2 with a negative sizeAaron Franke2021-11-301-5/+77
|
* clang-format: Disable alignment of operands, too unreliableRémi Verschelde2021-10-281-5/+5
| | | | | | | | | 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`.
* Add Get Center Method for Rect2/Rect2i and AABB.Anilforextra2021-09-211-1/+5
|
* Reformat structure string operatorsAaron Franke2021-06-111-2/+2
| | | | | | 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)
* Dynamic BVH broadphase in 2D & 3D Godot PhysicsPouleyKetchoupp2021-05-101-4/+8
| | | | | | | | | | | | | | Port lawnjelly's dynamic BVH implementation from 3.x to be used in both 2D and 3D broadphases. Removed alternative broadphase implementations which are not meant to be used anymore since they are much slower. Includes changes in Rect2, Vector2, Vector3 that help with the template implementation of the dynamic BVH by uniformizing the interface between 2D and 3D math. Co-authored-by: lawnjelly <lawnjelly@gmail.com>
* 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 🎆
* Merge pull request #44149 from madmiraal/rename-tangent-orthogonalRémi Verschelde2020-12-281-1/+1
|\ | | | | Rename Vector2.tangent() to Vector2.orthogonal()
| * Rename Vector2.tangent() to Vector2.orthogonal()Marcel Admiraal2020-12-061-1/+1
| |
* | Rename Rect2 and Rect2i grow_margin() to grow_side()Marcel Admiraal2020-12-281-16/+16
| |
* | Rename Control margin to offsetMarcel Admiraal2020-12-231-14/+14
| |
* | Rename Rect2 and Rect2i clip() to intersection()Marcel Admiraal2020-12-191-2/+4
|/
* Refactored variant setters/gettersreduz2020-11-071-0/+17
| | | | | | -Discern between named, indexed and keyed -Get direct access to functions for typed GDScript and GDNative bindings -Small changes to some classes in order to work with the new setget binder
* doc: Sync classref with current source + fixup some bindingsRémi Verschelde2020-11-041-6/+6
| | | | Includes various changes triggered by the refactoring of method bindings.
* Implement DirectionalLight2Dreduz2020-11-041-0/+62
| | | | | | | Also separated Light2D in PointLight2D and DirectionalLight2D. Used PointLight2D because its more of a point, and it does not work the same as OmniLight (as shape depends on texture). Added a few utility methods to Rect2D I needed.
* Refactored binding system for core typesreduz2020-10-141-0/+8
| | | | | | | | | Moved to a system using variadic templates, shared with CallableBind. New code is cleaner, faster and allows for much better optimization of core type functions from GDScript and GDNative. Added Variant::InternalMethod function for direct call access.
* Style: Remove unnecessary semicolons from `core`Rémi Verschelde2020-05-191-2/+2
| | | | | | | | | | Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-32/+63
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-16/+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.
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-141-1/+2
| | | | | | | | | | Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
* Replace NULL with nullptrlupoDharkael2020-04-021-1/+1
|
* Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()'Michael Alexsander2020-03-041-22/+20
|
* Add support for Vector2i, Rect2i and Vector3i to VariantJuan Linietsky2020-02-221-0/+5
| | | | | | | WARNING: Requires C++17 'guaranteed copy elision' to fix ambiguous operator problems in Variant. This was added for this commit (and future C++17 uses) in #36457.
* Fix bug where Control at origin with 0 size not renderednathanwfranke2020-02-071-0/+13
| | | | | | | | Make a new method instead to make the code more elegant Move Function down a bit
* 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/+1
| | | | This commit adds exposed behavior for C#
* Make Rect2.encloses return true on same sizeAlexander Holland2019-10-021-2/+2
|
* Merge pull request #27676 from qarmin/small_fixes_2Rémi Verschelde2019-05-011-1/+1
|\ | | | | Small fixes to static analyzer bugs