OSDN Git Service

hk
[psychlops/cpp_document.git] / Psychlops.manual / sample_cpp_file / 2�� / 2.2.7_�Ȃ̕`��(point)3.cpp
1 #include <psychlops.h>\r
2 using namespace Psychlops;\r
3 \r
4 Psychlops::Point p1;\r
5 Psychlops::Color col1;\r
6 double width=200;\r
7 double height=100;\r
8 double lambda=60;\r
9 double lmean=0.25, contrast=0.5, theta=0;\r
10 double xx,yy;\r
11 double orientation=45*PI/180;\r
12         \r
13 //\8cð\8d·\82·\82é\8eÈ\82Ì\8fî\95ñ\r
14 double lambda2=45;\r
15 double lmean2=0.25, contrast2=0.25, theta2=0;\r
16 double xx2,yy2;\r
17 double orientation2=135*PI/180;\r
18 \r
19 void psychlops_main() {\r
20 \r
21         Canvas sampleA(Canvas::fullscreen);\r
22         \r
23         for(int i=0;i<width;i++){\r
24                 for(int j=0;j<height;j++){\r
25                         //\89ñ\93]\r
26                         xx=cos(orientation)*i-sin(orientation)*j;\r
27                         yy=sin(orientation)*i+cos(orientation)*j;\r
28                         xx2=cos(orientation2)*i-sin(orientation2)*j;\r
29                         yy2=sin(orientation2)*i+cos(orientation2)*j;\r
30                         \r
31                         col1.set( lmean*(1+contrast*sin(theta+(2*PI*yy/lambda)))+\r
32                                                  lmean2*(1+contrast2*sin(theta2+(2*PI*yy2/lambda2)))\r
33                                           );\r
34                         p1.centering().shift((double)-1/2*width+i,(double)-1/2*height+j);\r
35                         sampleA.pix(p1,col1);\r
36                 }\r
37         }\r
38         sampleA.flip();\r
39         while(!Input::get(Keyboard::spc));\r
40 }