#include <psychlops.h>
using namespace Psychlops;

Psychlops::Point p1;
Psychlops::Color col1;
double width=200;
double height=100;
double lambda=60;
double lmean=0.5, contrast=1.0, theta=0;
double xx,yy;
double orientation;

//交差する縞の情報
double lambda2=45;
double lmean2=0.8, contrast2=0.3, theta2=0;
double xx2,yy2;
double orientation2;

void psychlops_main() {

	Canvas sampleA(Canvas::fullscreen);
	orientation=45*PI/180;
	orientation2=70*PI/180;
	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*((contrast*sin((2*PI*xx/lambda)+theta))+1))+(lmean2*((contrast2*sin((2*PI*xx/lambda2)+theta2))+1)));
			p1.centering().shift((double)-1/2*width+i,(double)-1/2*height+j);
			sampleA.pix(p1,col1);
		}
	}
	sampleA.flip();
	while(!Input::get(Keyboard::spc));
}