Skip to content

Commit

Permalink
creating a demo to render a lower envelope
Browse files Browse the repository at this point in the history
  • Loading branch information
noinia committed Nov 17, 2024
1 parent beec252 commit 076b7e9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hgeometry-examples/hgeometry-examples.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
41 changes: 41 additions & 0 deletions hgeometry-examples/lowerEnv/Main.hs
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 076b7e9

Please sign in to comment.