Commit Graph

105 Commits (fe84b84b51df1ff6db658f521d1040aa563cedd0)

Author SHA1 Message Date
Pāvels Nadtočajevs b50d9742c2 Fix `is_valid_float`, `Variant` parser, `Expression` parser, script highlighter, and `TextServer` not handing capital E in scientific notation. 2025-02-05 18:39:40 +07:00
bruvzg 3be46a69c4 Fix uppercase B and X parsing in the integer literals. 2025-02-05 16:02:06 +07:00
Adam d56cbd374b Fix `Basis::get_euler` incorrectly simplifying rotations in some cases. 2025-01-29 16:13:29 +07:00
Silc Lizard (Tokage) Renew 27e23280c5 Fix Quaternion arc constructor to check dot & Add test for same vec3s 2025-01-20 18:16:53 +07:00
Aarni Koskela f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +07:00
Silc Lizard (Tokage) Renew d0c421976c Fix looking at with 180 degree arc
Co-authored-by: Fruitsalad <949631+fruitsalad@users.noreply.github.com>
2025-01-02 15:47:01 +07:00
clayjohn 46ce499b6f Increase precision in linear_to_srgb and srgb_to_linear
This avoids the situation where white stops being white after conversion. While maintaining as much floating point ops as possible
2024-12-20 10:49:43 +07:00
Florent Guiocheau f1f47c3a53 Add tests for `Projection` 2024-11-27 11:09:10 +07:00
Rémi Verschelde 23fc8e22a3
Merge pull request #95303 from EIREXE/inverted_composer
Fix `Projection::invert` for orthographic projection
2024-11-20 17:03:03 +07:00
Álex Román 02b2efc668 Fix Projection::invert on orthogonal projections and others.
Fixes #68878, specially when using orthographic projection.

Also adds some tests.
2024-11-18 16:13:04 +07:00
kobewi 5c0f2414cd Always add decimal when printing float 2024-10-23 15:00:21 +07:00
Rémi Verschelde d1caac5e75
Merge pull request #93856 from timothyqiu/expression-period
Fix parsing of `4.` in Expression
2024-09-11 12:34:39 +07:00
Aaron Franke 7db24a9ad5
Simplify and fix Rect2/AABB get_support function 2024-08-19 23:55:31 +07:00
A Thousand Ships ea2e6be0a6
[Tests] Fix some invalid error messages
These used `utf8().get_data()` when they should be passed as `String`
2024-07-10 15:57:52 +07:00
Haoyu Qiu ee9cea521d Fix parsing of `4.` in Expression 2024-07-02 20:53:52 +07:00
A Thousand Ships 17929a3443
[Tests] Fix unit tests in template builds 2024-06-29 18:35:50 +07:00
Rémi Verschelde 972181d701
Merge pull request #90506 from Calinou/test-transform2d-add-more-tests
Add more unit tests for Transform2D
2024-05-29 22:13:35 +07:00
lawnjelly b35264ad95 Fix AABB Ray intersection - return inside
* Separates find_intersects from test_intersects for rays, and wraps the former.
* Changes parameter name to "r_intersection_point".
* Fixes broken old version which returned per axis t.
* Returns whether the ray origin is within the AABB.
* Returns intersection point when origin outside.
* Returns "backtracking" intersection point when inside.
* Returns sensible normal when inside.
* Returns valid results on borders.
* Returns robust results dealing with floating point error.

Co-authored-by: Claire Blackshaw <evilkimau@gmail.com>
2024-05-09 20:41:19 +07:00
Rémi Verschelde 7d03b1de0b
Style: Trim trailing whitespace and ensure newline at EOF
Found by apply the file_format checks again via #91597.
2024-05-08 10:12:46 +07:00
Joel Kuntz 26feefa91c Add notes for remap's return when istart and istop are the same
Co-Authored-By: Rémi Verschelde <rverschelde@gmail.com>
Co-Authored-By: kleonc <9283098+kleonc@users.noreply.github.com>
2024-05-07 19:37:29 +07:00
Ricardo Buring 8a28f816d0 Replace Clipper1 library by Clipper2 library 2024-04-20 13:37:59 +07:00
Rémi Verschelde 0f7452fedd
Merge pull request #61013 from Calinou/test-add-transform3d
Add rotation unit tests for Transform3D
2024-04-19 16:26:31 +07:00
Alex Billedeaux f421d20280
Add `closest_points_between_segments()` basis path tests for Geometry2D 2024-04-10 23:49:23 +07:00
titus125 ca3ff2b89e
Add more unit tests for Transform2D 2024-04-10 23:17:15 +07:00
Hugo Locurcio 4e6de25540
Add rotation unit tests for Transform3D
Co-authored-by: Alexander Pruss <alex.pruss@gmail.com>
2024-04-10 22:27:14 +07:00
nazarii b8caf9b224 Add unit test for Vector2 plane_project 2024-04-05 21:57:01 +07:00
Aaron Franke 158fcf107c
Fix some uses of float and real_t in core/math 2024-03-29 16:44:12 +07:00
A Thousand Ships b4191bf8f6
[Core] Fix `AABB.encloses` failing on shared upper bound
This differs from `Rect2(i)` and was fixed for those classes in the past
2024-01-12 17:58:42 +07:00
Rémi Verschelde 22e880ad20
Merge pull request #83163 from Chubercik/vectorXi_dist_methods
Implement `Vector2i/3i/4i` methods: `distance_to` and `distance_squared_to`
2024-01-03 09:58:36 +07:00
EddieBreeg 8747c67d9e
Fix potential integer underflow in rounded up divisions
A new `Math::division_round_up()` function was added, allowing for easy
and correct computation of integer divisions when the result needs to
be rounded up.

Fixes #80358.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-01-02 14:14:47 +07:00
Aaron Franke 7ee273723d
Fix Basis is_orthogonal and is_rotation methods, add is_orthonormal 2023-12-06 13:12:05 +07:00
Jakub Marcowski cb954c6bab Implement `Vector2i/3i/4i` methods: `distance_to` and `distance_squared_to` 2023-10-12 13:46:49 +07:00
etti 3a39de4e2f Add rotate_toward and angle_difference to GDScript and C# 2023-10-01 22:19:42 +07:00
Rémi Verschelde 3ec673085b
Merge pull request #79523 from aaronfranke/is-conformal
Add `is_conformal` method to Basis and Transform2D
2023-09-26 13:44:41 +07:00
Aaron Franke bcfb2c0089
Simplify Geometry3D tests 2023-09-25 01:54:22 +07:00
Aaron Franke 56806ffeed
Add `is_conformal` method to Basis and Transform2D 2023-09-13 17:20:30 +07:00
AcatXIo 7d69a5ba50 Fix sign(NAN) returning 1.
Fixes #79036. sign(NAN) now returns 0.
This should not impact performance much in any way.
Adds a test for the NAN case. Updates the documentation to clarify the new behavior.
2023-09-09 11:30:11 +07:00
Jcrespo 528a76486c Add inverse hyperbolic functions `asinh()`, `acosh()` & `atanh()`
GDScript has the following built-in trigonometry functions:

- `sin()`
- `cos()`
- `tan()`
- `asin()`
- `acos()`
- `atan()`
- `atan()`
- `sinh()`
- `cosh()`
- `tanh()`

However, it lacks the hyperbolic arc (also known as inverse
hyperbolic) functions:

- `asinh()`
- `acosh()`
- `atanh()`

Implement them by just exposing the C++ Math library, but clamping
its values to the closest real defined value.
For the cosine, clamp input values lower than 1 to 1.
In the case of the tangent, where the limit value is infinite,
clamp it to -inf or +inf.

References #78377
Fixes godotengine/godot-proposals#7110
2023-09-01 01:27:56 +07:00
Rémi Verschelde 863bcd3e2b
Merge pull request #76936 from clayjohn/revert-hsl
Revert "Add API for HSL conversion"
2023-05-12 10:03:21 +07:00
Rémi Verschelde fd4a06c515
Merge pull request #76906 from lawnjelly/safe_acos4_2
Make acos and asin safe
2023-05-11 13:33:37 +07:00
lawnjelly 50c5ed4876 Make acos and asin safe
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.
2023-05-11 08:34:34 +07:00
clayjohn f83a90192f Revert "Add API for HSL conversion"
This reverts commit 0b7fd664c1.
2023-05-10 17:45:56 +07:00
Rémi Verschelde 703a3ce7ad
Merge pull request #76830 from ajreckof/fix_wrapf_CI_with_too_big_float
fix a test for wrapf with signed 32-bit float
2023-05-10 10:20:03 +07:00
bonjorno7 0b7fd664c1 Add API for HSL conversion
Math ported pretty much 1:1 from https://en.wikipedia.org/wiki/HSL_and_HSV
Style doesn't match the existing HSV code exactly, but should be close enough.
2023-05-09 17:43:10 +07:00
ajreckof fabd9535f0 fix a test for wrapf with signed 32-bit float 2023-05-08 20:53:58 +07:00
Andrés Botero a90e151b2a Added component-wise `min` and `max` functions for vectors 2023-02-11 15:03:11 +07:00
Aaron Franke 5f3d3722b2
Add support for interpolating skewed transforms 2023-01-28 18:28:42 +07:00
Rémi Verschelde 5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +07:00
Raul Santos 7560340ef6
Rename `center` method to `get_center` in Plane. 2023-01-15 17:18:50 +07:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
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".
2023-01-05 13:25:55 +07:00