Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Parametric equations and Cartesian coordinates

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2009
    Location
    UK
    Posts
    24

    Parametric equations and Cartesian coordinates

    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...

  2. #2
    Intern Contributor
    Join Date
    Jul 2004
    Location
    Toronto
    Posts
    97

    Re: Parametric equations and Cartesian coordinates

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •