diff --git a/hgeometry/test-with-ipe/test/Plane/LowerEnvelopeSpec.hs b/hgeometry/test-with-ipe/test/Plane/LowerEnvelopeSpec.hs index 40cfe91ff..0fb743258 100644 --- a/hgeometry/test-with-ipe/test/Plane/LowerEnvelopeSpec.hs +++ b/hgeometry/test-with-ipe/test/Plane/LowerEnvelopeSpec.hs @@ -106,6 +106,10 @@ spec = describe "lower envelope tests" $ do testIpe [osp|degenerate1.ipe|] [osp|degenerate1_out|] + -- testIpeGraph [osp|foo.ipe|] + -- [osp|foo_graph_out|] + + -- | Computes the vertex form of the upper envelope. The z-coordinates are still flipped. @@ -134,7 +138,7 @@ voronoiVertices = foldMap (\case Unbounded _ pts _ -> Set.fromList (NonEmpty.toList pts) ) . voronoiDiagram' - +-- | Build voronoi diagrams on the input points testIpe :: OsPath -> OsPath -> Spec testIpe inFp outFp = do (points :: NonEmpty (Point 2 R :+ _)) <- runIO $ do @@ -148,11 +152,31 @@ testIpe inFp outFp = do goldenWith [osp|data/test-with-ipe/Plane/LowerEnvelope/|] (ipeFileGolden { name = outFp }) (addStyleSheet opacitiesStyle $ singlePageFromContent out) - -- FIXME: use data/test-with-ipe/VoronoiDiagram/ as input and data/test-with-ipe/Plane/LowerEnvelope - -- as output dir + +{- +-- build a triangulated graph from the points in the input file +testIpeGraph :: OsPath -> OsPath -> Spec +testIpeGraph inFp outFp = do + (points :: NonEmpty (Point 2 R :+ _)) <- runIO $ do + inFp' <- getDataFileName ([osp|test-with-ipe/VoronoiDiagram/|] <> inFp) + NonEmpty.fromList <$> readAllFrom inFp' + let vd = voronoiDiagram' $ view core <$> points + vv = voronoiVertices $ view core <$> points + out = [ iO' points + , iO' vd + ] <> [ iO'' v $ attr SStroke red | v <- Set.toAscList vv ] + goldenWith [osp|data/test-with-ipe/Plane/LowerEnvelope/|] + (ipeFileGolden { name = outFp }) + (addStyleSheet opacitiesStyle $ singlePageFromContent out) + +-} + + + + + --- outputFile' <- addStyleSheetFrom "../hgeometry-ipe/resources/opacities.isy" outputFile {- @@ -176,21 +200,6 @@ testIpe inFp outFp = do , iO' trivialVD ] - testIpe [osp|trivial.ipe|] - [osp|trivial_out|] - testIpe [osp|simplest.ipe|] - [osp|simplest_out|] - testIpe [osp|simpler.ipe|] - [osp|simpler_out|] - testIpe [osp|simple.ipe|] - [osp|simple_out|] - testIpe [osp|simple1.ipe|] - [osp|simple1_out|] - testIpe [osp|foo.ipe|] - [osp|foo_out|] - - - degenerateTests :: Spec degenerateTests = describe "degnereate inputs" $ do @@ -269,39 +278,4 @@ trivialVD = VoronoiDiagram $ LowerEnvelope vInfty (Seq.fromList [bv]) _ -> error "absurd" -- order of the planes is incorrect, as is the z-coord. - - - - - - --- testIpe :: OsPath -> IO [IpeObject R] --- testIpe inFp = do inFp' <- getDataFileName inFp --- (points :: [Point 2 R :+ _]) <- readAllFrom inFp' - --- print $ (Point3 183.02716 93.61106 8869.99979 :: Point 3 R) --- `onSideTest` --- (NonVerticalHyperPlane (Vector3 282 426 (-65250))) - - --- -- mapM_ print points --- -- mapM_ (print . liftPointToPlane . view core) points --- -- let hs = liftPointToPlane . view core <$> points --- -- mapM_ (print . asVertex hs) $ uniqueTriplets hs - --- let vv = voronoiVertices $ (view core) <$> points --- let vd = voronoiDiagram $ (view core) <$> points --- print $ vd - - --- -- print "vertices" --- -- mapM_ print vs --- pure $ [ iO' points --- , iO' vd --- ] <> [ iO'' v $ attr SStroke red | v <- vv ] - - --- -- $ (map iO' points) --- -- -- <> [iO' vd] --- -- <> -}