@@ -106,6 +106,10 @@ spec = describe "lower envelope tests" $ do
106
106
testIpe [osp |degenerate1.ipe|]
107
107
[osp |degenerate1_out|]
108
108
109
+ -- testIpeGraph [osp|foo.ipe|]
110
+ -- [osp|foo_graph_out|]
111
+
112
+
109
113
110
114
-- | Computes the vertex form of the upper envelope. The z-coordinates are still flipped.
111
115
@@ -134,7 +138,7 @@ voronoiVertices = foldMap (\case
134
138
Unbounded _ pts _ -> Set. fromList (NonEmpty. toList pts)
135
139
) . voronoiDiagram'
136
140
137
-
141
+ -- | Build voronoi diagrams on the input points
138
142
testIpe :: OsPath -> OsPath -> Spec
139
143
testIpe inFp outFp = do
140
144
(points :: NonEmpty (Point 2 R :+ _ )) <- runIO $ do
@@ -148,11 +152,31 @@ testIpe inFp outFp = do
148
152
goldenWith [osp |data/test-with-ipe/Plane/LowerEnvelope/|]
149
153
(ipeFileGolden { name = outFp })
150
154
(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
+
153
178
154
179
155
- -- outputFile' <- addStyleSheetFrom "../hgeometry-ipe/resources/opacities.isy" outputFile
156
180
157
181
{-
158
182
@@ -176,21 +200,6 @@ testIpe inFp outFp = do
176
200
, iO' trivialVD
177
201
]
178
202
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
-
194
203
195
204
degenerateTests :: Spec
196
205
degenerateTests = describe "degnereate inputs" $ do
@@ -269,39 +278,4 @@ trivialVD = VoronoiDiagram $ LowerEnvelope vInfty (Seq.fromList [bv])
269
278
_ -> error "absurd"
270
279
-- order of the planes is incorrect, as is the z-coord.
271
280
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
- -- -- <>
307
281
-}
0 commit comments