-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_convert.cpp
More file actions
73 lines (69 loc) · 1.66 KB
/
test_convert.cpp
File metadata and controls
73 lines (69 loc) · 1.66 KB
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
#include <iostream>
#include "pixel_helper.hpp"
#include "converter.hpp"
using std::cout;
using std::endl;
using namespace ORGB;
int main()
{
{
Pixel p;
p.x = p.y = p.z = 10;
auto rgb = to_RGB_point(p);
//cout<<rgb<<endl;
auto lcc = RGB_to_LCC(rgb);
//cout<<lcc<<endl;
rgb = LCC_to_RGB(lcc);
//cout<<rgb<<endl;
auto ip = to_Pixel(rgb);
//cout<<ip<<endl;
assert(p == ip);
}
{
Pixel p;
p.x = p.y = p.z = 10;
auto rgb = to_RGB_point(p);
auto lcc = RGB_to_LCC(rgb);
auto orgb = LCC_to_ORGB(lcc);
lcc = ORGB_to_LCC(orgb);
rgb = LCC_to_RGB(lcc);
auto ip = to_Pixel(rgb);
assert(p == ip);
}
{
Point2D origin{0.745098,0};
Point2D res = rotate(0, origin);
assert(round(origin) == round(res));
}
{
Point2D origin{0.745098,1};
Point2D res = rotate(1, origin);
Point2D iorigin = rotate(-1, res);
assert(round(origin) == round(iorigin));
}
{
Pixel p;
p.x = 10;
p.y = p.z = 200;
auto rgb = to_RGB_point(p);
auto lcc = RGB_to_LCC(rgb);
auto orgb = LCC_to_ORGB(lcc);
lcc = ORGB_to_LCC(orgb);
rgb = LCC_to_RGB(lcc);
auto ip = to_Pixel(rgb);
assert(p == ip);
}
{
Pixel p;
p.x = 10;
p.y = 200;
p.z = 255;
auto rgb = to_RGB_point(p);
auto lcc = RGB_to_LCC(rgb);
auto orgb = LCC_to_ORGB(lcc);
lcc = ORGB_to_LCC(orgb);
rgb = LCC_to_RGB(lcc);
auto ip = to_Pixel(rgb);
assert(p == ip);
}
}