Start work on crafting/combinations

This commit is contained in:
2021-12-02 00:50:29 +00:00
parent ce06845278
commit 85ededc158
28 changed files with 189 additions and 112 deletions
+17 -5
View File
@@ -126,8 +126,10 @@ pushOutFromWall rad cp2 (wp1,wp2)
-- --isOnWall = circOnSegNoEndpoints wp1 wp2 cp2 rad
-- isOnWall = circOnSeg wp1 wp2 cp2 rad
pushOutFromCorners :: Float -> [(Point2,Point2)] -> Point2 -> Point2
pushOutFromCorners r ls p = foldr (intersectCirclePoint r . fst) p ls
pushOutFromCorners r ls p = foldr (squashIntersectCirclePoint r . fst) p ls
--pushOutFromCorners' :: World -> Creature -> Creature
--pushOutFromCorners' w cr = cr & crPos .~ newPos
@@ -138,8 +140,18 @@ pushOutFromCorners r ls p = foldr (intersectCirclePoint r . fst) p ls
--collideCorners :: Float -> [Point2] -> Point2 -> Point2
--collideCorners rad ps p2 = foldr (intersectCirclePoint rad) p2 ps
---- collide circles with points (outer corners)
intersectCirclePoint :: Float -> Point2 -> Point2 -> Point2
intersectCirclePoint rad p cCen
--safeIntersectCirclePoint :: Float -> Point2 -> Point2 -> Maybe Point2
--safeIntersectCirclePoint rad p cCen
-- | dist cCen p > rad = Just cCen
-- | otherwise = (p +.+) <$> ((rad *.*) <$> (safeNormalizeV (cCen -.- p)))
squashIntersectCirclePoint :: Float -> Point2 -> Point2 -> Point2
squashIntersectCirclePoint rad p cCen
| dist cCen p > rad = cCen
| otherwise = p +.+ (rad *.* errorNormalizeV 65 (cCen -.- p))
| otherwise = p +.+ (rad *.* squashNormalizeV (cCen -.- p))
---- collide circles with points (outer corners)
--intersectCirclePoint :: Float -> Point2 -> Point2 -> Point2
--intersectCirclePoint rad p cCen
-- | dist cCen p > rad = cCen
-- | otherwise = p +.+ (rad *.* errorNormalizeV 65 (cCen -.- p))