// wenn aktuelles feld weiß ist, dann rot färben - nach links drehen und eins vorwärts // wenn aktuelles feld rot, dann weiß färben - nach rechts drehen und eins vorwärts private void Aufgabe() { flow.StepCount = 1000; for (int iAnt = 0; iAnt < arrAnts.Length; iAnt++) { strAnt = GLabReader.ReadAntFromFile(arrAnts[iAnt]); AnzahlZustaende = strAnt.Length; arrZustand = new int[ImageWidth, ImageHeight]; _image = new Image <Rgb, byte>(ImageWidth, ImageHeight, new Rgb(Color.White)); _frame.SetImage(_image); ant1.iZustand = 0; ant1.iCurrX = (ImageWidth - 1) / 2; ant1.iCurrY = (ImageHeight - 1) / 2; for (int i = 0; i < 10000000; i++) { if (i % 1000 == 0) { _frame.Repaint(); Logger.Instance.LogInfo("" + i); } //for (Int64 ix = 0; ix < 10000; ix++) { } flow.Wait(); ant1 = doStep(ant1); ant2 = doStep(ant2); } } }
public override void Setup() { _coord = new CoordinateSystem(-0, ImageWidth, 0, ImageHeight); // Init. a new random number generator _rand = new Random(); // Create a new raster image for drawing _image = new Image <Rgb, byte>(ImageWidth, ImageHeight, new Rgb(Color.White)); // Painter initialisieren mit neuem Koordinatensystem _painter = new Painter(ref _image); // Create a new frame to display the raster image _frame = new FrmImage(Name, ImageWidth + 1, ImageHeight + 1, DisplayMode.Zoomable) { InterpolationMode = InterpolationMode.NearestNeighbor, SmoothingMode = SmoothingMode.None }; _frame.SetImage(_image); // Register the click event handler _frame.PictureBox.MouseClick += addAnt2; // Register this plugin as a GUI extension GLabController.Instance.RegisterExtension(this); palAnt = GLabReader.ReadPaletteFromFile("..\\..\\Ants\\Chaos_ant.pal"); Aufgabe(); }
public override void Setup() { // Init. a new random number generator _rand = new Random(); // Create a new raster image for drawing _image = new Image <Rgb, byte>(ImageWidth, ImageHeight, new Rgb(Color.White)); // Painter initialisieren _painter = new Painter(ref _image); // Reader initialisieren _palette = GLabReader.ReadPaletteFromFile("Multcol4.pal"); // Create a new frame to display the raster image _frame = new FrmImage(Name, _image, DisplayMode.Zoomable) { InterpolationMode = InterpolationMode.NearestNeighbor, SmoothingMode = SmoothingMode.None }; _frame.SetImage(_image); // Register the click event handler _frame.PictureBox.MouseClick += DrawDot; //Inform user about possibility to draw dots with the mouse Logger.Instance.LogInfo(""); // Register this plugin as a GUI extension GLabController.Instance.RegisterExtension(this); // Additional setup of your plugin Aufgabe(); }
private void drawAufgabeFromDot(object sender, MouseEventArgs e) { float iX, iY; string strIFS = ""; iX = (e.X * (_coord.MaxX - _coord.MinX)) / (float)ImageWidth + _coord.MinX; iY = (e.Y * (_coord.MaxY - _coord.MinY)) / (float)ImageHeight + _coord.MinY; // IFS laden switch (iKlicks) { case 0: strIFS = "Farn_1.IFS"; break; case 1: strIFS = "Bigbang.IFS"; break; case 2: strIFS = "Filmstreifen.IFS"; break; case 3: strIFS = "Strauch.IFS"; break; case 4: strIFS = "Swirl.IFS"; break; case 5: strIFS = "Wirbel_blatt.IFS"; break; default: strIFS = "Farn_1.IFS"; iKlicks = 0; break; } iKlicks++; _ifs = GLabReader.ReadIfsFromFile("..\\..\\IFS2\\" + strIFS); Logger.Instance.LogInfo("IFS:\t" + strIFS); readIfsProbabilities(); // Create a new raster image for drawing _image = new Image <Rgb, byte>(MAX_COORDINATE, MAX_COORDINATE, new Rgb(Color.Black)); // Painter initialisieren mit neuem Koordinatensystem _coord = new CoordinateSystem(_ifs.CoordinateSystem.MinX, _ifs.CoordinateSystem.MaxX, _ifs.CoordinateSystem.MinY, _ifs.CoordinateSystem.MaxY); _painter = new Painter(ref _image, _coord); _frame.SetImage(_image); _painter.PaintCoordinateSystem(16, Color.Red); // Punkt zeichnen Aufgabe(new Vector3(iX, iY, 1)); }
private void drawAufgabeFromDot(object sender, MouseEventArgs e) { float iX, iY; string strIFS = ""; iX = (e.X * (_coord.MaxX - _coord.MinX)) / (float)ImageWidth + _coord.MinX; iY = (e.Y * (_coord.MaxY - _coord.MinY)) / (float)ImageHeight + _coord.MinY; // IFS laden switch (iKlicks) { default: strIFS = "IFS_TEST_Invers.IFS"; iKlicks = 0; break; } iKlicks++; _ifs = GLabReader.ReadIfsFromFile("..\\..\\IFS5\\" + strIFS); //test = Microsoft.Xna.Framework.Matrix.Invert(_ifs[0]); //test = Microsoft.Xna.Framework.Matrix.Invert(_ifs[1]); //test = Microsoft.Xna.Framework.Matrix.Invert(_ifs[2]); Logger.Instance.LogInfo("IFS:\t" + strIFS); //readIfsProbabilities(); // Create a new raster image for drawing _image = new Image <Rgb, byte>(ImageWidth, ImageHeight, new Rgb(Color.White)); // Painter initialisieren mit neuem Koordinatensystem _coord = new CoordinateSystem(_ifs.CoordinateSystem.MinX, _ifs.CoordinateSystem.MaxX, _ifs.CoordinateSystem.MinY, _ifs.CoordinateSystem.MaxY); _painter = new Painter(ref _image, _coord); _frame.SetImage(_image); _painter.PaintCoordinateSystem(16, Color.Red); // Punkt zeichnen Aufgabe(); }
/// <summary> /// Setup the example. /// </summary> public override void Setup() { _scene = new Scene(); _rand = new Random(); _contentManager = new ContentManager(XnaRenderer.Instance.Services, GLabController.Instance.HomeDirectory + "\\Data\\FractalTerrain"); _psf = new PlatonicSolidFactory(XnaRenderer.Instance); _matrixStack = new MatrixStack(); filename = InputHelper.LoadFileDialog("Load LIN-File"); if (filename == "") { return; } _lindenmayerSystem = GLabReader.ReadLindenmayerSystemFromFile(filename); if (filename.Contains("1_")) { _pos = new Vector3(0, 0, Math.Abs(_lindenmayerSystem.CoordinateSystem.MaxX) + Math.Abs(_lindenmayerSystem.CoordinateSystem.MinX)); } if (filename.Contains("2_")) { _pos = new Vector3(0, 0, 3); } if (filename.Contains("3_")) { _pos = new Vector3(3, 5, 3); } flow = new FrmFlowControl(); // Breite und Länge initialisieren _vecStart = new Vector3(0, 0, 0); Vector3 pos = _pos; // new Vector3(0, 0, 5); Vector3 lookAt = Vector3.Zero; Vector3 up = Vector3.UnitY; //_polarCamera = new PolarCamera(); //_polarCamera.SetLookAt(pos, lookAt, up); //_polarCamera.ActivateControl(); //_polarCamView = new RenderView(512, 512, _scene, _polarCamera, // "Polar Camera"); //Logger.Instance.LogInfo( // "Controls (Polar Camera): <W>, <A>, <S>, <D>, <Q>, <E> and mouse movement (while left or right clicking)."); _flyCamera = new FlyCamera(); _flyCamera.ActivateControl(); _flyCamera.SetLookAt(pos, lookAt, up); _flyCamera.Movement = 0.2f; _flyCamView = new RenderView(256, 256, _scene, _flyCamera, "Fly Camera"); Logger.Instance.LogInfo( "Controls (Fly Camera): <W>, <A>, <S>, <D>, <Q>, <E> and mouse movement (while left clicking). Use <R> to reset the camera to the initial position."); //XnaRenderer.Instance.Views.Add(_polarCamView); XnaRenderer.Instance.Views.Add(_flyCamView); Start(); _scene.RenderCoordinateAxes = false; flow.StepCount = 1; currentAxiom = _lindenmayerSystem.Axiom; int iStep = 11; while (true) { iStep++; nextGeneration(_scene, 0, iStep, currentAxiom); flow.Wait(); Logger.Instance.LogInfo("" + iStep); } }
private void drawAufgabeFromDot(object sender, MouseEventArgs e) { float iX, iY; string strIFS = ""; iX = (e.X * (_coord.MaxX - _coord.MinX)) / (float)ImageWidth + _coord.MinX; iY = (e.Y * (_coord.MaxY - _coord.MinY)) / (float)ImageHeight + _coord.MinY; // IFS laden switch (iKlicks) { case 0: strIFS = "Sierpinski.IFS"; break; case 1: strIFS = "Drachenflaeche_4.IFS"; break; case 2: strIFS = "Duerer_5_eck.IFS"; break; case 3: strIFS = "Farn_1.IFS"; break; case 4: strIFS = "Kristall_1.IFS"; break; case 5: strIFS = "Menger_teppich.IFS"; break; case 6: strIFS = "Sierp_verwandter_1.IFS"; break; default: strIFS = "Sierpinski.IFS"; iKlicks = 0; break; } iKlicks++; _ifs = GLabReader.ReadIfsFromFile("..\\..\\IFS\\" + strIFS); Logger.Instance.LogInfo("IFS:\t" + strIFS); // Create a new raster image for drawing _image = new Image <Rgb, byte>(MAX_COORDINATE, MAX_COORDINATE, new Rgb(Color.Black)); // Painter initialisieren mit neuem Koordinatensystem _coord = new CoordinateSystem(_ifs.CoordinateSystem.MinX, _ifs.CoordinateSystem.MaxX, _ifs.CoordinateSystem.MinY, _ifs.CoordinateSystem.MaxY); _painter = new Painter(ref _image, _coord); _frame.SetImage(_image); _painter.PaintCoordinateSystem(16, Color.Red); // Punkt zeichnen Aufgabe(new Vector3(iX, iY, 1)); }