# Circle Generator Mathematical Problem

Comments in 'Plugin Development' started by PEMapModder, Dec 31, 2013.

1. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,294
Plugins:
11
Minecraft User:
``` public function generateFullCircle(Vector3 \$centre,Level \$level,\$r,\$blockid,\$blockDmg=0,\$arcA=0,\$arcB=360){//angles in degrees, vectors in blocks        \$x=\$centre->x;        \$y=\$centre->y;        \$z=\$centre->z;//abbr for the centre coords        \$block=BlockAPI::get(\$blockid);//get the Block object for \$blockid        \$arcAccu=1;        \$rAccu=1;        #\$result=array();        for(\$d=\$arcA;\$d<\$arcB;\$d=\$d+\$arcAccu){//changes the direction in the arc bit by bit; what is the optimal ArcAccuracy \$arcAccu?            \$t=\$d/180*M_PI;            for(\$rL=0;\$rL<=\$r;\$r+\$rAccu){//changes the length of the angle bit by bit to generate a solid circle; what is the optimal RadiusLengthAccuracy \$rAccu?                \$tX=sin(\$t)*\$rL+\$x;                \$tZ=cos(\$t)*\$rL+\$z;                #result[]=                    \$level->setBlockRaw(new Vector3(\$tX,\$y,\$tZ),\$block);            }        }        #return \$result;    } ```