#144 glutSolidTorus uses incorrect radii

closed-fixed
nobody
nuisance (37)
3
2013-04-05
2011-01-12
Chris Marshall
No

The first two args of glutSolidTorus() are the inner
radius and the outer radius. The standard definition
of the inner radius is the distance of the inner wall
of the "donut" from the center of the hole. Similarly
the outer radius is taken to be the distance from the
center of the hole to the outside edge of the "donut".
For these coordinates, the diameter of the torus
looking down the z-axis should be 2*outer radius.

This does not appear to be the implementation
used by freeglut. I don't have the original GLUT
here in order to check whether freeglut is consistent
with the original GLUT.

Discussion

  • Chris Marshall
    Chris Marshall
    2011-01-14

    Thanks to help from John Tsiombikas who was able to
    verify that the FreeGLUT and GLUT torus routines
    do generated the same size objects, I took a look at
    the code in the FreeGLUT sources. By comparing
    that with the parametric form for the surface of a
    torus:

    http://en.wikipedia.org/wiki/Torus

    It is clear that the parametrization there
    with:

    R is the distance from the center of the tube to the center of the torus,
    r is the radius of the tube.

    so it is clear that R corresponds to the "outer radius"
    of the torus and that r corresponds to the "inner radius"
    of the torus. The bug was one of comprehension and
    poor documentation. It would be helpful to add the
    above text describing what the two parameters are...

     
  • Chris Marshall
    Chris Marshall
    2011-01-14

    • labels: --> nuisance
    • priority: 5 --> 3
     
  • Chris Marshall
    Chris Marshall
    2011-01-14

    diagram of inner and outer radius params

     
    Attachments
    • status: open --> closed-fixed
     
  • Hi Chris,

    Thanks for what turned out to be a doc suggestion. I found i could not understand what was written either, so I have used your suggestion instead. r1595.

    Best,
    Dee