Trigonometry is a wonderfull instrument that gives you the possibility to create fantastic effects with a wide variety of available methods. In this post I will show you an method of drawing circles and, beeing more explicitly, finding coordinates of a circle’s  curve and using it for our graphic art purposes. This method is using the basic trig formulas I described in previous post.

The sine of an angle is the ratio of the angle’s opposite leg to the hypotenuse.
Cosine is defined as the ratio of the adjacent leg of an angle to the hypotenuse.


We will find the coordinates of the circumference points on basis of the radius and angle, radius is constant, and the angle is increasing steady from 0 to 360 and further, like is shown in this diagramm:

circlesformulas_2











package {
import flash.display.*
import flash.events.Event
import flash.filters.BlurFilter
import flash.geom.Point

public class DrawingCircles extends Sprite {
private var ball:Sprite, angle:Number = 0
private var centerX:Number = 300, centerY:Number = 200, radius:Number = 180
private var speed:Number = .2, previousPosX:Number, previousPosY:Number
private var bmpData:BitmapData= new BitmapData(550, 400, true, 0x00000000)
private var bmp:Bitmap=new Bitmap(bmpData)
private var bmpData_2:BitmapData= new BitmapData(550, 400, true, 0x00000000)
private var bmp_2:Bitmap=new Bitmap(bmpData_2)
private var bf:BlurFilter = new BlurFilter(1.2, 1.2)
public function DrawingCircles()    {
     init()  };
private function init():void {
     ball = new Sprite()
     ball.graphics.beginFill(0xffffff)
     ball.graphics.drawCircle(-1, -1, 2)
     ball.graphics.endFill()
     addChild(ball); addChild(bmp_2); addChild(bmp
     ball.x = centerX + Math.sin(angle) * radius
     ball.y = centerY + Math.cos(angle) * radius
     graphics.moveTo(ball.x, ball.y)
     addEventListener(Event.ENTER_FRAME, EntFrame)  };
public function EntFrame(event:Event):void {
     graphics.lineStyle(2,Math.random()*0xFFFFFF)
     ball.x = centerX + Math.sin(angle) * radius
     ball.y = centerY + Math.cos(angle) * radius
     graphics.lineTo(ball.x, ball.y)
     previousPosX=ball.x; previousPosY=ball.y
     angle += speed
     bmpData.draw(this)
     bmpData_2.applyFilter(bmpData, bmpData_2.rect, new Point(0, 0), bf)
     graphics.clear()
     bmp_2.alpha=.2};
}  }

There are also many other methods to draw circles in trigonometry. This methods are instruments you should use creating visual applications.  The source as. file