X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=test5%2FPsychlopsMain.cs;h=4242429dc6291853d3c36f7202777752ae0eb451;hb=995fc1b91f005c8ca430dd8f2bcca0d676907f06;hp=e69a680907e928b65a738b126b2ef198cfc5d847;hpb=7fe25aa821826f09903fb14def74d6b0376e3b5a;p=psychlops%2Fsilverlight.git diff --git a/test5/PsychlopsMain.cs b/test5/PsychlopsMain.cs index e69a680..4242429 100644 --- a/test5/PsychlopsMain.cs +++ b/test5/PsychlopsMain.cs @@ -1,12 +1,264 @@ -using Psychlops; +// Motion with glass patterns. +// Ross, J., Badcock, D. R., and Hayes, A. (2000) +// Coherent global motion in the absence of coherent velocity signals. +// Current Biology, 10, 679-682. +///+ Prefix +//// Include Psychlops Package +using Psychlops; namespace PsychlopsSilverlightApp { public class PsychlopsMain { + Psychlops.Widgets.Slider distance, duration, stimulus_type; + ///- Prefix + + public void psychlops_main() + { + GlassPattern(); + } + + readonly int DOTNUM = 512; + + ///+ Stimulus drawing function + //// A function for stimulus drawing (main body) + void GlassPattern() { + ///+ Preperation + //// Declare and initialize local variables + Canvas cnvs = new Canvas(400,400); //Prepare drawing window + double dotsize = 2; + double dot_lum = 0.5; + double bg_lum = 0.2; + double fieldsize = 300; + double[] orientation = new double[DOTNUM]; + Rectangle dots = new Rectangle(dotsize, dotsize); + ///+ prepare dots position + //// prepare dots position and paired orientation + Matrix positionmat = Matrix.gen(DOTNUM,2); + //Math.random(positionmat, -0.5*fieldsize, 0.5*fieldsize); + positionmat.each( (v) => Math.random(-0.5*fieldsize, 0.5*fieldsize) ); + + + for(int i=0; i duration) + { + //Math.random(positionmat, -0.5 * fieldsize, 0.5 * fieldsize); + positionmat.each((v) => Math.random(-0.5 * fieldsize, 0.5 * fieldsize)); + for (int i = 0; i < DOTNUM; i++) { orientation[i] = Math.atan2(positionmat[i + 1, 2], positionmat[i + 1, 1]); } + frame = 0; + } + ///- position change + Display.clear(new Color(bg_lum)); //Clear window + + //// Draw DOTNUM pairs of dots + for(int i=0; i