Allow drawing the polygon stuff via GUI

This commit is contained in:
2014-10-25 03:15:38 +02:00
parent 7965443aa6
commit ddff8b1fb2
5 changed files with 121 additions and 23 deletions

View File

@@ -11,14 +11,14 @@ import Parser.Meshparser
-- |Create the Diagram from the points.
diag :: DiagProp -> [PT] -> Diagram Cairo R2
diag p = case alg p of
diag :: DiagProp -> [[PT]] -> Diagram Cairo R2
diag p pts = case alg p of
0 ->
mkDiag
(mconcat [maybeDiag (ct p) coordPointsText,
coordPoints, xAxis, yAxis,
maybeDiag (gd p) grid, whiteRectB])
p
p (head pts)
1 ->
mkDiag
(mconcat
@@ -26,15 +26,48 @@ diag p = case alg p of
convexHP, convexHLs,
coordPoints, xAxis, yAxis,
maybeDiag (gd p) grid, whiteRectB])
p
p (head pts)
2 -> polys
3 ->
polyIntText
`atop`
polyIntersection (head pts) (pts !! 1) p
`atop`
polys
_ -> mempty
where
polys =
mkDiag
(mconcat [maybeDiag (ct p) coordPointsText, polyLines])
p (head pts)
`atop`
mkDiag
(mconcat
[maybeDiag (ct p) coordPointsText,
polyLines, coordPoints, xAxis, yAxis,
maybeDiag (gd p) grid, whiteRectB])
p (pts !! 1)
polyIntText = if ct p
then polyIntersectionText (head pts) (pts !! 1) p
else mempty
-- |Create the Diagram from a String which is supposed to be the contents
-- of an obj file.
diagS :: DiagProp -> MeshString -> Diagram Cairo R2
diagS p mesh =
(diag p .
meshToArr $
mesh) #
bg white
diagS p mesh = case alg p of
2 ->
diag p.
facesToArr $
mesh
3 ->
diag p.
facesToArr $
mesh
_ ->
(diag p .
(:[]) .
meshToArr $
mesh) #
bg white