MAYA, TUTORIALS, ROLLING ELLIPSE ABOUT DEFINITIONS
THE ROLLING CIRCLE
What have we just done? When you move a circle on the ground, the length of the arc has to equal the length travelled in x-direction. So the rotation required to do this can be obtained as a function of the complete rotation of a circle (360°), the length travelled in x-direction and the perimeter of the circle. A final multiplication with -1 will ensure the circle rotates in the correct direction. Alternativly you can use this expression, which is a condensed form of the upper one, faster to execute but not very readable
Move the circle in x direction and see how the expression rotates your circle correctly. THE ROLLING ELLIPSE
We will start like we did with the circle and find an expression for the perimeter of the ellipse. Unfortunatly there is no simple formula for the circumference of an ellipse like the one we used for the circle (2*PI*r). In fact, obtaining the exact result is not an opportunity here as it would require us to deal with sums of infinitely many terms, elliptic integrals and the likes... everything not only very complicated and difficult to implement but also very computational expensive. Luckily there exist quite a lot of much simpler approximations for the perimeter of an ellipse, so we just use these. It's in the nature of approximation that it inherits a relative error, but we will choose formulas that will have a very small error so the effect won't be very visible. I will give you some approximation formulas, sorted by relative error (from big to small), choose one wich you works best for you (in many cases already the simplest one will give good results.
Now that we have got the perimeter, let's compute the angle of rotation required to fit the translation of the ellipse, just like we did with the circle (note that we are working in radians here, hence the 2*PI instead of 360°):
IMPORTANT: This is mathematically wrong! I made the assumption that the ellipse had everywhere the same curvature (like a circle), but this is not true. So this will only look correct if you do not have very elongated ellipses. I will update this tutorial when I have found a simple solution to this problem (the arc length and angle relationship is not linear!). Now that we have found the rotation, we still need to adjust the y-position of the ellipse's center.
Yes, that looks scary. I won't go into much detail about this term, but basically it epresses the y-component of the point of tangency for a specific angle, rotational transformed to fit the current coordinate system for the ellipse. Add the expression to your scene, move the ellipse in x-direction and watch it rolling on the floor. Enjoy :) DOWNLOAD REFERENCES |