Freedom-of-Form-Foundation / anatomy3d

A CAD tool for humanoid anatomy alterations. See the anatomy3d-blender repository for more recent work.
https://freedomofform.org/1856/3d-anatomy-project-scope-phase-1-focus-on-a-limb-joint/
GNU General Public License v2.0
7 stars 5 forks source link

Fix issue #29 using the Newton-Raphson iterative method after approximating the solution #72

Closed Lathreas closed 2 years ago

Lathreas commented 2 years ago

To resolve numeric instability, we used lower-order approximations to get approximate solutions of the Solve() functions of polynomials. This works to resolve the numeric instability (shooting off to infinity), but introduces minor visual artifacts in the bone, causing it to look less smooth. This is, of course, due to us approximating the solutions with "wrong" equations, so that is to be expected. This PR resolves the visual artifacts by using this approximated solution as a starting point for the Newton-Raphson iterative numerical method to find the true root. Newton-Raphson is not guaranteed to give all roots, but when starting close to a root of a function, it will make the approximation arbitrarily accurate. Therefore, this combination of using perturbation methods and Newton-Raphson appears to fully resolve all visual artifacts related to numeric error or instability.

The method has no noticeable performance impact, but of course speed can later be optimized by using more clever methods. This method, however, is sufficient to get fully accurate results, which is of course essential for a good CAD tool.