Work on crab feet

This commit is contained in:
2026-04-09 22:24:38 +01:00
parent c8a06bc084
commit ea6f4b2054
4 changed files with 200 additions and 169 deletions
+6
View File
@@ -67,6 +67,12 @@ angleVV a b
d = a `dotV` b
in acos $ d / (ma * mb)
-- returns the angle opposite length a
angleThreeSides :: Float -> Float -> Float -> Float
angleThreeSides a b c = acos $ (f b + f c - f a) / (2*b*c)
where
f = (^ (2 ::Int))
-- | Safe version of 'angleVV' that returns 0 if either vector is null.
safeAngleVV :: Point2 -> Point2 -> Float
{-# INLINE safeAngleVV #-}
+2 -1
View File
@@ -1,6 +1,7 @@
{-# LANGUAGE BangPatterns #-}
module Geometry.Vector3D
where
import Linear
import Geometry.Vector
import Geometry.Data
@@ -121,7 +122,7 @@ dotV3 (V3 x y z) (V3 a b c) = x*a + y*b + z*c
angleVV3 :: Point3 -> Point3 -> Float
angleVV3 a b
| a == b = 0
| a == b || norm a == 0 || norm b == 0 = 0
| otherwise = acos $ dotV3 a b / (magV3 a * magV3 b)
--projV3 :: Point3 -> Point3 -> Point3