Specifically, when rasterizing a triangle into a heightfield with width or height of 0. This can happen when the input geometry bounding box extents are less than half the cell size in either x or z. This is a degenerate case, but can crop up in real life scenarios (see https://github.com/godotengine/godot/issues/65764) so we should at least ensure it doesn't crash here.
* Fix incorrect rasterization at tile borders
Clip the polygon at the tile border and disregard coordinates outside of
the tile before clamping.
* Added unit test with minimal repro case for the rasterization issue fixed in PR #476
Co-authored-by: Graham Pentheny <graham.pentheny@gmail.com>
This implements most of the std::vector interface, with some minor elisions of
infrequently used methods such as "insert", and some STL bookkeeping.
Performance is favorable compared to std::vector, and, in some cases, somewhat
better than naive code to manually manage a malloc'd dynamic array.
BM_FlatArray_Push: 100 iterations in 72889721 nanos: 728897.21 nanos/it
BM_FlatArray_Fill: 100 iterations in 2700746 nanos: 27007.46 nanos/it
BM_FlatArray_Memset: 100 iterations in 2687810 nanos: 26878.10 nanos/it
BM_rcVector_Push: 100 iterations in 51114316 nanos: 511143.16 nanos/it
BM_rcVector_PushPreallocated: 100 iterations in 9532106 nanos: 95321.06 nanos/it
BM_rcVector_Assign: 100 iterations in 2371534 nanos: 23715.34 nanos/it
BM_rcVector_AssignIndices: 100 iterations in 2573052 nanos: 25730.52 nanos/it
BM_rcVector_Resize: 100 iterations in 2455761 nanos: 24557.61 nanos/it
BM_stdvector_Push: 100 iterations in 71739167 nanos: 717391.67 nanos/it
BM_stdvector_PushPreallocated: 100 iterations in 15723737 nanos: 157237.37 nanos/it
BM_stdvector_Assign: 100 iterations in 2564985 nanos: 25649.85 nanos/it
BM_stdvector_AssignIndices: 100 iterations in 5174923 nanos: 51749.23 nanos/it
BM_stdvector_Resize: 100 iterations in 2520054 nanos: 25200.54 nanos/it
These are by no means complete coverage of the functions they test, but are at least a start. For consistency, all floating point comparisons use Approx(), regardless of whether they need to or not.
Removed unnecessary C++11 unique_ptr stuff, now that rcHeightfield has a constructor and destructor.
* Tests live in a "Tests" folder alongside the other components. Inside the "Tests" folder, tests are split into folders by the component they test. For example, the example unit test of "rcVdot" (which is implmemented in Recast/Recast.h) lives in "Tests/Recast/Tests_Recast.h".
* Uses the Catch testing framework
* One example test of "rcVdot"
* Tests are run on Travis and Appveyor after every build. Failing unit tests will fail the build in both case.
* Added instructions on running unit tests to the readme