# Find 4 corner points/divides of circle using math

**URL:** <https://forum.kirupa.com/t/find-4-corner-points-divides-of-circle-using-math/249261>\
**Category:** flash\
**Created:** [January 17, 2008, 12:21am UTC](https://forum.kirupa.com/t/find-4-corner-points-divides-of-circle-using-math/249261 "2008-01-17T00:21:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sargeonline](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sargeonline](https://forum.kirupa.com/u/sargeonline)\
**Post date:** [January 17, 2008, 12:21am UTC](https://forum.kirupa.com/t/find-4-corner-points-divides-of-circle-using-math/249261/1 "2008-01-17T00:21:54Z")

</div>

Hey

I have this little file I’m working on at the moment where a ball is rotating around an oval shape. This works and is looking good. What I want to do now is to create 3 more instances of the ball sprite and I’ve created and position them in the other 3 corners of the oval.

So it looks sort of like this to start off with:

----o  
o ----- o  
----o

(ignore the dashes, I just put them in there to I could illustrate the ‘4 corners’)

I want all the balls to follow the same path and same speed etc. I’m assuming that there is some simple math formula I need to know but it’s sort of going over my head at the moment.

Here’s the code I’m working on:

```auto
 package {
    
    import flash.display.Sprite;
    import flash.events.Event;
    
    public class Oval extends Sprite {
        
        private var ball:Ball;
        private var ball2:Ball;
        
        private var angle:Number = 0;
        private var centerX:Number = 200;
        private var centerY:Number = 200;
        private var radiusX:Number = 200;
        private var radiusY:Number = 100;
        private var speed:Number = .1;
        
        public function Oval() {
            init();
        }
        
        private function init():void {
            ball = new Ball();
            addChild(ball);
            ball.x = 0;
            
            
            
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
            
        }
        
        public function onEnterFrame(event:Event):void {
            ball.x = centerX + Math.sin(angle) * radiusX;
            ball.y = centerY + Math.cos(angle) * radiusY;
            
            angle += speed;
            
            
        }
        
    }
}

```

I’ve included the files I’ve been working on so you can see.

Any help would be greatly appreciated.

Cheers!
