Implement randomised markings on sensors

This commit is contained in:
2022-03-13 19:59:46 +00:00
parent 06a501ff88
commit 1b6f11709c
16 changed files with 169 additions and 95 deletions
+24 -2
View File
@@ -1,7 +1,10 @@
module Color
where
module Color where
import Geometry
data PaletteColor = Red | Green | Blue | Yellow | Cyan
| Magenta | Rose | Violet | Azure | Aquamarine | Chartreuse | Orange | White | Black
deriving (Eq,Ord,Enum,Show)
type RGBA = Point4
type Color = Point4
@@ -40,6 +43,24 @@ black = V4 0 0 0 1
{-# INLINE white #-}
{-# INLINE black #-}
paletteToColor :: PaletteColor -> Color
{-# INLINE paletteToColor #-}
paletteToColor pc = case pc of
Red -> red
Green -> green
Blue -> blue
Yellow -> yellow
Cyan -> cyan
Magenta -> magenta
Rose -> rose
Violet -> violet
Azure -> azure
Aquamarine -> aquamarine
Chartreuse -> chartreuse
Orange -> orange
White -> white
Black -> black
mixColors :: Float -> Float -> Color -> Color -> Color
{-# INLINE mixColors #-}
mixColors rata ratb (V4 r0 g0 b0 a0) (V4 r2 g2 b2 a2) =
@@ -74,6 +95,7 @@ greyN :: Float -> Color
greyN x = toV4 (x,x,x,1)
numColor :: Int -> Color
{-# INLINE numColor #-}
numColor 0 = toV4 (1,0,0,1)
numColor 1 = toV4 (0,1,0,1)
numColor 2 = toV4 (0,0,1,1)