Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python library **splines** #1

Open
stla opened this issue Oct 24, 2021 · 7 comments
Open

Python library **splines** #1

stla opened this issue Oct 24, 2021 · 7 comments

Comments

@stla
Copy link

stla commented Oct 24, 2021

Hello,

Thank you for this repo, it is nice. It seems to me you never mention the splines Python library. It provides several types of quaternions interpolation. In particular, there is a "constant speed adapter" of splines. I realized this animation with it:

WavyCylinderRotatingAtConstantSpeed

@mgeier
Copy link
Owner

mgeier commented Oct 26, 2021

I'm not sure if you are aware of that, but I'm also the author of the splines module.

In fact, this quaternion-nursery is a collection of notes and experiments that I have used as preparation for creating the "rotation" section of the splines project.

But you are right, I should probably mention that in the README ...

BTW, I'm glad you like the "constant speed adapter"!

@mgeier
Copy link
Owner

mgeier commented Oct 26, 2021

I've just updated the README, I hope the situation is now clearer.

@stla
Copy link
Author

stla commented Oct 27, 2021

Ah that's you lol. OK.
Here is a Hopf Torus filmed by a camera following a spherical curve at constant speed. I implemented this in R but this is slow.

HopfConstantSpeed

@mgeier
Copy link
Owner

mgeier commented Nov 15, 2021

I implemented this in R but this is slow.

What is slow? Evaluating the spline or the whole 3D rendering?

@stla
Copy link
Author

stla commented Nov 15, 2021

Evaluating the spline, with the root finder and the integral.

@mgeier
Copy link
Owner

mgeier commented Nov 16, 2021

I'm not sure which spline type you are using, but if you are using BarryGoldman (as shown in https://splines.readthedocs.io/en/latest/rotation/barry-goldman.html#Constant-Angular-Speed), this is known to be very slow. You should use DeCasteljau instead, which gives very similar results and is much faster for calculating constant angular speed.

If you are already using DeCasteljau there are certainly still options for optimization. The splines library is very much not optimized at all. Both the root finding and the integration can certainly be optimized. I just took the first functions that I found in SciPy which did what I wanted. I'm sure there are more optimized algorithms available.

@stla
Copy link
Author

stla commented Dec 14, 2021

I'm using Kochanek-Bartels because it has some parameters. I made a JavaScript application these days: HopfApplication which uses this algorithm (that I reimplemented in JS).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants