PDA

View Full Version : Parametric equations and Cartesian coordinates



Capagris
03-27-2009, 05:45 AM
I would like to draw figures in 2D...

for example, the parametric equations of a circle...

x=r* cos t
y=r *sin t

you can obtain the Cartesian coordinates which can be given by
x^2+y^2 < r^2

and then for each (x,y) coordinates which obey the last formula you draw a circle in a plain.

With the cone I know...

The circular base has z=0,x2+y2<r2. The curved surface has x2+y2=(r-(rz/h))2, for z in the range [0, h].

x = ((h-u)/h) * r * cos theta
y = ((h-u)/h) * r * sin theta
z = u
where u (0,h) y theta (0,2pi)

The question how can I obtain a formula/s in Cartesian coordinates that allows me to draw it?

It is a good challenge...

Budric
03-30-2009, 11:08 AM
I don't think you fully understand how to draw a circle. When you have it in parametric form
x=r* cos t
y=r *sin t
You simply iterate t from 0 to 2pi and draw the x,y coordinates that you get for each t. You would not convert it to an implicit form (in terms of x,y and r) because it's actually worse. What numbers are you iterating in the implicit form? Both x,y? That's terrible. Of course if you really want to have an efficient circle drawing this is the usual method:
http://en.wikipedia.org/wiki/Midpoint_circle_algorithm

When it comes to cone, I don't know what you're trying to draw in 2D. The only thing you can draw in 2D is a conic section (plane/cone intersection). Once you have the intersection you can write it in parametric form, iterate over t and draw the x,y points.