Skip to content

Commit ddbf527

Browse files
committed
fix tests
1 parent 0264af2 commit ddbf527

File tree

1 file changed

+28
-54
lines changed

1 file changed

+28
-54
lines changed

hgeometry/test-with-ipe/test/Plane/LowerEnvelopeSpec.hs

Lines changed: 28 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ spec = describe "lower envelope tests" $ do
106106
testIpe [osp|degenerate1.ipe|]
107107
[osp|degenerate1_out|]
108108

109+
-- testIpeGraph [osp|foo.ipe|]
110+
-- [osp|foo_graph_out|]
111+
112+
109113

110114
-- | Computes the vertex form of the upper envelope. The z-coordinates are still flipped.
111115

@@ -134,7 +138,7 @@ voronoiVertices = foldMap (\case
134138
Unbounded _ pts _ -> Set.fromList (NonEmpty.toList pts)
135139
) . voronoiDiagram'
136140

137-
141+
-- | Build voronoi diagrams on the input points
138142
testIpe :: OsPath -> OsPath -> Spec
139143
testIpe inFp outFp = do
140144
(points :: NonEmpty (Point 2 R :+ _)) <- runIO $ do
@@ -148,11 +152,31 @@ testIpe inFp outFp = do
148152
goldenWith [osp|data/test-with-ipe/Plane/LowerEnvelope/|]
149153
(ipeFileGolden { name = outFp })
150154
(addStyleSheet opacitiesStyle $ singlePageFromContent out)
151-
-- FIXME: use data/test-with-ipe/VoronoiDiagram/ as input and data/test-with-ipe/Plane/LowerEnvelope
152-
-- as output dir
155+
156+
{-
157+
-- build a triangulated graph from the points in the input file
158+
testIpeGraph :: OsPath -> OsPath -> Spec
159+
testIpeGraph inFp outFp = do
160+
(points :: NonEmpty (Point 2 R :+ _)) <- runIO $ do
161+
inFp' <- getDataFileName ([osp|test-with-ipe/VoronoiDiagram/|] <> inFp)
162+
NonEmpty.fromList <$> readAllFrom inFp'
163+
let vd = voronoiDiagram' $ view core <$> points
164+
vv = voronoiVertices $ view core <$> points
165+
out = [ iO' points
166+
, iO' vd
167+
] <> [ iO'' v $ attr SStroke red | v <- Set.toAscList vv ]
168+
goldenWith [osp|data/test-with-ipe/Plane/LowerEnvelope/|]
169+
(ipeFileGolden { name = outFp })
170+
(addStyleSheet opacitiesStyle $ singlePageFromContent out)
171+
172+
-}
173+
174+
175+
176+
177+
153178

154179

155-
-- outputFile' <- addStyleSheetFrom "../hgeometry-ipe/resources/opacities.isy" outputFile
156180

157181
{-
158182
@@ -176,21 +200,6 @@ testIpe inFp outFp = do
176200
, iO' trivialVD
177201
]
178202
179-
testIpe [osp|trivial.ipe|]
180-
[osp|trivial_out|]
181-
testIpe [osp|simplest.ipe|]
182-
[osp|simplest_out|]
183-
testIpe [osp|simpler.ipe|]
184-
[osp|simpler_out|]
185-
testIpe [osp|simple.ipe|]
186-
[osp|simple_out|]
187-
testIpe [osp|simple1.ipe|]
188-
[osp|simple1_out|]
189-
testIpe [osp|foo.ipe|]
190-
[osp|foo_out|]
191-
192-
193-
194203
195204
degenerateTests :: Spec
196205
degenerateTests = describe "degnereate inputs" $ do
@@ -269,39 +278,4 @@ trivialVD = VoronoiDiagram $ LowerEnvelope vInfty (Seq.fromList [bv])
269278
_ -> error "absurd"
270279
-- order of the planes is incorrect, as is the z-coord.
271280
272-
273-
274-
275-
276-
277-
278-
-- testIpe :: OsPath -> IO [IpeObject R]
279-
-- testIpe inFp = do inFp' <- getDataFileName inFp
280-
-- (points :: [Point 2 R :+ _]) <- readAllFrom inFp'
281-
282-
-- print $ (Point3 183.02716 93.61106 8869.99979 :: Point 3 R)
283-
-- `onSideTest`
284-
-- (NonVerticalHyperPlane (Vector3 282 426 (-65250)))
285-
286-
287-
-- -- mapM_ print points
288-
-- -- mapM_ (print . liftPointToPlane . view core) points
289-
-- -- let hs = liftPointToPlane . view core <$> points
290-
-- -- mapM_ (print . asVertex hs) $ uniqueTriplets hs
291-
292-
-- let vv = voronoiVertices $ (view core) <$> points
293-
-- let vd = voronoiDiagram $ (view core) <$> points
294-
-- print $ vd
295-
296-
297-
-- -- print "vertices"
298-
-- -- mapM_ print vs
299-
-- pure $ [ iO' points
300-
-- , iO' vd
301-
-- ] <> [ iO'' v $ attr SStroke red | v <- vv ]
302-
303-
304-
-- -- $ (map iO' points)
305-
-- -- -- <> [iO' vd]
306-
-- -- <>
307281
-}

0 commit comments

Comments
 (0)