Luigi Posted June 14, 2015 Share Posted June 14, 2015 (edited) Hi, this is for a math experts!If you have an array[64][64] empty (the size is hiphotetics..., can be any size)All position is initialy empty or zero.How to plot this circles in this array (center is a red dot).a] plot a full circle in arrayb] plot a half circle in arrayc] plot a inclinade half circleSomeone have any idea?#include <Array.au3> Global $iSize = 32 Global $aArray[$iSize][$iSize] Global $aCenter[2] = [Floor($iSize / 2), Floor($iSize / 2)] plot_circle($aCenter[0], $aCenter[1], $aCenter[0]) _ArrayDisplay($aArray) Func plot_circle($iXX, $iYY, $iRadius, $iMode = 0) Switch $iMode Case 0 ; full circle Case 1 ; half circle Case 2 ; inclinade half circle EndSwitch EndFunc ;==>plot_circleBr, Luigi Edited June 14, 2015 by Luigi Visit my repository Link to comment Share on other sites More sharing options...
UEZ Posted June 14, 2015 Share Posted June 14, 2015 (edited) Why on hell do you want to "draw" into an array?Anyhow, here we go:#include <Array.au3> Global Const $fPi = ACos(-1), $fD2R = $fPi / 180 Global $aGfxArray[21][21] DrawEllipseToArray($aGfxArray, 10) ;full ellipse _ArrayDisplay($aGfxArray, "full ellipse") Global $aGfxArray[21][21] DrawEllipseToArray($aGfxArray, 10, 90, 270) ;half ellipse _ArrayDisplay($aGfxArray, "half ellipse") Global $aGfxArray[21][21] DrawEllipseToArray($aGfxArray, 10, 90 - 45, 270 - 45) ;inclinade half ellipse _ArrayDisplay($aGfxArray, "inclinade half ellipse") Func DrawEllipseToArray(ByRef $aArray, $iRadius, $iStartAngle = 0, $iEndRadius = 359, $iColor = 0xFF00FF00, $iColor_Center = 0xFFFF0000) Local $d, $iW2 = Int(UBound($aArray, 2) / 2), $iH2 = Int(UBound($aArray, 1) / 2), $iX, $iY For $d = $iStartAngle To $iEndRadius $iX = Round($iW2 + Sin($d * $fD2R) * $iRadius, 0) $iY = Round($iH2 + Cos($d * $fD2R) * $iRadius, 0) $aArray[$iY][$iX] = $iColor Next $aArray[$iH2][$iW2] = $iColor_Center EndFunc Pay attention to the function DrawEllipseToArray - it has no error checks! Edited June 14, 2015 by UEZ Luigi 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Luigi Posted June 14, 2015 Author Share Posted June 14, 2015 Thank you UEZ! Its work! Visit my repository Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now