summaryrefslogtreecommitdiff
path: root/core/math
AgeCommit message (Collapse)Author
2017-04-28Move core thirdparty files to thirdparty/{minizip,misc}Rémi Verschelde
2017-04-24Merge pull request #8277 from tagcup/math_checksRémi Verschelde
Added various functions basic math classes. Also enabled math checks …
2017-04-17Fix PRNG randomization.Ferenc Arn
PCG32 doesn't like small seeds, which leads to zero random values (prior to #7532, zero values were handled as special cases). Use a large default seed, and also add a shift in Math::randomize. Fixes #8423.
2017-04-08Particle system is complete. Rejoice!Juan Linietsky
2017-04-08Add "Godot Engine contributors" copyright lineRémi Verschelde
2017-04-06New particle system, mostly working, some small features missing.Juan Linietsky
2017-04-06Added various functions basic math classes. Also enabled math checks only ↵Ferenc Arn
for debug builds. Added set_scale, set_rotation_euler, set_rotation_axis_angle. Addresses #2565 directly. Added an euler angle constructor for Basis in GDScript and also exposed is_normalized for vectors and quaternions. Various other changes mostly cosmetic in nature.
2017-04-05Merge pull request #8214 from tagcup/bounce_reflect_slideRémi Verschelde
Made slide and reflect active verbs acting on itself in Vector2 and V…
2017-04-03Made slide and reflect active verbs acting on itself in Vector2 and Vector3.Ferenc Arn
This is in alignment with other functions in vector classes. Also added checks for normalization, fixed the sign of reflect (which now corresponds to reflection along a plane mathematically), added bounce method and updated docs. Fixes #8201.
2017-04-03Merge pull request #8146 from supagu/astarRémi Verschelde
Added ability to change A-star cost function
2017-04-01Added ability to change A-star cost functionFabian Mathews
2017-03-29Fix polar decomposition in 2D.Ferenc Arn
When performing polar decomposition in 2D as B = R.S, where R is rotation (with determinant +1) and S is scaling, use the convention that reflections are absorbed into S through a reflection around y axis. In 3D, this is done by using a reflection along all three axes, but since the dimensionality is even in 2D, one axis needs to be chosen. Fixes Matrix32::get_rotation and Matrix32::get_scale (which weren't properly fixed in #7445).
2017-03-24Merge pull request #8132 from tagcup/vector3_angle_toRémi Verschelde
Use atan2 rather than acos in Vector3.angle_to.
2017-03-24Merge pull request #8122 from tagcup/axis_check_normalizationRémi Verschelde
Explicitly documented that Transform.basis is not necessarily an orth…
2017-03-24Fix typos in source code using codespellRémi Verschelde
From https://github.com/lucasdemarchi/codespell
2017-03-24Use atan2 rather than acos in Vector3.angle_to.Ferenc Arn
Fixes #8111.
2017-03-23Explicitly documented that Transform.basis is not necessarily an orthogonal ↵Ferenc Arn
matrix. Also added a check that in axis-angle rotations, axis is a normalized vector, and modified the docs accordingly. Fixes #8113.
2017-03-05A Whole New World (clang-format edition)Rémi Verschelde
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
2017-03-05Add a bunch of missing Godot headers in own filesRémi Verschelde
2017-03-01Fix RANDOM_MAX, which is 2^32-1 with PCG32.Leandro Motta Barros
2017-02-28Inf and NaN support added to GDScript.Saracen
2017-02-16Correct hash behavior for floating point numbersHein-Pieter van Braam
This fixes HashMap where a key or part of a key is a floating point number. To fix this the following has been done: * HashMap now takes an extra template argument Comparator. This class gets used to compare keys. The default Comperator now works correctly for common types and floating point numbets. * Variant implements ::hash_compare() now. This function implements nan-safe comparison for all types with components that contain floating point numbers. * Variant now has a VariantComparator which uses Variant::hash_compare() safely compare floating point components of variant's types. * The hash functions for floating point numbers will now normalize NaN values so that all floating point numbers that are NaN hash to the same value. C++ module writers that want to use HashMap internally in their modules can now also safeguard against this crash by defining their on Comperator class that safely compares their types. GDScript users, or writers of modules that don't use HashMap internally in their modules don't need to do anything. This fixes #7354 and fixes #6947.
2017-02-15Many fixes to make exported scenes work better, still buggy.Juan Linietsky
2017-02-14Revert "Make nan==nan true for GDScript"Juan Linietsky
2017-02-14Make nan==nan true for GDScriptHein-Pieter van Braam
After discussing this with Reduz this seemed like the best way to fix #7354. This will make composite values that contain NaN in the same places as well as the same other values compare as the same. Additionally non-composite values now also compare equal if they are both NaN. This breaks IEEE specifications but this is probably what most users expect. There is a GDScript function check for NaN if the user needs this information. This fixes #7354 and probably also fixes #6947
2017-02-13Rename the _MD macro to D_METHODHein-Pieter van Braam
This new name also makes its purpose a little clearer This is a step towards fixing #56
2017-01-21WIP new AudioServer, with buses, effects, etc.Juan Linietsky
2017-01-20Merge pull request #7528 from tagcup/real_t_float_fixesJuan Linietsky
Use real_t rather than float or double in generic functions (core/mat…
2017-01-18Some changes in the header so Godot3 compiles again on Windows.BastiaanOlij
2017-01-16Overloaded basic math funcs (double and float variants). Use real_t rather ↵Ferenc Arn
than float or double in generic functions (core/math) whenever possible. Also inlined some more math functions.
2017-01-16Merge pull request #7532 from tagcup/pcg_prngRémi Verschelde
Replace the existing PRNG (Xorshift31) with (minimal) PCG-32.
2017-01-16Fix compile errors related to audio on OSXBastiaanOlij
2017-01-16Style: Various fixes to play nice with clang-formatRémi Verschelde
2017-01-16Style: Fix statements ending with ';;'Rémi Verschelde
2017-01-16Style: Cleanups, added headers, renamed filesRémi Verschelde
Made sure files in core/ and tools/ have a proper Godot license header when written by us. Also renamed aabb.{cpp,h} and object_type_db.{cpp,h} to rect3.{cpp,h} and class_db.{cpp,h} respectively. Also added a proper header to core/io/base64.{c,h} after clarifying the licensing with the original author (public domain).
2017-01-15Replace the existing PRNG (Xorshift31) with (minimal) PCG (XSH-RR variant ↵Ferenc Arn
with 32-bit output, 64-bit state). PCG is better than many alternatives by many metrics (see www.pcg-random.org) including statistical quality with good speed.
2017-01-15Oops! Audio engine has vanished :DJuan Linietsky
2017-01-14Style: Fix whole-line commented codeRémi Verschelde
They do not play well with clang-format which aligns the `//` part with the rest of the code block, thus producing badly indented commented code.
2017-01-13Vector2.get_aspect() renamed to Vector2.aspect() to keep consistent method ↵Juan Linietsky
naming
2017-01-12made math functions inlnieJuan Linietsky
2017-01-11Type renames:Juan Linietsky
Matrix32 -> Transform2D Matrix3 -> Basis AABB -> Rect3 RawArray -> PoolByteArray IntArray -> PoolIntArray FloatArray -> PoolFloatArray Vector2Array -> PoolVector2Array Vector3Array -> PoolVector3Array ColorArray -> PoolColorArray
2017-01-10Merge pull request #7426 from m4nu3lf/bugfix/physicsJuan Linietsky
Fixed inertia tensor computation and center of mass
2017-01-10Merge pull request #7445 from tagcup/2d_math_fixesJuan Linietsky
Various corrections in 2D math.
2017-01-10Merge pull request #7438 from tagcup/matrix3_rotate_fixJuan Linietsky
Fix the order in which additional transformations are applied
2017-01-10Various corrections in 2D math.Ferenc Arn
This is the follow up for the 2D changes mentioned in PR #6865. It fixes various mistakes regarding the order of matrix indices, order of transformation operations, usage of atan2 function and ensures that the sense of rotation is compatible with a left-handed coordinate system with Y-axis pointing down (which flips the sense of rotations along the z-axis). Also replaced float with real_t, and tried to make use of Matrix32 methods rather than accessing its elements directly. Affected code in the Godot code base is also fixed in this commit. The user code using functions involving angles such as atan2, angle_to, get_rotation, set_rotation will need to be updated to conform with the new behavior. Furthermore, the sign of the rotation angles in existing 2D scene files need to be flipped as well.
2017-01-09Fixed inertia tensor computation and center of massm4nu3lf
2017-01-08Fix the order in which additional transformations are applied in Matrix3 and ↵Ferenc Arn
Transform. This is a part of the breaking changes proposed in PR #6865, solving the issue regarding the order of affine transformations described in #2565. This PR also fixes the affected code within Godot codebase. Includes improvements to documentation too. Another change is, Matrix3::get_scale() will now return negative scaling when the determinant of the matrix is negative. The rationale behind this is simple: when performing a polar decomposition on a basis matrix M = R.S, we have to ensure that the determinant of R is +1, such that it is a proper rotation matrix (with no reflections) which can be represented by Euler angles or a quaternion. Also replaced the few instances of float with real_t in Matrix3 and Transform. Furthermore, this PR fixes an issue introduced due to the API breakage in #6865. Namely Matrix3::get_euler() now only works with proper rotation matrices. As a result, the code that wants to get the rotation portion of a transform needs to use Matrix3::get_rotation() introduced in this commit, which complements Matrix3::get_scaled(), providing both parts of the polar decomposition. Finally, it is now possible to construct a rotation matrix from Euler angles using the new constructor Matrix3::Matrix3(const Vector3 &p_euler).
2017-01-07Memory pool vectors (DVector) have been enormously simplified in code, and ↵Juan Linietsky
renamed to PoolVector
2017-01-03Use right handed coordinate system for rotation matrices and quaternions. ↵Ferenc Arn
Also fixes Euler angles (XYZ convention, which is used as default by Blender). Furthermore, functions which expect a rotation matrix will now give an error simply, rather than trying to orthonormalize such matrices. The documentation for such functions has be updated accordingly. This commit breaks code using 3D rotations, and is a part of the breaking changes in 2.1 -> 3.0 transition. The code affected within Godot code base is fixed in this commit.
2017-01-02ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to ↵Juan Linietsky
Variant. All usages of "type" to refer to classes were renamed to "class" ClassDB has been exposed to GDScript. OBJ_TYPE() macro is now GDCLASS()