Implement vertex categorisation for Polygon Triangulation
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user