PostGIS  2.3.7dev-r@@SVN_REVISION@@
static void test_hsv_to_rgb ( )
static

Definition at line 69 of file raster/test/cunit/cu_misc.c.

References rt_util_hsv_to_rgb().

Referenced by misc_suite_setup().

69  {
70  double hsv[3] = {0, 0, 0};
71  double rgb[3] = {0, 0, 0};
72 
73  rt_util_hsv_to_rgb(hsv, rgb);
74  CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0, DBL_EPSILON);
75  CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0, DBL_EPSILON);
76  CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0, DBL_EPSILON);
77 
78  hsv[0] = 2/3.;
79  hsv[1] = 1;
80  hsv[2] = 1;
81  rt_util_hsv_to_rgb(hsv, rgb);
82  CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0., DBL_EPSILON);
83  CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0, DBL_EPSILON);
84  CU_ASSERT_DOUBLE_EQUAL(rgb[2], 1, DBL_EPSILON);
85 
86  hsv[0] = 7/12.;
87  hsv[1] = 1;
88  hsv[2] = 0.5;
89  rt_util_hsv_to_rgb(hsv, rgb);
90  CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0, DBL_EPSILON);
91  CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0.25, DBL_EPSILON);
92  CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0.5, DBL_EPSILON);
93 
94  hsv[0] = 1/3.;
95  hsv[1] = 0.5;
96  hsv[2] = 1;
97  rt_util_hsv_to_rgb(hsv, rgb);
98  CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0.5, DBL_EPSILON);
99  CU_ASSERT_DOUBLE_EQUAL(rgb[1], 1, DBL_EPSILON);
100  CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0.5, DBL_EPSILON);
101 
102  hsv[0] = 0.5;
103  hsv[1] = 0.5;
104  hsv[2] = 0.4;
105  rt_util_hsv_to_rgb(hsv, rgb);
106  CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0.2, DBL_EPSILON);
107  CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0.4, DBL_EPSILON);
108  CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0.4, DBL_EPSILON);
109 }
rt_errorstate rt_util_hsv_to_rgb(double hsv[3], double rgb[3])
Definition: rt_util.c:557

Here is the call graph for this function:

Here is the caller graph for this function: