Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. How to draw a star-shaped polygon?

How to draw a star-shaped polygon?

Scheduled Pinned Locked Moved IT & Infrastructure
algorithmstutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    john_tran
    wrote on last edited by
    #1

    i need the algorithm to draw a star-shaped polygon (and star-shaped regular polygon). I use Bresenham and DDA to draw a line. In addition : How to draw a line with a negative co-ordinate (such as draw a line from (-5,10) to (20,-6)) Thanks Ask More - Learn More JohnJone

    A 1 Reply Last reply
    0
    • J john_tran

      i need the algorithm to draw a star-shaped polygon (and star-shaped regular polygon). I use Bresenham and DDA to draw a line. In addition : How to draw a line with a negative co-ordinate (such as draw a line from (-5,10) to (20,-6)) Thanks Ask More - Learn More JohnJone

      A Offline
      A Offline
      Alex Korchemniy
      wrote on last edited by
      #2

      Well, here is an approach that you can take. The first thing you do is start with a Point array. Decide on the number of points the star is going to have. The number of points the star has determines the angle between the points. Using trigonometry (sin and cos) calculate the position of the point. Alternate between near and far points. Continue calculate until your are done with the whole star. Once you have the list of points you can draw or fill. This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy

      J 1 Reply Last reply
      0
      • A Alex Korchemniy

        Well, here is an approach that you can take. The first thing you do is start with a Point array. Decide on the number of points the star is going to have. The number of points the star has determines the angle between the points. Using trigonometry (sin and cos) calculate the position of the point. Alternate between near and far points. Continue calculate until your are done with the whole star. Once you have the list of points you can draw or fill. This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy

        J Offline
        J Offline
        john_tran
        wrote on last edited by
        #3

        There is not any other method? Because this way will be very long and, seem like it very manually. Ask More - Learn More JohnJone

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups