# Search the Community

Showing results for tags 'ellipse'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• General
• Announcements and Site News
• AutoIt v3
• AutoIt Help and Support
• AutoIt Technical Discussion
• AutoIt Example Scripts
• Scripting and Development
• Developer General Discussion
• Language Specific Discussion
• Operating System Deployment
• Windows Client
• Windows Server
• Office

### Categories

• AutoIt Team
• Beta
• MVP
• AutoIt
• Automation
• Databases and web connections
• Data compression
• Encryption and hash
• Games
• Hardware
• Information gathering
• Internet protocol suite
• Maths
• Media
• PDF
• Security
• Social Media and other Website API
• Windows
• Scripting and Development
• Operating System Deployment
• Windows Client
• Windows Server
• Office

• Forum FAQ
• AutoIt

### Calendars

• Community Calendar

• 0 Replies

• 0 Reviews

• 0 Views

Found 1 result

1. ## Ellipse drawing algorithm

Hi! I'm trying to script an ellipse drawing algorithm in AutoIT for learning purposes. I use an edit control to "draw" the ellipse with characters. The code i have works kinda good but i would like to see if others around here know a better algorithm to do it.. I would like to be able to give the x, y and width, height arguments to the function and not have to start at the middle point and draw the ellipse around it. side note, the ellipse glitches when it has to be 2 pixels high too.. func ellipsePlotPoints (\$xc,\$yc, \$x,\$y) pixel (\$xc + \$x, \$yc + \$y) pixel (\$xc - \$x, \$yc + \$y) pixel (\$xc + \$x, \$yc - \$y) pixel (\$xc - \$x, \$yc - \$y) endfunc func ellipse(\$xc,\$yc, \$a,\$b) local \$a2 = \$a * \$a local \$b2 = \$b * \$b local \$twoa2 = 2 * \$a2 local \$twob2 = 2 * \$b2 local \$p local \$x = 0 local \$y = \$b local \$px = 0 local \$py = \$twoa2 * \$y ; Plot the initial point in each quadrant. ellipsePlotPoints (\$xc,\$yc, \$x,\$y) ; Region 1 \$p = int(\$b2 - (\$a2 * \$b) + (0.25 * \$a2)) while (\$px < \$py) \$x+=1 \$px += \$twob2 if (\$p < 0) then \$p += \$b2 + \$px else \$y-=1 \$py -= \$twoa2 \$p += \$b2 + \$px - \$py endif ellipsePlotPoints (\$xc,\$yc, \$x,\$y) wend ; Region 2 \$p = int (\$b2 * (\$x+0.5) * (\$x+0.5) + \$a2 * (\$y-1) * (\$y-1) - \$a2 * \$b2) while (\$y > 0) \$y-=1 \$py -= \$twoa2 if (\$p > 0) then \$p += \$a2 - \$py else \$x+=1 \$px += \$twob2 \$p += \$a2 - \$py + \$px endif ellipsePlotPoints (\$xc,\$yc, \$x,\$y) wend endfunc
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...