Spinbetween (Prototype Tool)

I am working on a spinbetween tool where the spin starts as one shape and ends as another. I’m having some trouble pinning down a good interpolation algorithm. The best results are with “linear” and “square” interpolation but neither gives the results I’m looking for. I’ve added a tweak to the interpolation which has yielded better results but still not there.

Here are some pictures to clarify where I am on this…

Here you see the starting spline highlighted (green line is the axis of spin)
http://www.fourmadmen.com/blender/misc/hurm/spinbetween_s.jpg

Here you see the ending spline highlighted (green line is the axis of spin)
http://www.fourmadmen.com/blender/misc/hurm/spinbetween_e.jpg

And here is a matrix of results.
http://www.fourmadmen.com/blender/misc/hurm/spinbetween_r.jpg

#3 is the closest I’ve achieved but if the object was mirrored along the Y axis the result looks the the bow of a boat rather than having a smooth curve around.

#4 has the curve I’m looking for at the top left but the bottom right is no good.

Ideally some combination of (the bottom of) #3 and (the top of) #4 would work but I don’t really trust the tweak I added (basically the tweak is an adjustment using the ratio between the current step number and the number of steps).

So for anyone still reading this, the question is: do you know of an interpolation scheme that would yield smooth results so that the object can be mirrored along either axis and not have the pointed “ship bow” look?

Can’t you just use an ellipse arc?

Calculate the angle between the start and end spline and just rotate away, interpolating the radius between the start and the end values.

Here’s some crappy example code:


from math import *
start = 10
end = 5
start_angle = pi
end_angle = 1.5 * pi
for i in range(100):
     i_angle = start_angle + (i / 100.0) * (end_angle - start_angle)
     i_radius = start + (i / 100.0) * (end - start)
     print cos(i_angle) * i_radius, sin(i_angle) * i_radius

Hope that helps.

Martin

Thanks for the suggestion, but that code results in result mesh #1 above. Any other thoughts?

1 Like

You’re right, that was a linear interpolation, not an ellipse arc, how silly of me.

An ellipse arc would solve (X / RadiusA)^2 + (Y / RadiusB)^2 = 1 (for an ellipse aligned on the X and Y axis).

So either use that directly or solve for Y ( Y = (+/-) RadiusB * sqrt(1 - (X / RadiusA)^2 ).

That gives a perfect ellipse, so if you mirror, it’s all smooth.

Martin

Works beautifully sir, thank you! I ended up with a concentric circle method: x = a cos theta and y = b sin theta. Thank you for the input.

1 Like

Such as…

http://www.fourmadmen.com/blender/misc/spinbetween_test.jpg

Glad I could help. :slight_smile:

Martin