summaryrefslogtreecommitdiffstats
path: root/core/math/geometry.h
Commit message (Collapse)AuthorAgeFilesLines
* Split `Geometry` singleton into `Geometry2D` and `Geometry3D`Andrii Doroshenko (Xrayez)2020-05-271-1310/+0
| | | | Extra `_2d` suffixes are removed from 2D methods accoringly.
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-101/+180
| | | | | 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-43/+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.
* Modernize remaining uses of 0/NULL instead of nullptr (C++11)Rémi Verschelde2020-05-141-4/+4
| | | | | Using clang-tidy's `modernize-use-nullptr`. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
* thirdparty: Cleanup after #38386, document provenance and copyrightRémi Verschelde2020-05-111-2/+1
| | | | Also renamed `delaunay.h` to `delaunay_2d.h` to match the class name.
* New lightmapperJuan Linietsky2020-05-101-0/+243
| | | | | | | -Added LocalVector (needed it) -Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too) -Fixes and changes all around the place -Added library for 128 bits fixed point (required for Delaunay3D)
* Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-8/+16
| | | | | | | Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
* Fixed false positives in the culling system.Kiri Jolly2020-04-291-0/+2
| | | | | | | | This fixes numerous false positives coming out of the culling system. AABB checks are now a full separating-axis check against the frustum, with the points of the frustum being compared to the planes of the box just as the points of the box were being compared to the planes of the frustum. This fixes large objects behind the camera not being culled correctly. Some systems that used frustums that were (sometimes mistakenly?) unbounded on one or more side have been modified to be fully enclosed.
* [Core] Rename linear_interpolate to lerpAaron Franke2020-04-291-2/+2
|
* Replace NULL with nullptrlupoDharkael2020-04-021-2/+2
|
* Style: Harmonize header guards to style guide [Core]Rémi Verschelde2020-03-251-1/+1
|
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-171-13/+13
| | | | | | | | | | For us, it practically only changes the fact that `A<A<int>>` is now used instead of the C++03 compatible `A<A<int> >`. Note: clang-format 10+ changed the `Standard` arguments to fully specified `c++11`, `c++14`, etc. versions, but we can't use `c++17` now if we want to preserve compatibility with clang-format 8 and 9. `Cpp11` is still supported as deprecated alias for `Latest`.
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-8/+8
| | | | | Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
* 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.
* Drop b2d_convexdecomp. no longer necessary.Rémi Verschelde2019-12-131-9/+0
| | | | | | | We now use `thirdparty/misc/triangulator.h` for all physics-related (collision, navigation) triangulation needs. Follow-up to #34293.
* Remove redundant transform method in Geometry singletonAndrii Doroshenko (Xrayez)2019-09-011-10/+0
| | | | | Transform2D's xform method can be used instead which handles `PoolVector2Array` now (as well as 3D version).
* Add 'is_point_in_circle()' to Geometry class, and general file cleanupMichael Alexsander Silva Dias2019-08-271-106/+101
|
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'Braden Bodily2019-08-171-2/+1
| | | | | | | | | Condensed some if and ERR statements. Added dots to end of error messages Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?), core/os/memory.cpp, drivers/png/png_driver_common.cpp, drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
* Remove redundant author doc commentsIAmActuallyCthulhu2019-08-121-4/+0
|
* Optimize get_closest_point_to_segment*.Simon Puchert2019-07-061-18/+14
| | | | | | By combining all scalar factors we can get rid of a scalar * vector multiplication and a square root operation, since the resulting formula only uses the squared length.
* Expose 2D Delaunay triangulation in Geometry singletonAndrii Doroshenko (Xrayez)2019-05-241-0/+14
| | | | | | | Can be used via scripting as `Geometry.triangulate_delaunay_2d(points)` The interface is the same as in `Triangulate` library, returning indices into triangulated points.
* Expose 2D polygon boolean operations in Geometry singletonAndrii Doroshenko (Xrayez)2019-05-221-1/+76
| | | | | | | | | | | | | | | | | | | | | | | | | Clipper 6.4.2 is used internally to perform polypaths clipping, as well as inflating/deflating polypaths. The following methods were added: ``` Geometry.merge_polygons_2d(poly_a, poly_b) # union Geometry.clip_polygons_2d(poly_a, poly_b) # difference Geometry.intersect_polygons_2d(poly_a, poly_b) # intersection Geometry.exclude_polygons_2d(poly_a, poly_b) # xor Geometry.clip_polyline_with_polygon_2d(poly_a, poly_b) Geometry.intersect_polyline_with_polygon_2d(poly_a, poly_b) Geometry.offset_polygon_2d(polygon, delta) # inflate/deflate Geometry.offset_polyline_2d(polyline, delta) # returns polygons // This one helps to implement CSG-like behaviour: Geometry.transform_points_2d(points, transform) ``` All the methods return an array of polygons/polylines. The resulting polygons could possibly be holes which could be checked with `Geometry.is_polygon_clockwise()` which was exposed to scripting as well.
* Fix typos with codespellRémi Verschelde2019-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using codespell 1.15.0. Method: ``` $ cat > ../godot-word-whitelist.txt << EOF ang curvelinear doubleclick leapyear lod merchantibility nd numer ois ony que seeked synching te uint unselect webp EOF $ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po" $ git diff // undo unwanted changes ```
* Use approximate equallity methods in many placesAaron Franke2019-04-251-5/+5
|
* Fixes Geometry.segment_intersects_circle working only one way.Christoph Schroeder2019-03-061-2/+4
|
* TileSet/TileMap: Decompose solid non-convex polygons into convexes. Real fix ↵Mariano Suligoy2019-03-041-0/+2
| | | | for #24003
* Core: Ensure classes match their header filenameRémi Verschelde2019-02-121-1/+1
| | | | | | | | | | | | | | | Also drop some unused files. Renamed: - `core/dvector.h` -> `pool_vector.h` - `core/io/resource_import.h` -> `resource_importer.h` - `core/sort.h` -> `sort_array.h` - `core/string_db.h` -> `string_name.h` Dropped: - `core/allocators.h` - `core/os/shell.h` - `core/variant_construct_string.cpp`
* Removed splits in Polygon editor, replace by internal vertices and polygon ↵Juan Linietsky2019-01-081-1/+31
| | | | support.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Ensure that array passed to physics is always counter clockwise, fixes #15361.Juan Linietsky2018-11-141-0/+15
|
* Make core/ includes absolute, remove subfolders from include pathRémi Verschelde2018-09-121-8/+9
| | | | | | This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
* [Core] Completely kill math_2d.h, change includesAaron Franke2018-08-111-1/+1
|
* Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam2018-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
* Merge pull request #15943 from poke1024/geometry-line-lineJuan Linietsky2018-05-071-0/+15
|\ | | | | Add Geometry::line_intersects_line_2d()
| * Add Geometry::line_intersects_line_2d()Bernhard Liebl2018-01-211-0/+15
| |
* | Fix is_point_in_triangleChaosus2018-02-081-7/+6
|/
* Add missing copyright headers and fix formattingRémi Verschelde2018-01-051-0/+1
| | | | | | Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
* Merge pull request #15093 from poke1024/canvas-editor-selectRémi Verschelde2018-01-031-0/+3
|\ | | | | More exact picking for canvas editor
| * More exact picking for canvas editorBernhard Liebl2017-12-271-0/+3
| |
* | Update copyright statements to 2018Rémi Verschelde2018-01-011-2/+2
|/ | | | Happy new year to the wonderful Godot community!
* Dead code tells no talesRémi Verschelde2017-08-271-28/+1
|
* Use HTTPS URL for Godot's website in the headersRémi Verschelde2017-08-271-1/+1
|
* Particle system is complete. Rejoice!Juan Linietsky2017-04-081-10/+11
|
* Add "Godot Engine contributors" copyright lineRémi Verschelde2017-04-081-0/+1
|
* Fix typos in source code using codespellRémi Verschelde2017-03-241-1/+1
| | | | From https://github.com/lucasdemarchi/codespell
* A Whole New World (clang-format edition)Rémi Verschelde2017-03-051-398/+360
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Many fixes to make exported scenes work better, still buggy.Juan Linietsky2017-02-151-0/+28
|
* Overloaded basic math funcs (double and float variants). Use real_t rather ↵Ferenc Arn2017-01-161-60/+60
| | | | | | than float or double in generic functions (core/math) whenever possible. Also inlined some more math functions.
* Style: Fix statements ending with ';;'Rémi Verschelde2017-01-161-1/+1
|
* Style: Fix whole-line commented codeRémi Verschelde2017-01-141-2/+0
| | | | | 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.