diff --git a/hgeometry-examples/hgeometry-examples.cabal b/hgeometry-examples/hgeometry-examples.cabal index ad4dfd560..2e043c263 100644 --- a/hgeometry-examples/hgeometry-examples.cabal +++ b/hgeometry-examples/hgeometry-examples.cabal @@ -280,3 +280,14 @@ executable hgeometry-draw main-is: Main.hs -- other-modules: -- Options + + +-------------------------------------------------------------------------------- + +-- Renders a 3D model of the lower envelope of a set of planes +executable hgeometry-lowerEnv + import: setup, miso-setup + hs-source-dirs: lowerEnv + main-is: Main.hs + -- other-modules: + -- Options diff --git a/hgeometry-examples/lowerEnv/Main.hs b/hgeometry-examples/lowerEnv/Main.hs new file mode 100644 index 000000000..ea89a2e33 --- /dev/null +++ b/hgeometry-examples/lowerEnv/Main.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE QuasiQuotes #-} +module Main(main) where + +import Control.Lens +import qualified Data.List.NonEmpty as NonEmpty +import HGeometry.Ext +import HGeometry.Number.Real.Rational +import HGeometry.Plane.LowerEnvelope +import HGeometry.PlaneGraph +import HGeometry.PlaneGraph.Instances +import HGeometry.Point +import HGeometry.VoronoiDiagram.ViaLowerEnvelope +import Ipe +import PLY.Writer +import System.OsPath +import Test.QuickCheck + +-------------------------------------------------------------------------------- + +type R = RealNumber 5 + + +myPlanes = NonEmpty.fromList $ zipWith (\i p -> pointToPlane p :+ (i,p)) [0..] + [ Point2 16 80 + , Point2 64 48 + , Point2 208 128 + , Point2 176 48 + , Point2 96 112 + , Point2 128 80 + , Point2 48 144 + ] + +verticesOf = \case + ParallelStrips _ -> undefined + ConnectedEnvelope env -> undefined + +trianglesOf env = [] + +main :: IO () +main = renderOutputToFile [osp|myLowerEnv|] (verticesOf $ lowerEnvelope myPlanes) + (trianglesOf $ lowerEnvelope myPlanes)