properly use angles from 0 to 2PI (0 to 360°)
fixes https://pulkomandy.tk/projects/GrafX2/ticket/129
This commit is contained in:
		
							parent
							
								
									cd2552e935
								
							
						
					
					
						commit
						e152b75f4a
					
				@ -952,7 +952,6 @@ void Rotate_brush_1_5(void)
 | 
				
			|||||||
  short old_y;
 | 
					  short old_y;
 | 
				
			||||||
  short prev_state;
 | 
					  short prev_state;
 | 
				
			||||||
  double angle;
 | 
					  double angle;
 | 
				
			||||||
  int dx,dy;
 | 
					 | 
				
			||||||
  short cursor_x,cursor_y;
 | 
					  short cursor_x,cursor_y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Operation_pop(&prev_state);
 | 
					  Operation_pop(&prev_state);
 | 
				
			||||||
@ -972,9 +971,12 @@ void Rotate_brush_1_5(void)
 | 
				
			|||||||
      angle=0.0;
 | 
					      angle=0.0;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      dx=cursor_x-Brush_rotation_center_X;
 | 
					      // Angle from 0 to 2 PI
 | 
				
			||||||
      dy=cursor_y-Brush_rotation_center_Y;
 | 
					      int dx = cursor_x - Brush_rotation_center_X;
 | 
				
			||||||
      angle=M_2PI-atan2((double)dy,(double)dx);
 | 
					      int dy = cursor_y - Brush_rotation_center_Y;
 | 
				
			||||||
 | 
					      angle = 0.0 - atan2((double)dy, (double)dx);
 | 
				
			||||||
 | 
					      if (angle < 0.0)
 | 
				
			||||||
 | 
					        angle += M_2PI;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (Menu_is_visible)
 | 
					    if (Menu_is_visible)
 | 
				
			||||||
@ -1022,7 +1024,6 @@ void Rotate_brush_0_5(void)
 | 
				
			|||||||
  byte  angle_change;
 | 
					  byte  angle_change;
 | 
				
			||||||
  short prev_state;
 | 
					  short prev_state;
 | 
				
			||||||
  double angle=0.0;
 | 
					  double angle=0.0;
 | 
				
			||||||
  int dx,dy;
 | 
					 | 
				
			||||||
  short cursor_x, cursor_y;
 | 
					  short cursor_x, cursor_y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1044,9 +1045,12 @@ void Rotate_brush_0_5(void)
 | 
				
			|||||||
      angle=0.0;
 | 
					      angle=0.0;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      dx=cursor_x-Brush_rotation_center_X;
 | 
					      // Angle from 0 to 2 PI
 | 
				
			||||||
      dy=cursor_y-Brush_rotation_center_Y;
 | 
					      int dx = cursor_x - Brush_rotation_center_X;
 | 
				
			||||||
      angle=M_2PI-atan2((double)dy, (double)dx);
 | 
					      int dy = cursor_y - Brush_rotation_center_Y;
 | 
				
			||||||
 | 
					      angle = 0.0 - atan2((double)dy, (double)dx);
 | 
				
			||||||
 | 
					      if (angle < 0.0)
 | 
				
			||||||
 | 
					        angle += M_2PI;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (Menu_is_visible)
 | 
					    if (Menu_is_visible)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user