module HGamer3D.Data.Geometry2D
where
import HGamer3D.Data.ScreenRect
import Fresco
import Data.Int
data Point = Point {
ptX :: Int,
ptY :: Int
} deriving (Eq, Show)
rectFromPoints :: (Point, Point) -> ScreenRect
rectFromPoints (upperLeft, lowerRight) = ScreenRect rx ry rw rh where
rx = ptX upperLeft
ry = ptY upperLeft
rw = (ptY lowerRight) rx
rh = (ptY lowerRight) ry
pointsFromRect :: ScreenRect -> (Point, Point)
pointsFromRect rect = (ul, lr) where
rx = screenRectX rect
ry = screenRectY rect
rx' = rx + (screenRectWidth rect)
ry' = ry + (screenRectHeight rect)
ul = Point rx ry
lr = Point rx' ry'