-
Notifications
You must be signed in to change notification settings - Fork 5
/
ConvertColorToInputFloatRange.php
1596 lines (1569 loc) · 35.7 KB
/
ConvertColorToInputFloatRange.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// input a number between 0 and $max and get a number inside
// a range of -1 to 1
function ConvertColorToInputFloatRange($color_int_value, $max = 255){
return ((($color_int_value - -1) * (1 - -1)) / ($max - 0)) + -1;
}
// RGB Color to range of -1 to 1
$R = 102;
$G = 102;
$B = 102;
echo "Pixel_RGB($R,$G,$B) = " . ConvertColorToInputFloatRange($R+$G+$B, 255+255+255) . PHP_EOL;
// RGB to Gray-scale to range of -1 to 1
$gray = ($R+$G+$B) / 3;
echo "Pixel_Grayscale($gray) = " . ConvertColorToInputFloatRange($gray, 255) . PHP_EOL;
/*
Pixel_RGB(102,102,102) = -0.19738562091503
Pixel_Greyscale(102) = -0.1921568627451
*/
// Gray-scale / One Color channel 0-255
for ($i = 0; $i <= 255; $i += 1){
echo $i . ' = ' . ConvertColorToInputFloatRange($i) . PHP_EOL;
}
/*
0 = -0.9921568627451
1 = -0.9843137254902
2 = -0.97647058823529
3 = -0.96862745098039
4 = -0.96078431372549
5 = -0.95294117647059
6 = -0.94509803921569
7 = -0.93725490196078
8 = -0.92941176470588
9 = -0.92156862745098
10 = -0.91372549019608
11 = -0.90588235294118
12 = -0.89803921568627
13 = -0.89019607843137
14 = -0.88235294117647
15 = -0.87450980392157
16 = -0.86666666666667
17 = -0.85882352941176
18 = -0.85098039215686
19 = -0.84313725490196
20 = -0.83529411764706
21 = -0.82745098039216
22 = -0.81960784313725
23 = -0.81176470588235
24 = -0.80392156862745
25 = -0.79607843137255
26 = -0.78823529411765
27 = -0.78039215686275
28 = -0.77254901960784
29 = -0.76470588235294
30 = -0.75686274509804
31 = -0.74901960784314
32 = -0.74117647058824
33 = -0.73333333333333
34 = -0.72549019607843
35 = -0.71764705882353
36 = -0.70980392156863
37 = -0.70196078431373
38 = -0.69411764705882
39 = -0.68627450980392
40 = -0.67843137254902
41 = -0.67058823529412
42 = -0.66274509803922
43 = -0.65490196078431
44 = -0.64705882352941
45 = -0.63921568627451
46 = -0.63137254901961
47 = -0.62352941176471
48 = -0.6156862745098
49 = -0.6078431372549
50 = -0.6
51 = -0.5921568627451
52 = -0.5843137254902
53 = -0.57647058823529
54 = -0.56862745098039
55 = -0.56078431372549
56 = -0.55294117647059
57 = -0.54509803921569
58 = -0.53725490196078
59 = -0.52941176470588
60 = -0.52156862745098
61 = -0.51372549019608
62 = -0.50588235294118
63 = -0.49803921568627
64 = -0.49019607843137
65 = -0.48235294117647
66 = -0.47450980392157
67 = -0.46666666666667
68 = -0.45882352941176
69 = -0.45098039215686
70 = -0.44313725490196
71 = -0.43529411764706
72 = -0.42745098039216
73 = -0.41960784313725
74 = -0.41176470588235
75 = -0.40392156862745
76 = -0.39607843137255
77 = -0.38823529411765
78 = -0.38039215686275
79 = -0.37254901960784
80 = -0.36470588235294
81 = -0.35686274509804
82 = -0.34901960784314
83 = -0.34117647058824
84 = -0.33333333333333
85 = -0.32549019607843
86 = -0.31764705882353
87 = -0.30980392156863
88 = -0.30196078431373
89 = -0.29411764705882
90 = -0.28627450980392
91 = -0.27843137254902
92 = -0.27058823529412
93 = -0.26274509803922
94 = -0.25490196078431
95 = -0.24705882352941
96 = -0.23921568627451
97 = -0.23137254901961
98 = -0.22352941176471
99 = -0.2156862745098
100 = -0.2078431372549
101 = -0.2
102 = -0.1921568627451
103 = -0.1843137254902
104 = -0.17647058823529
105 = -0.16862745098039
106 = -0.16078431372549
107 = -0.15294117647059
108 = -0.14509803921569
109 = -0.13725490196078
110 = -0.12941176470588
111 = -0.12156862745098
112 = -0.11372549019608
113 = -0.10588235294118
114 = -0.098039215686274
115 = -0.090196078431373
116 = -0.082352941176471
117 = -0.074509803921569
118 = -0.066666666666667
119 = -0.058823529411765
120 = -0.050980392156863
121 = -0.043137254901961
122 = -0.035294117647059
123 = -0.027450980392157
124 = -0.019607843137255
125 = -0.011764705882353
126 = -0.003921568627451
127 = 0.003921568627451
128 = 0.011764705882353
129 = 0.019607843137255
130 = 0.027450980392157
131 = 0.035294117647059
132 = 0.043137254901961
133 = 0.050980392156863
134 = 0.058823529411765
135 = 0.066666666666667
136 = 0.074509803921569
137 = 0.082352941176471
138 = 0.090196078431372
139 = 0.098039215686275
140 = 0.10588235294118
141 = 0.11372549019608
142 = 0.12156862745098
143 = 0.12941176470588
144 = 0.13725490196078
145 = 0.14509803921569
146 = 0.15294117647059
147 = 0.16078431372549
148 = 0.16862745098039
149 = 0.17647058823529
150 = 0.1843137254902
151 = 0.1921568627451
152 = 0.2
153 = 0.2078431372549
154 = 0.2156862745098
155 = 0.22352941176471
156 = 0.23137254901961
157 = 0.23921568627451
158 = 0.24705882352941
159 = 0.25490196078431
160 = 0.26274509803922
161 = 0.27058823529412
162 = 0.27843137254902
163 = 0.28627450980392
164 = 0.29411764705882
165 = 0.30196078431373
166 = 0.30980392156863
167 = 0.31764705882353
168 = 0.32549019607843
169 = 0.33333333333333
170 = 0.34117647058824
171 = 0.34901960784314
172 = 0.35686274509804
173 = 0.36470588235294
174 = 0.37254901960784
175 = 0.38039215686275
176 = 0.38823529411765
177 = 0.39607843137255
178 = 0.40392156862745
179 = 0.41176470588235
180 = 0.41960784313725
181 = 0.42745098039216
182 = 0.43529411764706
183 = 0.44313725490196
184 = 0.45098039215686
185 = 0.45882352941176
186 = 0.46666666666667
187 = 0.47450980392157
188 = 0.48235294117647
189 = 0.49019607843137
190 = 0.49803921568627
191 = 0.50588235294118
192 = 0.51372549019608
193 = 0.52156862745098
194 = 0.52941176470588
195 = 0.53725490196078
196 = 0.54509803921569
197 = 0.55294117647059
198 = 0.56078431372549
199 = 0.56862745098039
200 = 0.57647058823529
201 = 0.5843137254902
202 = 0.5921568627451
203 = 0.6
204 = 0.6078431372549
205 = 0.6156862745098
206 = 0.62352941176471
207 = 0.63137254901961
208 = 0.63921568627451
209 = 0.64705882352941
210 = 0.65490196078431
211 = 0.66274509803922
212 = 0.67058823529412
213 = 0.67843137254902
214 = 0.68627450980392
215 = 0.69411764705882
216 = 0.70196078431373
217 = 0.70980392156863
218 = 0.71764705882353
219 = 0.72549019607843
220 = 0.73333333333333
221 = 0.74117647058824
222 = 0.74901960784314
223 = 0.75686274509804
224 = 0.76470588235294
225 = 0.77254901960784
226 = 0.78039215686274
227 = 0.78823529411765
228 = 0.79607843137255
229 = 0.80392156862745
230 = 0.81176470588235
231 = 0.81960784313725
232 = 0.82745098039216
233 = 0.83529411764706
234 = 0.84313725490196
235 = 0.85098039215686
236 = 0.85882352941176
237 = 0.86666666666667
238 = 0.87450980392157
239 = 0.88235294117647
240 = 0.89019607843137
241 = 0.89803921568627
242 = 0.90588235294118
243 = 0.91372549019608
244 = 0.92156862745098
245 = 0.92941176470588
246 = 0.93725490196078
247 = 0.94509803921569
248 = 0.95294117647059
249 = 0.96078431372549
250 = 0.96862745098039
251 = 0.97647058823529
252 = 0.9843137254902
253 = 0.9921568627451
254 = 1
255 = 1.0078431372549
*/
// Two Color Channels as Gray-scale 0-510
for ($i = 0; $i <= 510; $i += 1){
echo $i . ' = ' . ConvertColorToInputFloatRange($i, 255+255) . PHP_EOL;
}
/*
0 = -0.99607843137255
1 = -0.9921568627451
2 = -0.98823529411765
3 = -0.9843137254902
4 = -0.98039215686275
5 = -0.97647058823529
6 = -0.97254901960784
7 = -0.96862745098039
8 = -0.96470588235294
9 = -0.96078431372549
10 = -0.95686274509804
11 = -0.95294117647059
12 = -0.94901960784314
13 = -0.94509803921569
14 = -0.94117647058824
15 = -0.93725490196078
16 = -0.93333333333333
17 = -0.92941176470588
18 = -0.92549019607843
19 = -0.92156862745098
20 = -0.91764705882353
21 = -0.91372549019608
22 = -0.90980392156863
23 = -0.90588235294118
24 = -0.90196078431373
25 = -0.89803921568627
26 = -0.89411764705882
27 = -0.89019607843137
28 = -0.88627450980392
29 = -0.88235294117647
30 = -0.87843137254902
31 = -0.87450980392157
32 = -0.87058823529412
33 = -0.86666666666667
34 = -0.86274509803922
35 = -0.85882352941176
36 = -0.85490196078431
37 = -0.85098039215686
38 = -0.84705882352941
39 = -0.84313725490196
40 = -0.83921568627451
41 = -0.83529411764706
42 = -0.83137254901961
43 = -0.82745098039216
44 = -0.82352941176471
45 = -0.81960784313725
46 = -0.8156862745098
47 = -0.81176470588235
48 = -0.8078431372549
49 = -0.80392156862745
50 = -0.8
51 = -0.79607843137255
52 = -0.7921568627451
53 = -0.78823529411765
54 = -0.7843137254902
55 = -0.78039215686275
56 = -0.77647058823529
57 = -0.77254901960784
58 = -0.76862745098039
59 = -0.76470588235294
60 = -0.76078431372549
61 = -0.75686274509804
62 = -0.75294117647059
63 = -0.74901960784314
64 = -0.74509803921569
65 = -0.74117647058824
66 = -0.73725490196078
67 = -0.73333333333333
68 = -0.72941176470588
69 = -0.72549019607843
70 = -0.72156862745098
71 = -0.71764705882353
72 = -0.71372549019608
73 = -0.70980392156863
74 = -0.70588235294118
75 = -0.70196078431373
76 = -0.69803921568627
77 = -0.69411764705882
78 = -0.69019607843137
79 = -0.68627450980392
80 = -0.68235294117647
81 = -0.67843137254902
82 = -0.67450980392157
83 = -0.67058823529412
84 = -0.66666666666667
85 = -0.66274509803922
86 = -0.65882352941176
87 = -0.65490196078431
88 = -0.65098039215686
89 = -0.64705882352941
90 = -0.64313725490196
91 = -0.63921568627451
92 = -0.63529411764706
93 = -0.63137254901961
94 = -0.62745098039216
95 = -0.62352941176471
96 = -0.61960784313725
97 = -0.6156862745098
98 = -0.61176470588235
99 = -0.6078431372549
100 = -0.60392156862745
101 = -0.6
102 = -0.59607843137255
103 = -0.5921568627451
104 = -0.58823529411765
105 = -0.5843137254902
106 = -0.58039215686275
107 = -0.57647058823529
108 = -0.57254901960784
109 = -0.56862745098039
110 = -0.56470588235294
111 = -0.56078431372549
112 = -0.55686274509804
113 = -0.55294117647059
114 = -0.54901960784314
115 = -0.54509803921569
116 = -0.54117647058824
117 = -0.53725490196078
118 = -0.53333333333333
119 = -0.52941176470588
120 = -0.52549019607843
121 = -0.52156862745098
122 = -0.51764705882353
123 = -0.51372549019608
124 = -0.50980392156863
125 = -0.50588235294118
126 = -0.50196078431373
127 = -0.49803921568627
128 = -0.49411764705882
129 = -0.49019607843137
130 = -0.48627450980392
131 = -0.48235294117647
132 = -0.47843137254902
133 = -0.47450980392157
134 = -0.47058823529412
135 = -0.46666666666667
136 = -0.46274509803922
137 = -0.45882352941176
138 = -0.45490196078431
139 = -0.45098039215686
140 = -0.44705882352941
141 = -0.44313725490196
142 = -0.43921568627451
143 = -0.43529411764706
144 = -0.43137254901961
145 = -0.42745098039216
146 = -0.42352941176471
147 = -0.41960784313725
148 = -0.4156862745098
149 = -0.41176470588235
150 = -0.4078431372549
151 = -0.40392156862745
152 = -0.4
153 = -0.39607843137255
154 = -0.3921568627451
155 = -0.38823529411765
156 = -0.3843137254902
157 = -0.38039215686275
158 = -0.37647058823529
159 = -0.37254901960784
160 = -0.36862745098039
161 = -0.36470588235294
162 = -0.36078431372549
163 = -0.35686274509804
164 = -0.35294117647059
165 = -0.34901960784314
166 = -0.34509803921569
167 = -0.34117647058824
168 = -0.33725490196078
169 = -0.33333333333333
170 = -0.32941176470588
171 = -0.32549019607843
172 = -0.32156862745098
173 = -0.31764705882353
174 = -0.31372549019608
175 = -0.30980392156863
176 = -0.30588235294118
177 = -0.30196078431373
178 = -0.29803921568627
179 = -0.29411764705882
180 = -0.29019607843137
181 = -0.28627450980392
182 = -0.28235294117647
183 = -0.27843137254902
184 = -0.27450980392157
185 = -0.27058823529412
186 = -0.26666666666667
187 = -0.26274509803922
188 = -0.25882352941176
189 = -0.25490196078431
190 = -0.25098039215686
191 = -0.24705882352941
192 = -0.24313725490196
193 = -0.23921568627451
194 = -0.23529411764706
195 = -0.23137254901961
196 = -0.22745098039216
197 = -0.22352941176471
198 = -0.21960784313725
199 = -0.2156862745098
200 = -0.21176470588235
201 = -0.2078431372549
202 = -0.20392156862745
203 = -0.2
204 = -0.19607843137255
205 = -0.1921568627451
206 = -0.18823529411765
207 = -0.1843137254902
208 = -0.18039215686275
209 = -0.17647058823529
210 = -0.17254901960784
211 = -0.16862745098039
212 = -0.16470588235294
213 = -0.16078431372549
214 = -0.15686274509804
215 = -0.15294117647059
216 = -0.14901960784314
217 = -0.14509803921569
218 = -0.14117647058824
219 = -0.13725490196078
220 = -0.13333333333333
221 = -0.12941176470588
222 = -0.12549019607843
223 = -0.12156862745098
224 = -0.11764705882353
225 = -0.11372549019608
226 = -0.10980392156863
227 = -0.10588235294118
228 = -0.10196078431373
229 = -0.098039215686274
230 = -0.094117647058824
231 = -0.090196078431373
232 = -0.086274509803922
233 = -0.082352941176471
234 = -0.07843137254902
235 = -0.074509803921569
236 = -0.070588235294118
237 = -0.066666666666667
238 = -0.062745098039216
239 = -0.058823529411765
240 = -0.054901960784314
241 = -0.050980392156863
242 = -0.047058823529412
243 = -0.043137254901961
244 = -0.03921568627451
245 = -0.035294117647059
246 = -0.031372549019608
247 = -0.027450980392157
248 = -0.023529411764706
249 = -0.019607843137255
250 = -0.015686274509804
251 = -0.011764705882353
252 = -0.0078431372549019
253 = -0.003921568627451
254 = 0
255 = 0.003921568627451
256 = 0.0078431372549019
257 = 0.011764705882353
258 = 0.015686274509804
259 = 0.019607843137255
260 = 0.023529411764706
261 = 0.027450980392157
262 = 0.031372549019608
263 = 0.035294117647059
264 = 0.03921568627451
265 = 0.043137254901961
266 = 0.047058823529412
267 = 0.050980392156863
268 = 0.054901960784314
269 = 0.058823529411765
270 = 0.062745098039216
271 = 0.066666666666667
272 = 0.070588235294118
273 = 0.074509803921569
274 = 0.07843137254902
275 = 0.082352941176471
276 = 0.086274509803921
277 = 0.090196078431372
278 = 0.094117647058824
279 = 0.098039215686275
280 = 0.10196078431373
281 = 0.10588235294118
282 = 0.10980392156863
283 = 0.11372549019608
284 = 0.11764705882353
285 = 0.12156862745098
286 = 0.12549019607843
287 = 0.12941176470588
288 = 0.13333333333333
289 = 0.13725490196078
290 = 0.14117647058824
291 = 0.14509803921569
292 = 0.14901960784314
293 = 0.15294117647059
294 = 0.15686274509804
295 = 0.16078431372549
296 = 0.16470588235294
297 = 0.16862745098039
298 = 0.17254901960784
299 = 0.17647058823529
300 = 0.18039215686275
301 = 0.1843137254902
302 = 0.18823529411765
303 = 0.1921568627451
304 = 0.19607843137255
305 = 0.2
306 = 0.20392156862745
307 = 0.2078431372549
308 = 0.21176470588235
309 = 0.2156862745098
310 = 0.21960784313726
311 = 0.22352941176471
312 = 0.22745098039216
313 = 0.23137254901961
314 = 0.23529411764706
315 = 0.23921568627451
316 = 0.24313725490196
317 = 0.24705882352941
318 = 0.25098039215686
319 = 0.25490196078431
320 = 0.25882352941176
321 = 0.26274509803922
322 = 0.26666666666667
323 = 0.27058823529412
324 = 0.27450980392157
325 = 0.27843137254902
326 = 0.28235294117647
327 = 0.28627450980392
328 = 0.29019607843137
329 = 0.29411764705882
330 = 0.29803921568627
331 = 0.30196078431373
332 = 0.30588235294118
333 = 0.30980392156863
334 = 0.31372549019608
335 = 0.31764705882353
336 = 0.32156862745098
337 = 0.32549019607843
338 = 0.32941176470588
339 = 0.33333333333333
340 = 0.33725490196078
341 = 0.34117647058824
342 = 0.34509803921569
343 = 0.34901960784314
344 = 0.35294117647059
345 = 0.35686274509804
346 = 0.36078431372549
347 = 0.36470588235294
348 = 0.36862745098039
349 = 0.37254901960784
350 = 0.37647058823529
351 = 0.38039215686275
352 = 0.3843137254902
353 = 0.38823529411765
354 = 0.3921568627451
355 = 0.39607843137255
356 = 0.4
357 = 0.40392156862745
358 = 0.4078431372549
359 = 0.41176470588235
360 = 0.4156862745098
361 = 0.41960784313725
362 = 0.42352941176471
363 = 0.42745098039216
364 = 0.43137254901961
365 = 0.43529411764706
366 = 0.43921568627451
367 = 0.44313725490196
368 = 0.44705882352941
369 = 0.45098039215686
370 = 0.45490196078431
371 = 0.45882352941176
372 = 0.46274509803922
373 = 0.46666666666667
374 = 0.47058823529412
375 = 0.47450980392157
376 = 0.47843137254902
377 = 0.48235294117647
378 = 0.48627450980392
379 = 0.49019607843137
380 = 0.49411764705882
381 = 0.49803921568627
382 = 0.50196078431373
383 = 0.50588235294118
384 = 0.50980392156863
385 = 0.51372549019608
386 = 0.51764705882353
387 = 0.52156862745098
388 = 0.52549019607843
389 = 0.52941176470588
390 = 0.53333333333333
391 = 0.53725490196078
392 = 0.54117647058824
393 = 0.54509803921569
394 = 0.54901960784314
395 = 0.55294117647059
396 = 0.55686274509804
397 = 0.56078431372549
398 = 0.56470588235294
399 = 0.56862745098039
400 = 0.57254901960784
401 = 0.57647058823529
402 = 0.58039215686275
403 = 0.5843137254902
404 = 0.58823529411765
405 = 0.5921568627451
406 = 0.59607843137255
407 = 0.6
408 = 0.60392156862745
409 = 0.6078431372549
410 = 0.61176470588235
411 = 0.6156862745098
412 = 0.61960784313725
413 = 0.62352941176471
414 = 0.62745098039216
415 = 0.63137254901961
416 = 0.63529411764706
417 = 0.63921568627451
418 = 0.64313725490196
419 = 0.64705882352941
420 = 0.65098039215686
421 = 0.65490196078431
422 = 0.65882352941176
423 = 0.66274509803922
424 = 0.66666666666667
425 = 0.67058823529412
426 = 0.67450980392157
427 = 0.67843137254902
428 = 0.68235294117647
429 = 0.68627450980392
430 = 0.69019607843137
431 = 0.69411764705882
432 = 0.69803921568627
433 = 0.70196078431373
434 = 0.70588235294118
435 = 0.70980392156863
436 = 0.71372549019608
437 = 0.71764705882353
438 = 0.72156862745098
439 = 0.72549019607843
440 = 0.72941176470588
441 = 0.73333333333333
442 = 0.73725490196078
443 = 0.74117647058824
444 = 0.74509803921569
445 = 0.74901960784314
446 = 0.75294117647059
447 = 0.75686274509804
448 = 0.76078431372549
449 = 0.76470588235294
450 = 0.76862745098039
451 = 0.77254901960784
452 = 0.77647058823529
453 = 0.78039215686274
454 = 0.7843137254902
455 = 0.78823529411765
456 = 0.7921568627451
457 = 0.79607843137255
458 = 0.8
459 = 0.80392156862745
460 = 0.8078431372549
461 = 0.81176470588235
462 = 0.8156862745098
463 = 0.81960784313725
464 = 0.82352941176471
465 = 0.82745098039216
466 = 0.83137254901961
467 = 0.83529411764706
468 = 0.83921568627451
469 = 0.84313725490196
470 = 0.84705882352941
471 = 0.85098039215686
472 = 0.85490196078431
473 = 0.85882352941176
474 = 0.86274509803922
475 = 0.86666666666667
476 = 0.87058823529412
477 = 0.87450980392157
478 = 0.87843137254902
479 = 0.88235294117647
480 = 0.88627450980392
481 = 0.89019607843137
482 = 0.89411764705882
483 = 0.89803921568627
484 = 0.90196078431373
485 = 0.90588235294118
486 = 0.90980392156863
487 = 0.91372549019608
488 = 0.91764705882353
489 = 0.92156862745098
490 = 0.92549019607843
491 = 0.92941176470588
492 = 0.93333333333333
493 = 0.93725490196078
494 = 0.94117647058824
495 = 0.94509803921569
496 = 0.94901960784314
497 = 0.95294117647059
498 = 0.95686274509804
499 = 0.96078431372549
500 = 0.96470588235294
501 = 0.96862745098039
502 = 0.97254901960784
503 = 0.97647058823529
504 = 0.98039215686275
505 = 0.9843137254902
506 = 0.98823529411765
507 = 0.9921568627451
508 = 0.99607843137255
509 = 1
510 = 1.0039215686275
*/
// Three Color Channels as Gray-scale 0-765
for ($i = 0; $i <= 765; $i += 1){
echo $i . ' = ' . ConvertColorToInputFloatRange($i, 255+255+255) . PHP_EOL;
}
/*
0 = -0.99738562091503
1 = -0.99477124183007
2 = -0.9921568627451
3 = -0.98954248366013
4 = -0.98692810457516
5 = -0.9843137254902
6 = -0.98169934640523
7 = -0.97908496732026
8 = -0.97647058823529
9 = -0.97385620915033
10 = -0.97124183006536
11 = -0.96862745098039
12 = -0.96601307189542
13 = -0.96339869281046
14 = -0.96078431372549
15 = -0.95816993464052
16 = -0.95555555555556
17 = -0.95294117647059
18 = -0.95032679738562
19 = -0.94771241830065
20 = -0.94509803921569
21 = -0.94248366013072
22 = -0.93986928104575
23 = -0.93725490196078
24 = -0.93464052287582
25 = -0.93202614379085
26 = -0.92941176470588
27 = -0.92679738562092
28 = -0.92418300653595
29 = -0.92156862745098
30 = -0.91895424836601
31 = -0.91633986928105
32 = -0.91372549019608
33 = -0.91111111111111
34 = -0.90849673202614
35 = -0.90588235294118
36 = -0.90326797385621
37 = -0.90065359477124
38 = -0.89803921568627
39 = -0.89542483660131
40 = -0.89281045751634
41 = -0.89019607843137
42 = -0.88758169934641
43 = -0.88496732026144
44 = -0.88235294117647
45 = -0.8797385620915
46 = -0.87712418300654
47 = -0.87450980392157
48 = -0.8718954248366
49 = -0.86928104575163
50 = -0.86666666666667
51 = -0.8640522875817
52 = -0.86143790849673
53 = -0.85882352941176
54 = -0.8562091503268
55 = -0.85359477124183
56 = -0.85098039215686
57 = -0.8483660130719
58 = -0.84575163398693
59 = -0.84313725490196
60 = -0.84052287581699
61 = -0.83790849673203
62 = -0.83529411764706
63 = -0.83267973856209
64 = -0.83006535947712
65 = -0.82745098039216
66 = -0.82483660130719
67 = -0.82222222222222
68 = -0.81960784313725
69 = -0.81699346405229
70 = -0.81437908496732
71 = -0.81176470588235
72 = -0.80915032679739
73 = -0.80653594771242
74 = -0.80392156862745
75 = -0.80130718954248
76 = -0.79869281045752
77 = -0.79607843137255
78 = -0.79346405228758
79 = -0.79084967320261
80 = -0.78823529411765
81 = -0.78562091503268
82 = -0.78300653594771
83 = -0.78039215686275
84 = -0.77777777777778
85 = -0.77516339869281
86 = -0.77254901960784
87 = -0.76993464052288
88 = -0.76732026143791
89 = -0.76470588235294
90 = -0.76209150326797
91 = -0.75947712418301
92 = -0.75686274509804
93 = -0.75424836601307
94 = -0.7516339869281
95 = -0.74901960784314
96 = -0.74640522875817
97 = -0.7437908496732
98 = -0.74117647058824
99 = -0.73856209150327
100 = -0.7359477124183
101 = -0.73333333333333
102 = -0.73071895424837
103 = -0.7281045751634
104 = -0.72549019607843
105 = -0.72287581699346
106 = -0.7202614379085
107 = -0.71764705882353
108 = -0.71503267973856
109 = -0.71241830065359
110 = -0.70980392156863
111 = -0.70718954248366
112 = -0.70457516339869
113 = -0.70196078431373
114 = -0.69934640522876
115 = -0.69673202614379
116 = -0.69411764705882
117 = -0.69150326797386
118 = -0.68888888888889
119 = -0.68627450980392
120 = -0.68366013071895
121 = -0.68104575163399
122 = -0.67843137254902
123 = -0.67581699346405
124 = -0.67320261437909
125 = -0.67058823529412
126 = -0.66797385620915
127 = -0.66535947712418
128 = -0.66274509803922
129 = -0.66013071895425
130 = -0.65751633986928
131 = -0.65490196078431
132 = -0.65228758169935
133 = -0.64967320261438
134 = -0.64705882352941
135 = -0.64444444444444
136 = -0.64183006535948
137 = -0.63921568627451
138 = -0.63660130718954
139 = -0.63398692810458
140 = -0.63137254901961
141 = -0.62875816993464
142 = -0.62614379084967
143 = -0.62352941176471
144 = -0.62091503267974
145 = -0.61830065359477
146 = -0.6156862745098
147 = -0.61307189542484
148 = -0.61045751633987
149 = -0.6078431372549
150 = -0.60522875816993
151 = -0.60261437908497
152 = -0.6
153 = -0.59738562091503
154 = -0.59477124183007
155 = -0.5921568627451
156 = -0.58954248366013
157 = -0.58692810457516
158 = -0.5843137254902
159 = -0.58169934640523
160 = -0.57908496732026
161 = -0.57647058823529
162 = -0.57385620915033
163 = -0.57124183006536
164 = -0.56862745098039
165 = -0.56601307189542
166 = -0.56339869281046
167 = -0.56078431372549
168 = -0.55816993464052
169 = -0.55555555555556
170 = -0.55294117647059
171 = -0.55032679738562