Fix clockwise rotation
This commit is contained in:
		
							parent
							
								
									ef6ed845c2
								
							
						
					
					
						commit
						e64715d051
					
				
					 1 changed files with 2 additions and 10 deletions
				
			
		| 
						 | 
					@ -117,15 +117,7 @@ rotate' b@(Block s o@(xo,yo) cs)
 | 
				
			||||||
  where
 | 
					  where
 | 
				
			||||||
    rotateWith :: (Coord -> Coord -> Coord) -> Block -> Block
 | 
					    rotateWith :: (Coord -> Coord -> Coord) -> Block -> Block
 | 
				
			||||||
    rotateWith dir b                 = b & extra %~ fmap (dir (b ^. origin))
 | 
					    rotateWith dir b                 = b & extra %~ fmap (dir (b ^. origin))
 | 
				
			||||||
 | 
					    clockwise (xo, yo) (x, y)        = (xo + y - yo, xo + yo - x)
 | 
				
			||||||
    clockwise :: Coord -- ^ origin
 | 
					 | 
				
			||||||
              -> Coord -- ^ point to rotate around origin
 | 
					 | 
				
			||||||
              -> Coord
 | 
					 | 
				
			||||||
    clockwise (xo, yo) (x, y) = (xo + y - yo, xo + y - x)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    counterclockwise :: Coord -- ^ origin
 | 
					 | 
				
			||||||
                     -> Coord -- ^ point to rotate around origin
 | 
					 | 
				
			||||||
                     -> Coord
 | 
					 | 
				
			||||||
    counterclockwise (xo, yo) (x, y) = (xo + yo - y, x + yo - xo)
 | 
					    counterclockwise (xo, yo) (x, y) = (xo + yo - y, x + yo - xo)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | Get coordinates of entire block
 | 
					-- | Get coordinates of entire block
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue