summaryrefslogtreecommitdiffstats
path: root/core/math/vector3.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>
* 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-0/+11
|/ | | | Convenience for a number of cases operating on single values
* [Core] Codestyle improvements to math typesA Thousand Ships2024-03-041-37/+37
|
* Merge pull request #87688 from AThousandShips/what_is_thisRémi Verschelde2024-01-291-2/+2
|\ | | | | | | Remove unnecessary `this->` expressions
| * Remove unnecessary `this->` expressionsA Thousand Ships2024-01-291-2/+2
| |
* | Display values in vector/quaternion math function errorsHugo Locurcio2024-01-281-3/+3
|/ | | | This can help track down the source of the error more easily.
* Added component-wise `min` and `max` functions for vectorsAndrés Botero2023-02-111-0/+8
|
* 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".
* Refactor interpolating functions in some classes to use Math classSilc Renew2022-11-241-21/+13
|
* Refactor Curve3D::_bake() methodYaohua Xiong2022-11-241-0/+13
| | | | | | | | | | The main change is to caculate tangent directly from bezier curve, without going through discretized polyline, avoiding pitfalls of discretization. Other changes are: 1. Add an bezier_derivative() method for Vector3, Vector2, and Math; 2. Add an tesselate_even_length() method to Curve3D, which tesselate bezier curve to even length segments adaptively; 3. Cache the tangent vectors in baked_tangent_vector_cache;
* Add `is_finite` method for checking built-in typesHaoyu Qiu2022-10-081-0/+1
|
* Remove set_all methods from Vector2/3/4Aaron Franke2022-09-191-4/+0
|
* Remove set_axis and get_axis methods from Vector2/2i/3/3i/4/4iAaron Franke2022-09-191-3/+0
|
* Add `is_zero_approx` methods to `Vector2`, `3`, and `4`Jonathan Nicholl2022-09-021-0/+1
|
* Merge pull request #60309 from The-O-King/octRémi Verschelde2022-08-221-0/+2
|\
| * Octahedral Normal/Tangent CompressionOmar El Sheikh2022-08-131-0/+2
| | | | | | | | Implementation of Octahedral normal compression into Godot 4.0
* | Make `cubic_interpolate()` consider key time in animationSilc Renew2022-08-191-0/+9
|/
* Check if the axis is zero / vectors are colinear in Vector3 slerpAaron Franke2022-08-041-1/+10
|
* Refactor bezier interpolation functionsHendrik Brucker2022-06-271-1/+24
|
* Core: Rename math 'phi' arguments to 'angle'Rémi Verschelde2022-05-051-2/+2
|
* Protection for array operator for Vector2 / 3 in DEV buildslawnjelly2022-03-071-0/+2
| | | | | | A previous PR had changed the array operator to give unbounded access. This could cause crashes where old code depended on this previous safe behaviour. This PR adds DEV_ASSERT macros for out of bound access to DEV builds, allowing us to quickly identify bugs in calling code, without affecting performance in release or release_debug editor builds.
* Core: Use forward declares for Vector3/Vector3iRémi Verschelde2022-02-191-36/+8
| | | | Add add Vector3 operator in Vector3i.
* Float literals - fix main primitives to use .flawnjelly2022-02-101-10/+10
| | | | Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations.
* Fix integer vector mul/div operators and bindings.reduz2022-02-061-0/+3
| | | | | | | * Vector2i and Vector3i mul/div by a float results in Vector2 and Vector3 respectively. * Create specializations to allow proper bindings. This fixes #44408 and supersedes #44441 and keeps the same rule of int <op> float returnig float, like with scalars.
* Core: Make all Variant math types structsRémi Verschelde2022-02-041-1/+2
| | | | | | Some were declared as structs (public by default) and others as classes (private by default) but in practice all these math types exposed as Variants are all 100% public.
* Add nodiscard to core math classes to catch c++ errors.lawnjelly2022-01-201-1/+1
| | | | 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.
* Allow Vector2/3 slerp values to have any lengthAaron Franke2022-01-061-2/+10
|
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Expose max_axis_index and max_axis_index for Vector2(i)Aaron Franke2021-12-021-4/+4
| | | | Some cleanup with Vector3(i)'s methods so that it is consistent with Vector2, for example it returns enums internally (GDScript still gets ints).
* Rename Vector parameters to be consistentRaul Santos2021-12-011-9/+9
| | | | | | Renames parameters that were named differently across different scripting languages or their documentation to use the same name everywhere.
* Rename built-in `SGN()` macro to `SIGN()`Hugo Locurcio2021-11-161-1/+1
| | | | | This matches the name of the GDScript function (except it's uppercase here).
* Implement Animation Compressionreduz2021-10-211-1/+26
| | | | | | | | | Roughly based on https://github.com/godotengine/godot-proposals/issues/3375 (used format is slightly different). * Implement bitwidth based animation compression (see animation.h for format). * Can compress imported animations up to 10 times. * Compression format opens the door to streaming. * Works transparently (happens all inside animation.h)
* Replace Vector3.to_diagonal_matrix with Basis.from_scaleAaron Franke2021-09-171-1/+0
|
* Add constant to vector function parameters that don't actually modify their ↵Ricard Rovira Cubeles2021-08-151-24/+36
| | | | | input. Add more overloads of vector multiplication, required by templates to compile with float=64.
* Allow clamping vectors and colorsAaron Franke2021-06-031-0/+1
|
* Rename Vector2 clamped to limit_length and add limit_length to Vector3Aaron Franke2021-06-031-0/+1
|
* Make is_equal_approx have explicit float and double versionsAaron Franke2021-05-201-1/+1
|
* Dynamic BVH broadphase in 2D & 3D Godot PhysicsPouleyKetchoupp2021-05-101-2/+13
| | | | | | | | | | | | | | 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>
* Added signed_angle_to for Vector3JestemStefan2021-02-161-0/+8
|
* Remove useless "else" statements from vector3.hPouleyKetchoupp2021-01-191-16/+8
|
* 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 🎆
* Cleanup unused engine codeTomasz Chabora2020-12-091-1/+0
|
* Improve argument names for core typesAaron Franke2020-12-071-26/+26
|
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-1/+1
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Change inequality comparison operators to use exact equalityAaron Franke2020-09-081-8/+8
|
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-8/+12
| | | | | 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/+2
| | | | | | | | | | | | | | | | | | | | | | | 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.