Creature shadow test
This commit is contained in:
@@ -34,6 +34,16 @@ constructEdges (face:faces) = mapMaybe (findReverseEdge otherEdges) (faceEdges f
|
||||
otherEdges = concatMap faceEdges faces
|
||||
constructEdges _ = []
|
||||
|
||||
-- | a version of construct edges that directly returns the flattened list of
|
||||
-- tuples
|
||||
constructEdgesList :: [[Point3]] -> [Point3]
|
||||
constructEdgesList (face:faces) = concatMap (findReverseEdgeList otherEdges) (faceEdges face)
|
||||
++ constructEdgesList faces
|
||||
where
|
||||
otherEdges = concatMap faceEdges faces
|
||||
constructEdgesList _ = []
|
||||
|
||||
|
||||
findReverseEdge
|
||||
:: [(Point3,Point3,Point3)]
|
||||
-> (Point3,Point3,Point3)
|
||||
@@ -41,6 +51,14 @@ findReverseEdge
|
||||
findReverseEdge otherEdges (x,y,z) = (\(_,_,n) -> (x,y,z,n))
|
||||
<$> find (\(a,b,_) -> (x,y) == (b,a)) otherEdges
|
||||
|
||||
findReverseEdgeList
|
||||
:: [(Point3,Point3,Point3)]
|
||||
-> (Point3,Point3,Point3)
|
||||
-> [Point3]
|
||||
findReverseEdgeList a b = case findReverseEdge a b of
|
||||
Nothing -> []
|
||||
Just (x,y,z,w) -> [x,y,z,w]
|
||||
|
||||
faceEdges :: [Point3] -> [(Point3,Point3,Point3)]
|
||||
faceEdges xs = zipWith addNormal xs (tail xs ++ [head xs])
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user