I wrote this project in response to a question on the Microsoft Silverlight forum
which asked *How can I draw a 3D rotating object that a curve := y=f(x) rotates around z-axis by 360 degrees?*.

Since I already had some 3D code from the Silverlight 3D Dice Simulator I wrote, I set about answering this question. I extracted the 3D calculation parts of the dice simulator into a separate project so I could reuse it for this.

The remaining code needed was to calculate the radius of the curve at regular intervals along the x-axis, use a bit of trigonometry to rotate this around the x-axis, and generate polygons joining the points together.

I think the effect is quite pleasing, although it would be even nicer if it could calculate the vertices more quickly to give a smoother curve effect. If you don't mind the animation being slower, go to the Settings class of the source code and increase the XSteps and ThetaSteps values.

Download Formula 3D Source Code

## Leave a comment