Working (but slow) shadow shapes

This commit is contained in:
2021-09-17 23:12:51 +01:00
parent 294e01479a
commit 6ac53c052c
16 changed files with 167 additions and 60 deletions
+18 -1
View File
@@ -1,4 +1,14 @@
module Polyhedra
( translateXY
, rotateXY
, polyToEdges
, constructEdgesList
, boxXYZ
, boxABC
, boxXYZnobase
, polyToGeoRender
, polysToPic
)
where
import Geometry
--import Geometry.Data
@@ -129,7 +139,14 @@ polysToPic :: [Polyhedra] -> Picture
polysToPic = pictures . concatMap polyToPics
polyToEdges :: Polyhedra -> [(Point3,Point3,Point3,Point3)]
polyToEdges = constructEdges . map (map fst) . _pyFaces
polyToEdges = map denormalEdges . constructEdges . map (map fst) . _pyFaces
denormalEdges :: (Point3,Point3,Point3,Point3) -> (Point3,Point3,Point3,Point3)
denormalEdges (a,b,n,m) = (a,b,a - x, b - y)
where
x = crossProd (b - a) n
y = crossProd (a - b) m
polyToGeoRender :: Polyhedra -> [Point3]
polyToGeoRender = concatMap (polyToTris . map fst) . _pyFaces