﻿ var Point = ITA.Geometry.Point;
     
    
    
     function Blades(x, y, scale)
     {
       var blades = [ new Blade(), new Blade(), new Blade(), new Blade() ]; 
       
       this.center = new Point(x, y); 
       
       this.Draw = function(context, angle)
       {
         blades[0].Draw(context, this.center, scale, ITA.Geometry.wrapAngle(angle, 0) );
         blades[1].Draw(context, this.center, scale, ITA.Geometry.wrapAngle(angle, ITA.Geometry.PI / 2) );
         blades[2].Draw(context, this.center, scale, ITA.Geometry.wrapAngle(angle, ITA.Geometry.PI) );
         blades[3].Draw(context, this.center, scale, ITA.Geometry.wrapAngle(angle, ITA.Geometry.PI * 1.5) );
       }
       
              
       function Blade()
       {
         var blade = this;
         var Point = ITA.Geometry.Point;
         
         var points = [ new Point(0,0) ,     
                        new Point(100, 0) ,
                        new Point(100, 250) , //new Point(75, 0), new Point(25, 250), new Point(0, 0), new Point(100, 250),
                        new Point(0, 250),    
                        new Point(50, 250),
                        new Point(0, 0),
                        
                        
                        new Point(100, 50), 
                        new Point(10, 75),
                        new Point(100, 100),
                        new Point(18, 125),
                        new Point(100, 150),  
                        new Point(30, 190),
                        new Point(100, 225)                             
                      ];
                      
         this.Draw = function(ctx, center, scale, angle)
         {
                       
            ctx.beginPath();
            ctx.lineWidth = 1.5;
            ctx.lineCap = "round";
            ctx.lineJoin = "round";
            ctx.strokeStyle = "rgba(25,25,25, 0.6)";
            
            ctx.shadowOffsetX = 4;
            ctx.shadowOffsetY = 4;
            ctx.shadowBlur = 4;
            ctx.shadowColor = "rgba(0, 0, 0, 0.75)";
            
            ctx.moveTo(center.getX(), center.getY());
              
            for(var i in points)
            {
              var pp = points[i].toPolarPoint(new Point(-25,-25));
              pp.setTheta(ITA.Geometry.wrapAngle(pp.getTheta(), angle));
              pp.setRadius(Math.floor(pp.getRadius() * scale));

              var pnt = pp.toPoint();
              pnt.offset(center.getX(), center.getY());
           
              ctx.lineTo(pnt.getX(), pnt.getY());  
              
            }//for
            
            ctx.stroke();
         }//draw               
         
       }
     
     } 
     
     
     
     
     
     
     
     
 

