Use a variable for the set of rotation angles.

This commit is contained in:
Robbie Gleichman 2017-07-18 19:11:57 -07:00
parent 4ab6c09cf4
commit b6171533c5
2 changed files with 15 additions and 12 deletions

View File

@ -241,7 +241,10 @@ bestAngleForIcon :: (SpecialNum n, ING.Graph gr) =>
-> Bool
-> (Angle n, n)
bestAngleForIcon positionMap graph key@(NodeName nodeId, _) reflected =
minimumBy (compare `on` snd) $ (\angle -> (angle, scoreAngle iconPosition edges reflected angle)) <$> fmap (@@ turn) [0,(1/24)..1] where
minimumBy (compare `on` snd) $ (\angle -> (angle, scoreAngle iconPosition edges reflected angle)) <$> fmap (@@ turn) possibleAngles
where
possibleAngles = [0,(1/24)..1]
-- possibleAngles = [0, 1/2] -- (uncomment this line and comment out the line above to disable rotation)
iconPosition = positionMap Map.! key
edges = getPositionAndAngles <$> fmap getSucEdge (ING.lsuc graph nodeId) <> fmap getPreEdge (ING.lpre graph nodeId)

View File

@ -1,4 +1,4 @@
{-# LANGUAGE NoMonomorphismRestriction, FlexibleContexts, TypeFamilies, TupleSections #-}
{-# LANGUAGE NoMonomorphismRestriction, TupleSections #-}
module Translate(
translateStringToSyntaxGraph,
translateStringToCollapsedGraphAndDecl,