1. 08 5月, 2021 1 次提交
  2. 05 5月, 2021 1 次提交
    • T
      Improve precision for sinDeg(180f) (#6517) · 388590e2
      Tommy Ettinger 提交于
      * Improve MathUtils.asin(), acos()
      
      The average and largest error are significantly better for this version (2-3 orders of magnitude), and it can be slightly faster.
      
      * Fix missing check for INDEX_ZERO in IntIntMap, IntFloatMap.
      
      This fixes #6347 . Thanks @tomcashman , for making this an easy fix!
      
      * Mark key/value/entry/iterator fields as transient.
      
      This stops a bad StackOverflowException from happening when some Map or Set types are iterated over and then written with Json. That happens in all stable versions I've tried between 1.9.6 and 1.9.13, on at least IntIntMap but probably also IntFloatMap and ObjectLongMap.
      
      A better alternative would be to add special-case Json handling like IntMap, ObjectIntMap, and LongMap have for the other primitive-backed maps, since that would make the output much cleaner, smaller, and more readable. At one point, the special-case handling I wrote was in my PR that introduced these updated data structrures, but adding that was overruled, and the serialization code was removed without `transient` being added in its place to fields that cause problems during "vanilla" serialization.
      
      * Fix getIndices() crash in Mesh, credit to Agueliethun
      
      This was probably a copy/paste error, but the getIndices() code mistakenly changed the vertices buffer where it formerly changed only the indices buffer. This caused crashes in ModelCacheTest when the Cache checkbox was selected and any model was added.
      
      * First, the test that shows an issue...
      
      Thanks to Discord user vladimir for finding a remaining part of an issue with IntMap and LongMap, this time in the iterator() of their Values (maybe also Keys) when using remove() . Here, the sizes aren't as expected after over 9K items have been placed (actualSize is 9282 when the problem happens, but the correct value is 9283).
      
      * In IntMap/LongMap, null out zeroValue when it is removed.
      
      This seems to be relevant to the return value when you `put(0, something)` after that 0-key has already been put and removed. I think this fixes vladimir's bug with the Values iterator().
      
      * Improve precision for MathUtils.sinDeg(180f)
      
      This particular right angle was given special treatment by MathUtils, but was still wrong, yielding -8.742278E-8 instead of 0. I think the updated code is actually less complex, because it doesn't risk a difference between the double-precision radians that Math.sin() expects and the single-precision radians MathUtils can provide it. I also added tests for sinDeg() and cosDeg(), which would have failed before because of the extremely low tolerance they use.
      
      * Shorten comment.
      
      * MathUtilsTest checks for exact trig values.
      388590e2
  3. 03 5月, 2021 3 次提交
  4. 28 4月, 2021 1 次提交
  5. 27 4月, 2021 1 次提交
  6. 25 4月, 2021 1 次提交
  7. 22 4月, 2021 8 次提交
  8. 21 4月, 2021 2 次提交
  9. 19 4月, 2021 6 次提交
  10. 16 4月, 2021 1 次提交
  11. 15 4月, 2021 2 次提交
  12. 12 4月, 2021 2 次提交
  13. 06 4月, 2021 3 次提交
  14. 05 4月, 2021 1 次提交
  15. 03 4月, 2021 2 次提交
    • M
      6bccae1f
    • T
      Fix for iterator() of IntMap.Values and LongMap.Values, plus a test. (#6475) · b0303cae
      Tommy Ettinger 提交于
      * Improve MathUtils.asin(), acos()
      
      The average and largest error are significantly better for this version (2-3 orders of magnitude), and it can be slightly faster.
      
      * Fix missing check for INDEX_ZERO in IntIntMap, IntFloatMap.
      
      This fixes #6347 . Thanks @tomcashman , for making this an easy fix!
      
      * Mark key/value/entry/iterator fields as transient.
      
      This stops a bad StackOverflowException from happening when some Map or Set types are iterated over and then written with Json. That happens in all stable versions I've tried between 1.9.6 and 1.9.13, on at least IntIntMap but probably also IntFloatMap and ObjectLongMap.
      
      A better alternative would be to add special-case Json handling like IntMap, ObjectIntMap, and LongMap have for the other primitive-backed maps, since that would make the output much cleaner, smaller, and more readable. At one point, the special-case handling I wrote was in my PR that introduced these updated data structrures, but adding that was overruled, and the serialization code was removed without `transient` being added in its place to fields that cause problems during "vanilla" serialization.
      
      * Fix getIndices() crash in Mesh, credit to Agueliethun
      
      This was probably a copy/paste error, but the getIndices() code mistakenly changed the vertices buffer where it formerly changed only the indices buffer. This caused crashes in ModelCacheTest when the Cache checkbox was selected and any model was added.
      
      * First, the test that shows an issue...
      
      Thanks to Discord user vladimir for finding a remaining part of an issue with IntMap and LongMap, this time in the iterator() of their Values (maybe also Keys) when using remove() . Here, the sizes aren't as expected after over 9K items have been placed (actualSize is 9282 when the problem happens, but the correct value is 9283).
      
      * In IntMap/LongMap, null out zeroValue when it is removed.
      
      This seems to be relevant to the return value when you `put(0, something)` after that 0-key has already been put and removed. I think this fixes vladimir's bug with the Values iterator().
      b0303cae
  16. 30 3月, 2021 2 次提交
  17. 29 3月, 2021 1 次提交
  18. 25 3月, 2021 1 次提交
  19. 19 3月, 2021 1 次提交