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 6366939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:29:09+00:00 2026-05-25T00:29:09+00:00

I have been trying to figure out how to write a simple program to

  • 0

I have been trying to figure out how to write a simple program to compute the x,y points for creating a regular polygon of n sides. Can someone give me some code examples that don’t use preexisting functions that draw polygons? I want to understand the process, which I assume is something like this:

  1. pick an angle to start from a radius and a center point
  2. somehow calculate the x,y position at that distance from the center(how?)
  3. divide 360 by the number of sides, move that distance and draw the next line from the first x,y point
  4. continue until the angle=360 divided by that number.

Assuming that my assumptions are correct, the main thing is to understand how to compute the x,y points.

Prefer answers in a visual basic (or even old style Microsoft/Atari/Commodore BASIC) or a human readable set of steps in English. If you have to answer with a math formula, do it in a computer language so I can read it, even in C or C++ I can figure it out, but I don’t know how to read mathematical notation. The language I’m using is a Visual Basic-like language that has almost no graphics primitives other than line drawing.

  • 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-25T00:29:11+00:00Added an answer on May 25, 2026 at 12:29 am

    Let’s assume you want to draw an N-sided polygon of radius r, centred at (0,0). Then the n vertices are given by:

    x[n] = r * cos(2*pi*n/N)
    y[n] = r * sin(2*pi*n/N)
    

    where 0 <= n < N. Note that cos and sin here are working in radians, not degrees (this is pretty common in most programming languages).

    If you want a different centre, then just add the coordinates of the centre point to each (x[n], y[n]). If you want a different orientation, you just need to add a constant angle. So the general form is:

    x[n] = r * cos(2*pi*n/N + theta) + x_centre
    y[n] = r * sin(2*pi*n/N + theta) + y_centre
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been pulling my hair out trying to figure out what I can't
I have been trying to figure out a solution but nothing has really presented
I have been trying to figure out a way to tag several methods from
I am fairly new to Emacs and I have been trying to figure out
I have been trying to figure this out for way to long tonight. I
I have been going mad trying to figure out why my scripts weren't working,
I have been pounding my head against a wall trying to figure out what
Here's a fun one I've been trying to figure out. I have the following
I have been trying this for some time but could not figure out yet.
I have been spending the last hours trying to figure this out and now

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.