Find Point On Circle in JavaScript

Description: Finds a given point on a circle provided the center of the circle, its radius and the angle. Great for projects such as pie charts or labeling circles.
Tested Platform: All Modern Browsers
Language: JavaScript
// Given the origin point of the circle, its radius and the angle in Radians (degrees * Math.PI / 180)
// it returns the a point object showing the x,y coordinates of the point on a circle.

function findPointOnCircle(originX, originY , radius, angleRadians) {
        var newX = radius * Math.cos(angleRadians) + originX
        var newY = radius * Math.sin(angleRadians) + originY

        return {"x" : newX, "y" : newY}
}

Submitted: April 07, 2013

Return to the snippets listing