#include <psychlops.h>
using namespace Psychlops;

Psychlops::Point p1;
Psychlops::Color col1;
double width=200;
double height=100;
double lambda=60;
double lmean=0.25, contrast=0.5, theta=0;
double xx,yy;
double orientation=45*PI/180;
	
//交差する縞の情報
double lambda2=45;
double lmean2=0.25, contrast2=0.25, theta2=0;
double xx2,yy2;
double orientation2=135*PI/180;

void psychlops_main() {

	Canvas sampleA(Canvas::fullscreen);
	
	for(int i=0;i<width;i++){
		for(int j=0;j<height;j++){
			//回転
			xx=cos(orientation)*i-sin(orientation)*j;
			yy=sin(orientation)*i+cos(orientation)*j;
			xx2=cos(orientation2)*i-sin(orientation2)*j;
			yy2=sin(orientation2)*i+cos(orientation2)*j;
			
			col1.set( lmean*(1+contrast*sin(theta+(2*PI*yy/lambda)))+
						 lmean2*(1+contrast2*sin(theta2+(2*PI*yy2/lambda2)))
					  );
			p1.centering().shift((double)-1/2*width+i,(double)-1/2*height+j);
			sampleA.pix(p1,col1);
		}
	}
	sampleA.flip();
	while(!Input::get(Keyboard::spc));
}