SOE ex.8.7


{-----------------------------------------------------
 flipX:(x,y)-->(x,-y)   flipY:(x,y)-->(-x,y)

 y                                 y
 ^    * (x,y)           (-x,y) *   ^   * (x,y)
 |   / \                      / \  |  / \
 |  *---*                    *---* | *---*
 +---------> x           ----------+----------> x
 |  *---*
 |   \ /
 |    * (x,-y)
-----------------------------------------------------}

flipX :: Region -> Region
flipX = Scale (1, -1)

flipY :: Region -> Region
flipY = Scale (-1, 1)


----- data/type used in this exercise -----
data Region = Scale Vector Region
type Vector = (Float, Float)

Leave a Reply