Implement lookup-table-based rectangle approximation.#161
Conversation
|
If I understand this correctly, all the aspect ratios you compute are subject to The existing algorithm finds ratios subject to You did not implement this as a fallback to the existing algorithm, so I wonder if this change drastically reduces the number of exact solutions found. Since this is for rendering, an exact solution is preferable over speed. We do not want 1-pixel-wide gaps to appear too often. We really only need a "good enough" fallback when an exact solution is not possible. |
@NicEastvillage I was not aware that accuracy was critical, sorry about that! However, with the latest value generation refactoring, I think it's incredibly unlikely that this approach fails to either find an exact solution, or one which rounds to the exact pixel count. However, this would need to be more thoroughly tested (I can't guarantee it for certain at this point). So if you prefer, I'll revert the |
Rectangle approximation using a precomputed lookup table has been implemented, for use in
MakeFakeRectangleString.Even though this method produces a string of lengthrows+cols-1, the ratio limit in table precomputation is based onrows*colsbecause this produces a better ratio value distribution for a given lookup table size.An additional accompanying unit test has also been implemented.
Edit: The value generation strategy has been significantly refactored.