X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test4%2FStore.cs;fp=test4%2FStore.cs;h=d77d038c6ef0009375304fb2009c488a41fa6af4;hb=c778254ba66748949fba1e807aec154cdf5dadf1;hp=e319002a31f6a4322f42fe7620720101b11ae4e6;hpb=892d07a825dbe4e84ee7f3e480ece30d1f97a4d8;p=psychlops%2Fsilverlight.git diff --git a/test4/Store.cs b/test4/Store.cs index e319002..d77d038 100644 --- a/test4/Store.cs +++ b/test4/Store.cs @@ -39,6 +39,243 @@ namespace PsychlopsSilverlight4test +/* +using Psychlops; + +namespace PsychlopsSilverlightApp +{ + + public class PsychlopsMain + { + + Psychlops.Widgets.Slider rect_size, freq, contrast; + + void PositionalBiasisInMovingGabor() + { + double vel = 30.0; + double StimWidth = 120; + + Interval rng = new Interval(); + Psychlops.Widgets.Slider rect_size, freq, contrast; + rect_size = new Psychlops.Widgets.Slider("Rect Size", 1 < rng < 500, 120.0); + freq = new Psychlops.Widgets.Slider("Sptial Frequency", 0.0 <= rng <= 1.0, 0.125); + contrast = new Psychlops.Widgets.Slider("Contrast", 0.0 <= rng <= 1.0, 0.1); + + int IMAGES = (int)vel; + + Image[] GaborIMG = new Image[200]; + for (int i = 0; i < 200; i++) GaborIMG[i] = new Image(); + + Color clrcol = new Color(), clrFP = new Color(); + Display.clear(0.5); + clrcol.set(128.0 / 255.0); + clrFP.set(128.0 / 255.0, 0.0, 0.0); + + int phase = 0; + double distance = rect_size; + bool changed = true, stop = false; + double prev_contrast = 0.0, prev_freq = 0.0, prev_size = 0.0; + + while (!Keyboard.esc.pushed()) + { + Display.clear(); + + if (prev_contrast != contrast || prev_freq != freq || prev_size != rect_size) changed = true; + prev_contrast = contrast; + prev_freq = freq; + prev_size = rect_size; + if (changed) + { + for (int i = 0; i < 2; i++) + { + for (int j = 0; j < IMAGES; j++) + { + Figures.drawGabor(ref GaborIMG[i * IMAGES + j], rect_size / 8.0, freq, contrast, Math.PI * 0.5, 2.0 * Math.PI * j / IMAGES); + distance = rect_size; + } + } + changed = false; + } + + if (!stop) + { + Display.clear(127.0 / 255.0); + for (int i = 0; i < 3; i++) + { + switch (i) + { + case 0: + GaborIMG[IMAGES - phase - 1].centering().shift(0, -distance); + GaborIMG[IMAGES - phase - 1].draw(); break; + case 1: + GaborIMG[phase].centering().shift(0, 0); + GaborIMG[phase].draw(); break; + case 2: + GaborIMG[IMAGES - phase - 1].centering().shift(0, +distance); + GaborIMG[IMAGES - phase - 1].draw(); break; + } + } + } + if (Keyboard.spc.pushed()) stop = !stop; + //GaborIMG[0].draw(); + + phase++; + phase %= IMAGES; + //if (!stop) Display.flip(); + Display.flip(); + + } + + } + + + public void psychlops_main() + { + + Canvas display = new Canvas(Canvas.window); + + PositionalBiasisInMovingGabor(); + + } + + + + } + +} + */ +/* + * + * using Psychlops; + +namespace PsychlopsSilverlightApp +{ + + public class PsychlopsMain + { + + Psychlops.Canvas cnvs; + int i; + double x, y, z, t, p, temp, xx, yy; + + //Set Target Initial Value + double TargetEcce = 100.0, TargetSize = 5.0, TargetNumber = 5, Rotate = 0.0; + + //Set Background Initial Value + double Axis = 0.0, BGRadii = 150, BGSize = 5.0; + Psychlops.Widgets.Slider thetaSpeed, DotNumber; + Image img; + + + + public void psychlops_main() + { + + cnvs = new Canvas(500, 500); + +// Psychlops.Solver.BinomialLikelihood.showWindow(Math.cumulativeNormalDistibution); +// img = new Image("Resources/logo.png"); + + Interval rng = new Interval(); + thetaSpeed = new Psychlops.Widgets.Slider("Label", -10 <= rng <= 10, 3.0); + DotNumber = new Psychlops.Widgets.Slider("DotNum", 0 <= rng <= 100, 50.0); + + //Declare background dots and target + Rectangle[] BGDot = new Rectangle[2048]; + for (int i = 0; i < 2048; i++) + { + BGDot[i]=new Rectangle(); + } + Rectangle[] Target= new Rectangle[10]; + for(int i=0; i<10; i++){ + Target[i]=new Rectangle(); + } + + + + //Declare Matrix to keep back ground dots' coordinate value + double[] DotX=new double[2048]; + double[] DotY = new double[2048]; + + AppState.statusBar = "dvcscxz"; + //Set Independent variables to manipulate + + + //Initialize positions of background dots + for(int i=0; i<2048; i++){ + t=2.0*Math.PI*Math.random(1.0); + p=2.0*Math.PI*Math.random(1.0); + DotX[i]=t; + DotY[i]=p; + + x=BGRadii*Math.cos(t)*Math.cos(p); + y=BGRadii*Math.sin(t)*Math.cos(p); + BGDot[i].set(BGSize, BGSize); + BGDot[i].centering().shift(x,y); + } + + //Initialize positions of targets + for(int i=0; i<10; i++)Target[i].set(TargetSize, TargetSize); + + double COS, SIN; + //DotNumber = 200; + //Main stimulus loop + while(true){ + //Clear the main window + cnvs.clear(); + + + temp=Axis/360*2*Math.PI; + COS=Math.cos(temp); + SIN=Math.sin(temp); + + //Calculate positions of background dots and set them + for(int i=0; i