Implement vertex categorisation for Polygon Triangulation

This commit is contained in:
2015-01-07 18:55:16 +01:00
parent 4f5d7f15bf
commit 013dfd054b
6 changed files with 146 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import Algorithms.GrahamScan
import Algorithms.QuadTree
import Algorithms.KDTree
import Algorithms.PolygonIntersection
import Algorithms.PolygonTriangulation
import Data.Maybe
import Data.Monoid
import Data.Tree
@@ -243,3 +244,23 @@ treePretty = Diag f
(~~)
(symmLayout' (with & slHSep .~ 60 & slVSep .~ 40) tree)
# scale 2 # alignT # bg white
-- |Show the points for polygon triangulation in different colors.
polyTriCategorizedPoints :: Diag
polyTriCategorizedPoints = Diag f
where
f p vts =
foldl (\diag' (x, y) ->
diag' <> (drawP [x] (dotSize p) # lc (vcatToCol y))
# fc (vcatToCol y))
mempty
(classifyList . concat $ vts)
-- category to color mapping
vcatToCol :: VCategory -> Colour Double
vcatToCol VStart = green
vcatToCol VSplit = blue
vcatToCol VEnd = red
vcatToCol VMerge = pink
vcatToCol VRegular = yellow

View File

@@ -32,7 +32,9 @@ diagAlgos =
coordPoints, polyLines, plotterBG])
,DiagAlgo (4, [quadPathSquare, squares, coordPointsText,
coordPoints, plotterBG])
,DiagAlgo (5, [kdRange, kdSquares, coordPointsText, coordPoints, plotterBG])]
,DiagAlgo (5, [kdRange, kdSquares, coordPointsText, coordPoints, plotterBG])
,DiagAlgo (6, [polyLines, coordPointsText, polyTriCategorizedPoints,
plotterBG])]
-- |Introspective data structure holding all algorithms for the