
app.namespace("appLib");
app.w(CanvasRenderingContext2D, function(){ 

    
    this.ex = {};
        
    this.ex.drawLine = function(p1, p2){
                            this.beginPath();
                            this.lineTo(p1.x, p1.y);
                            this.lineTo(p2.x, p2.y);                        
                            this.closePath();
                            this.stroke();
                    };
    
    
    
    this.ex.rayGen = function(Radius, angle, x, y){
                        var radian = angle * Math.PI/180;
                        var lx = Radius * (Math.cos(radian)) + x;
                        var ly = Radius * (Math.sin(radian)) + y;
                        return [lx, ly];
                };

    //Given points p1, p2 - draw a line                
    this.line = function(p1, p2){
            
                    this.beginPath();
                        this.moveTo(p2.x, p2.y);                        
                        this.lineTo(p1.x, p1.y);                    
                        this.closePath();
                    this.stroke();
                };
    
    this.ex.circle = function(x, y, radius) { return this.arc(x, y, radius, 0, Math.PI* 2, true); };

});


