{-# LANGUAGE RecordWildCards #-}
module KdT where
import Data.KdTree.Static (build, KdTree)
import Elem3D ( Foton(..), Point3D(..) )


{-# INLINE fotonAxis #-}
-- |Función auxiliar, dado un fotón devuelve una lista con sus 3 coordenadas.
fotonAxis :: Foton -> [Float]
fotonAxis :: Foton -> [Float]
fotonAxis (Foton {pFot :: Foton -> Point3D
pFot = Point3D Float
x Float
y Float
z}) = [Float
x, Float
y, Float
z] -- Indicamos simplemente de donde coge las coordenadas paral el kdTree 

{-# INLINE createKD #-}
-- |Función básica, dado una lista de fotones, se crea la estructura KDT correspondiente.
createKD :: [Foton] -> KdTree Float Foton
createKD :: [Foton] -> KdTree Float Foton
createKD = (Foton -> [Float]) -> [Foton] -> KdTree Float Foton
forall a p. Real a => PointAsListFn a p -> [p] -> KdTree a p
Data.KdTree.Static.build Foton -> [Float]
fotonAxis -- Creación del kdTree