module Geometry.Ray ( Ray(..) , fromSegment ) where import RIO import Geomancy (Vec3) data Ray = Ray { Ray -> Vec3 origin :: Vec3 , Ray -> Vec3 direction :: Vec3 } deriving (Int -> Ray -> ShowS [Ray] -> ShowS Ray -> String (Int -> Ray -> ShowS) -> (Ray -> String) -> ([Ray] -> ShowS) -> Show Ray forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Ray] -> ShowS $cshowList :: [Ray] -> ShowS show :: Ray -> String $cshow :: Ray -> String showsPrec :: Int -> Ray -> ShowS $cshowsPrec :: Int -> Ray -> ShowS Show) fromSegment :: Vec3 -> Vec3 -> Ray fromSegment :: Vec3 -> Vec3 -> Ray fromSegment Vec3 origin Vec3 target = Ray :: Vec3 -> Vec3 -> Ray Ray { $sel:origin:Ray :: Vec3 origin = Vec3 origin , $sel:direction:Ray :: Vec3 direction = Vec3 target Vec3 -> Vec3 -> Vec3 forall a. Num a => a -> a -> a - Vec3 origin }