Commit Graph

1159 Commits

Author SHA1 Message Date
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 +02:00
faaf27f284 Fix various typos with codespell
Also includes typo fixes from #79993, #80068, #80276, and #80303.

Co-authored-by: betalars <contact@betalars.de>
Co-authored-by: spaceyjase <429978+spaceyjase@users.noreply.github.com>
Co-authored-by: Swarkin <102416174+Swarkin@users.noreply.github.com>
Co-authored-by: Raul Santos <raulsntos@gmail.com>
2023-08-07 13:09:47 +02:00
5f56aa88f8 Add the fill region methods to the AStarGrid2D 2023-07-15 16:52:29 +03:00
e4deaa2727 Merge pull request #76787 from RedworkDE/avoid-localvector-copy
Avoid making unnecessary copies of `LocalVector`
2023-06-20 00:01:55 +02:00
8b188bda52 Consider all triangles for retention in Delaunay Triangulation 2023-06-17 11:18:30 -04:00
77b8e0fcb7 Allow setting negative WorldBoundaryShape2D.distance through the editor 2023-06-14 14:54:00 +02:00
9aa46bf3f5 Fix for SkeletonIK3D interpolation and bone roll
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
2023-06-05 20:44:45 -07:00
66a8418a2d Remove unnecessary Clipper lib includes
Removes unnecessary Clipper lib includes.
2023-05-24 23:57:08 +02:00
5fdc1232ef Add the ability to look-at in model-space.
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.
2023-05-24 10:10:24 +09:00
283cac859c Make ok_color functions static
It needs to be a class to prevent build errors, but the functions can at least be static, so you don't have to instance the class.
2023-05-13 16:57:19 +02:00
cc48827e4a Merge pull request #76946 from AThousandShips/shadow_warning
Enable shadow warnings and fix raised errors
2023-05-12 10:04:09 +02:00
863bcd3e2b Merge pull request #76936 from clayjohn/revert-hsl
Revert "Add API for HSL conversion"
2023-05-12 10:03:21 +02:00
71ee65dc57 Enable shadow warnings and fix raised errors 2023-05-11 16:00:59 +02:00
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 +01:00
f83a90192f Revert "Add API for HSL conversion"
This reverts commit 0b7fd664c1.
2023-05-10 17:45:56 -03:00
0f444f101a Merge pull request #76661 from bonjorno7/hsl
Add API for HSL conversion
2023-05-09 19:28:35 +02:00
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 +02:00
1324c7d06a Avoid making unnecessary copies of LocalVector 2023-05-06 20:39:03 +02:00
610877e326 Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
76ee3d4f31 Allow negative coordinates in AStarGrid2D 2023-04-26 09:29:33 +03:00
290b09b36c Expose determinant in Transform2D, rename internal method 2023-04-22 13:44:14 -05:00
36bedd341a Fix misuses of error macros 2023-04-18 10:20:48 +03:00
846f9e106c Optimize 2D Delaunay and make it more readable
Co-authored-by: Dimitri Tabatadze <tabatadzedima@protonmail.com>
2023-04-09 00:52:15 +02:00
d11bb866ff Fix randfn to prevent generating of nan values 2023-03-03 16:43:48 +03:00
491ded1898 Minor typo and docs URL fixes 2023-02-28 13:38:01 +01:00
f42a837e92 BVH - fix lockguards for multithread mode
Due to a lack of variable name, the BVH lock guards lifetimes previously did not cover the whole function call.

This is fixed, and the warning message for contention is removed as multithread mode seems to be desired in production in 4.x.
2023-02-20 15:15:18 +00:00
5a800e68f1 Bias octahedral tangent y axis to avoid errors around 0 2023-02-13 19:24:14 -08:00
8f46656ae4 Merge pull request #72316 from 0xafbf/component-wise-minmax
Added component-wise `min` and `max` functions for vectors
2023-02-11 22:05:12 +01:00
a90e151b2a Added component-wise min and max functions for vectors 2023-02-11 15:03:11 -05:00
f011d8ca9c Math: Prevent division by zero in posmod
Fixes #43932.

Co-authored-by: David Hoppenbrouwers <david@salt-inc.org>
2023-02-11 20:44:45 +01:00
1459b9c24c Fix scaled_orthogonal() & subgizmo global scaling 2023-02-04 00:46:04 +09:00
e52213e2fa More codespell fixes, do more changes from previous ignore list 2023-02-01 12:11:36 +01:00
394bb0ee2b Fix various typos with codespell
Finally do the childs -> children rename too.
2023-02-01 08:45:41 +01:00
5f3d3722b2 Add support for interpolating skewed transforms 2023-01-28 18:28:42 -06:00
0f8f0ab126 Merge pull request #72170 from Chaosus/astar_fix 2023-01-27 18:52:22 +03:00
f0e3c3f4c3 Merge pull request #72168 from RandomShaper/sensible_lock_return
Booleanize various sync primitives' wait & locking methods
2023-01-27 15:40:43 +01:00
cc0a243ce0 Enchance the performance of AStar by using a LocalVector(2) 2023-01-27 16:28:11 +03:00
f630940591 Booleanize various sync primitives' wait & locking methods 2023-01-27 11:15:30 +01:00
8c25bcdb84 Fix range loop iteration regressions 2023-01-26 00:14:39 +02:00
5b1df48c6c Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
5726bf578d Merge pull request #71676 from vnen/gdscript-unicode-identifiers
Add support for Unicode identifiers in GDScript and Expression
2023-01-23 10:24:33 +01:00
078600a3c4 Enchance the performance of AStar by using a LocalVector 2023-01-22 12:04:41 +03:00
615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +01:00
86ee5f39c4 Add support for Unicode identifiers in Expression class 2023-01-21 13:39:42 -03:00
c0083e431b Cleanup unused engine code v2 2023-01-19 13:02:18 +01:00
7560340ef6 Rename center method to get_center in Plane. 2023-01-15 17:18:50 +01:00
6640eb8065 Fix error in AstarGrid2D::get_id_path 2023-01-08 10:34:33 +03:00
4a45c76737 Fix jumping in AStarGrid2D when DIAGONAL_MODE_NEVER is enabled 2023-01-06 13:40:24 +03:00
e5f6e03490 Merge pull request #70547 from TokageItLab/pingpong-wrap
Fix pingpong-loop with `loop_wrap` is not working & clean-up cubic interpolation key retrieve process
2023-01-06 00:10:18 +01:00