DEFINITIONS
![]() | I guess you know what an ellipse is, so you are already familiar with the fact, that you need two radii to construct one: I will call them rA and rB here.
|
THE ROLLING CIRCLE
Before we'll roll an ellipse, let's see how to roll a circle as we can apply the insights gained from this on the ellipse proplem.
![]() | Create a nurbsCircle (radius = 1.0; axis = z;), rename it to "circle", switch to othographic front view, move the center of the circle to [0,1]. Note: Instead of a nurbsCircle you can also create a nurbsCylinder, so you'll be able to watch the movement of the object in perspective view more clearly. |
$pi = 3.141592; // radius of circle // get translation in x direction // perimeter of circle // apply rotation to 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
$rA = 1.0; |
Move the circle in x direction and see how the expression rotates your circle correctly.
THE ROLLING ELLIPSE
![]() | Now on to 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.
$pi = 3.141592; $rA = 2.0; // compute perimeter // Kepler // Euler // unknown // Ramanujan I // Ramanujan II |
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¡ã):
$x = ellipse.translateX; |
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.
$y = abs((-sin($rot)*tan($rot)*$rA*$rA)-(cos($rot)*$rB*$rB))/ ellipse.translateY = $y; |
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
example scene and expression > rollEllipse1_1.zip (located at highend3d.com)
discuss this topic to forum



