packages feed

gluturtle 0.0.43 → 0.0.48

raw patch · 4 files changed

+12/−7 lines, 4 files

Files

gluturtle.cabal view
@@ -2,7 +2,7 @@ cabal-version:	>= 1.6  name:		gluturtle-version:	0.0.43+version:	0.0.48 stability:	alpha author:		Yoshikuni Jujo <PAF01143@nifty.ne.jp> maintainer:	Yoshikuni Jujo <PAF01143@nifty.ne.jp>
src/Graphics/UI/GLUT/Turtle/TriangleTools.hs view
@@ -28,7 +28,8 @@ dol (a : ps@(b : ps'@(c : _))) 	| online (a, b, c) = a : dol ps' 	| otherwise = a : dol ps-dol p = error $ "dol: not implemented " ++ show p+dol ps = ps+-- dol p = error $ "dol: not implemented " ++ show p  maximumIndex :: Ord a => [a] -> Int maximumIndex = fst . maximumIndexGen@@ -87,7 +88,7 @@ isRight :: (Pos, Pos, Pos) -> Bool isRight ((xa, ya), (xb, yb), (xc, yc)) 	| 0 < xd * ye - xe * yd = True-	| 0 == xd * ye - xe * yd = error "bad triangle"+	| 0 == xd * ye - xe * yd = error "isRight: bad triangle" 	| otherwise = False 	where 	(xd, yd) = (xa - xb, ya - yb)
src/Graphics/UI/GLUT/Turtle/Triangles.hs view
@@ -3,19 +3,22 @@ import Graphics.UI.GLUT.Turtle.TriangleTools  isHoleRight :: [Pos] -> Bool+isHoleRight ps+	| length (deleteOnline $ deletePoint ps) < 3 = True isHoleRight ps = isRight tri 	where-	i = far ps-	tri = index3 ps i+	i = far (deleteOnline $ deletePoint ps)+	tri = index3 (deleteOnline $ deletePoint ps) i  toTriangles :: [Pos] -> [(Pos, Pos, Pos)] toTriangles ps+	| length ps < 3 = [] 	| isHoleRight ps = toTriangles' ps 	| otherwise = toTriangles' $ reverse ps  toTriangles' :: [Pos] -> [(Pos, Pos, Pos)] toTriangles' ps-	| length ps < 3 = []+	| length (deleteOnline $ deletePoint ps) < 3 = [] 	| otherwise = toTrianglesTop $ deleteOnline $ deletePoint ps  deletePoint :: Eq a => [a] -> [a]
tests/testGLUT.hs view
@@ -44,7 +44,7 @@ processInput _ _ t "hide" = hideturtle t >> return True processInput _ _ t "bred" = bgcolor t ((255, 0, 0) :: (Int, Int, Int)) >> return True processInput _ _ t "bgreen" = bgcolor t ((0, 255, 0) :: (Int, Int, Int)) >> return True-processInput _ _ t "home" = goto t 0 0 >> return True+-- processInput _ _ t "home" = goto t 0 0 >> return True processInput _ _ t "undo" = undo t >> return True processInput f _ _ "size" = setFieldSize f 100 200 >> return True processInput f _ _ "topleft" = topleft f >> return True@@ -52,4 +52,5 @@ processInput _ _ t "goto100" = goto t 100 100 >> return True processInput _ _ t "clear" = clear t >> return True processInput _ _ t "svg" = getSVG t >>= print >> return True+processInput _ _ t "home" = home t >> return True processInput _ _ _ _ = return True