public TestTriangle(int Width, int Height, int Depth, Math3D.Point3D origin) : base(Width, Height, Depth, origin) { width = Width; height = Height; depth = Depth; Origin = new Math3D.Point3D(origin.X - width / 2, origin.Y - height / 2, origin.Z); }
public Pyramid(int Width, int Height, int Depth, Math3D.Point3D origin) : base(Width, Height, Depth, origin) { width = Width; height = Height; depth = Depth; Origin = new Math3D.Point3D(origin.X, origin.Y, 0); }
public TestTriangle(int side, Math3D.Point3D origin) : base(side, origin) { width = side; height = side; depth = side; Origin = new Math3D.Point3D(origin.X - width / 2, origin.Y - height / 2, origin.Z); }
public Image render(Size screen, Math3D.Point3D point3D) { //Set the rotation values Bitmap img = new Bitmap(screen.Width, screen.Height); Graphics g = Graphics.FromImage(img); _matrix = new Tuple <double, Pen> [screen.Width, screen.Height]; foreach (var figure in figures) { figure.Polyhedron.RotateX = point3D.X; figure.Polyhedron.RotateY = point3D.Y; figure.Polyhedron.RotateZ = point3D.Z; figure.Polyhedron.Calculate(figure.DrawingOrigin, _matrix); } for (int i = 0; i < screen.Width; i++) { for (int j = 0; j < screen.Height; j++) { if (_matrix[i, j] != null) { g.DrawEllipse(_matrix[i, j].Item2, new Rectangle(i, j, 1, 1)); } } } g.Dispose(); //Clean-up return(img); }
public Pyramid(int side, Math3D.Point3D origin) : base(side, origin) { width = side; height = side; depth = side; Origin = new Math3D.Point3D(origin.X, origin.Y, 0); }
private Polyhedron[] polyhedrons(int size, Math3D.Point3D origin) => new Polyhedron[] { new TestTriangle(size, origin), new TestCube(size, origin), new Pyramid(size, origin), new Cube(size, origin), new SandClock(size, origin) };
public static Surface[] Translate(Surface[] surfaces, Math3D.Point3D oldOrigin, Math3D.Point3D newOrigin) { foreach (var surface in surfaces) { surface.points = Math3D.Translate(surface.points, oldOrigin, newOrigin); } return(surfaces); }
private void Form1_Shown(object sender, EventArgs e) { OriginPoints = new Math3D.Point3D(pictureBoxMain.Width / 2, pictureBoxMain.Height / 2, 0); _controlsLink = new List <Tuple <NumericUpDown, TrackBar> > { new Tuple <NumericUpDown, TrackBar>(numericUpDownX, tX), new Tuple <NumericUpDown, TrackBar>(numericUpDownY, tY), new Tuple <NumericUpDown, TrackBar>(numericUpDownZ, tZ) }; FigureSizeDefault = pictureBoxMain.Height / 3; DrawOriginDefault = new Point(pictureBoxMain.Width / 2, pictureBoxMain.Height / 2); timer1.Start(); }
private void Form1_Shown(object sender, EventArgs e) { OriginPoints = new Math3D.Point3D(pictureBoxMain.Width / 2, pictureBoxMain.Height / 2, 0); foreach (var polyhedron in polyhedrons(FigureSizeDefault, OriginPoints)) { toolStripComboBox1.Items.Add(polyhedron.Name); } _controlsLink = new List <Tuple <NumericUpDown, TrackBar> > { new Tuple <NumericUpDown, TrackBar>(numericUpDownX, tX), new Tuple <NumericUpDown, TrackBar>(numericUpDownY, tY), new Tuple <NumericUpDown, TrackBar>(numericUpDownZ, tZ) }; FigureSizeDefault = pictureBoxMain.Height / 3; DrawOriginDefault = new Point(pictureBoxMain.Width / 2, pictureBoxMain.Height / 2); figures = new List <Figure>() { new Figure(new SandClock(FigureSizeDefault, OriginPoints), DrawOriginDefault) }; timer1.Start(); contextMenuStripFigures_Closing(this, null); }
private Polyhedron[] polyhedrons(int size, Math3D.Point3D origin) => new Polyhedron[] { new Pyramid(size, origin), new Cube(size, origin), };