Skip to content

Commit

Permalink
break up long lines and add todo comments
Browse files Browse the repository at this point in the history
  • Loading branch information
patritzenfeld committed Jan 9, 2025
1 parent 8d88dcb commit 241a263
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/Normalize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,14 @@ instance Drawable NormalizedPicture where

Blank & p = p
p & Blank = p
Polyline (Hollow Normal) ps1 & Polyline (Hollow Thick) ps2 = Polyline (Hollow Thick) ps2 & Polyline (Hollow Normal) ps1
Polyline (Hollow t) ps1 & Polyline Solid ps2 = Polyline Solid ps2 & Polyline (Hollow t) ps1
Curve (Hollow Normal) ps1 & Curve (Hollow Thick) ps2 = Curve (Hollow Thick) ps2 & Curve (Hollow Normal) ps1
Curve (Hollow t) ps1 & Curve Solid ps2 = Curve Solid ps2 & Curve (Hollow t) ps1
Polyline (Hollow Normal) ps1 & Polyline (Hollow Thick) ps2 =
Polyline (Hollow Thick) ps2 & Polyline (Hollow Normal) ps1
Polyline (Hollow t) ps1 & Polyline Solid ps2 =
Polyline Solid ps2 & Polyline (Hollow t) ps1
Curve (Hollow Normal) ps1 & Curve (Hollow Thick) ps2 =
Curve (Hollow Thick) ps2 & Curve (Hollow Normal) ps1
Curve (Hollow t) ps1 & Curve Solid ps2 =
Curve Solid ps2 & Curve (Hollow t) ps1
Polyline sp ps1 & Curve sc ps2 = Curve sc ps2 & Polyline sp ps1
Polyline s1 ps1 & Polyline s2 ps2 = handleFreeShape True s1 s2 ps1 ps2
Curve s1 ps1 & Curve s2 ps2 = handleFreeShape False s1 s2 ps1 ps2
Expand Down Expand Up @@ -246,21 +250,20 @@ instance Drawable NormalizedPicture where
closedCurve = curve . toOpenShape
thickClosedCurve t = thickCurve t . toOpenShape

-- Further rules needed starts here
polyline = checkForRectangle $ Hollow Normal
thickPolyline t = checkForRectangle $ Hollow $ thickness t
solidPolygon = checkForRectangle Solid . toOpenShape

polygon = polyline . toOpenShape
thickPolygon t = thickPolyline t . toOpenShape
-- Further rules needed ends here

lettering "" = blank
lettering t = Lettering t

styledLettering _ _ "" = blank
styledLettering _ _ t = Lettering t

-- TODO: translate/scale/rotate free shapes
translated 0 0 p = p
translated x y p = case p of
Translate a b q -> translated (x + getExactPos a) (y + getExactPos b) q
Expand Down Expand Up @@ -301,7 +304,7 @@ instance Drawable NormalizedPicture where
Pictures ps -> Pictures $ map (rotated a) ps
q -> Rotate (toAngle a) q

-- Rules needed here aswell
-- TODO: Rules needed here
reflected a = Reflect $ toAngle a
clipped x y = Clip (toSize x) (toSize y)

Expand Down Expand Up @@ -477,6 +480,7 @@ stripTranslation (Translate _ _ p) = p
stripTranslation p = p


-- TODO: also handle point list based shapes
relativePosition :: [NormalizedPicture] -> [RelativePicSpec]
relativePosition [] = []
relativePosition (Translate x y p:ps) = othersTrans ++ relativePosition ps
Expand Down

0 comments on commit 241a263

Please sign in to comment.