var r = 80;
var a = 80;
var b = 80;

function angleToRadians(a){
    var radians = Math.PI * (a*-1 / 180);
    return radians;
}
function debug(m){
    jQuery('#msg').prepend('<p>'+m+'</p>');
}
function radiansToCartesian(rad){
    var c={};
    c.y = Math.round( b+(r * Math.cos(rad)) );
    c.x = Math.round( a+(r * Math.sin(rad)) );
    return c;
    
}
function draw(message,coords){
    var $obj = $('<div></div>')
        .css('position','absolute')
        .css('top',coords.y+'px')
        .css('left',coords.x+'px')
        .text(message)
        .appendTo('#canvas');
}
jQuery(function($){
    angles=[0,45,90,135,180,225,270,315];
    $.each(angles,function(index,angle){
        rad = angleToRadians(angle);
        coords = radiansToCartesian(rad);
        debug(angle+ '=>' +coords.x+','+coords.y);
        draw(angle,coords);
    });
    debug('done');
});