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

FlexSpline #59

Closed AdamNorberg closed 2 years ago

AdamNorberg commented 2 years ago

FlexSpline is a CubicSpline1D with moving points, for configuration in the UI. It is partially threadsafe: it can be accessed in parallel and written in parallel, but it is likely to get very confused if written while it is being accessed, so don't do that. It's threadsafe for reading because we probably want to parallelize GenerateMesh and threadsafe for writing as a side effect of making it threadsafe for reading.

It's farming its actual work out to CubicSpline1D, which it regenerates whenever data is requested and a point has moved. In case of multiple consecutive updates, it doesn't recalculate its spline until the first data request. (Recalculating on every move might be inefficient, and makes FlexSpline subtly unsafe for concurrent writes.)

This pull request is a draft until it has proper documentation and unit tests.

Lathreas commented 2 years ago

From a quick look, and based on our discussions, this looks quite good already! I'll do a more thorough review once I have the time.

I've been thinking about the naming scheme for a bit, and had some ideas. Of course FlexSpline is fine already, but considering your intended architecture (using FlexSpline as a mutable wrapper around an immutable CubicSpline1D), would it make sense to call FlexSpline something among the lines of "MutableSpline"? Let me know what you think!

zennithn commented 2 years ago

Is FlexSpline still alive as a concept, or is it superceded by MutableCurve? Asking just for clarity. Thanks!

AdamNorberg commented 2 years ago

This has been replaced with the generic MutableCurve approach. I'll close this PR and delete my branch when the other branch goes in. (I don't prune branches/PRs for being superseded until the thing that supersedes them is actually checked in, though- I've learned never to be so sure which code is actually going in until it does.)

AdamNorberg commented 2 years ago

Superseded by MutablePiecewiseCurve.