Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3331894
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:37:51+00:00 2026-05-17T23:37:51+00:00

I have an OpenGL program (written in Delphi) that lets user draw a polygon.

  • 0

I have an OpenGL program (written in Delphi) that lets user draw a polygon. I want to automatically revolve (lathe) it around an axis (say, Y asix) and get a 3D shape.

How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:37:52+00:00Added an answer on May 17, 2026 at 11:37 pm

    For simplicity, you could force at least one point to lie on the axis of rotation. You can do this easily by adding/subtracting the same value to all the x values, and the same value to all the y values, of the points in the polygon. It will retain the original shape.

    The rest isn’t really that hard. Pick an angle that is fairly small, say one or two degrees, and work out the coordinates of the polygon vertices as it spins around the axis. Then just join up the points with triangle fans and triangle strips.

    To rotate a point around an axis is just basic Pythagoras. At 0 degrees rotation you have the points at their 2-d coordinates with a value of 0 in the third dimension.

    Lets assume the points are in X and Y and we are rotating around Y. The original ‘X’ coordinate represents the hypotenuse. At 1 degree of rotation, we have:

    sin(1) = z/hypotenuse
    cos(1) = x/hypotenuse
    

    (assuming degree-based trig functions)

    To rotate a point (x, y) by angle T around the Y axis to produce a 3d point (x’, y’, z’):

    y' = y
    x' = x * cos(T)
    z' = x * sin(T)
    

    So for each point on the edge of your polygon you produce a circle of 360 points centered on the axis of rotation.

    Now make a 3d shape like so:

    1. create a GL ‘triangle fan’ by using your center point and the first array of rotated points
    2. for each successive array, create a triangle strip using the points in the array and the points in the previous array
    3. finish by creating another triangle fan centered on the center point and using the points in the last array

    One thing to note is that usually, the kinds of trig functions I’ve used measure angles in radians, and OpenGL uses degrees. To convert degrees to radians, the formula is:

    degrees = radians / pi * 180
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple OpenGL program in C++ that displays a line joining
Ok, so I want to run simple opengl program that I've written, on other
I have a simple OpenGL program and trying to draw an instanced array that
Exposition: I'm familiar with C/C++/Scheme & OpenGL. I have this client/server program written in
I have an OpenGL-program using GLSL, that I can run just fine with the
Suppose I have 5 GLSL shaders that I successfully loaded in my opengl program.
Let's say I have an OpenGL program that has a uniform attribute diffuseColor. I
I have written a simple program that does autocorrelation as follows...I've used pgi accelerator
I have a simple openGL D program that compiles, but I can't get it
I have a simple openGL D program that compiles, but I can't get it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.