public static Point2D chieuPCoxy(Point3D p, int e) { Point2D q = new Point2D(); q.x = p.x / (1 - p.z / e); q.y = p.y / (1 - p.z / e); return q; }
/// <summary> /// Chieus the S soxy. /// </summary> /// <param name="p">The p.</param> /// <returns></returns> public static Point2D chieuSSoxy(Point3D p) { Point2D q = new Point2D(); q.x = p.x; q.y = p.y; return q; }
public static void MyLine(Point2D p0, Color color, Point2D p1, Point2D p2, Graphics g) { p1.y = p0.y - p1.y; p2.y = p0.y - p2.y; p1.x = p1.x + p0.x; p2.x = p2.x + p0.x; g.DrawLine(new Pen(color), (float)p1.x, (float)p1.y, (float)p2.x, (float)p2.y); }
public Planet(int rTraiDat, int phanHoach, float goc, double phiTraiDat, double tetaTraiDat, Point2D p0, Color colorLine) { this.banKinh = rTraiDat; this.phanHoach = phanHoach; this.gocQuay = goc; this.gocPhi = phiTraiDat; this.gocTeta = tetaTraiDat; this.colorLine = colorLine; }
public Earth(Point2D p0) : base() { base.gocToaDo = p0; base.gocQuay = (float)(5 * Math.PI / 180); base.phanHoach = 25; base.gocPhi = -1; base.gocTeta = -1.3; base.banKinh = 70; base.colorLine = Color.Blue; InitWireframe(); }
public Sun(Point2D p0) : base() { base.gocToaDo = p0; base.gocQuay = (float)(5 * Math.PI / 180); base.phanHoach = 25; base.gocPhi = -0.7; base.gocTeta = -1.5555; base.banKinh = 90; base.colorLine = Color.OrangeRed; InitWireframe(); }
public static void veSS_viewxyMT(Graphics graphics,B_Rep w, double phiMatTroi, double tetaMatTroi,Point2D p0, Color color) { int j; var p1 = new Point2D(); var p2 = new Point2D(); for (int i = 0; i < w.nPoly - 2; i++) { if (w.poly[i].Visible == 1) { for (j = 0; j < w.poly[i].NVert - 1; j++) { Point3D p13D = w.vert[w.poly[i].Vertexes[j]]; DoiHeToaDo(ref p13D, 200, phiMatTroi, tetaMatTroi); p1.x = p13D.x; p1.y = p13D.y; //p1 = this.chieuPCoxy(p13D, 500); Point3D p23D = w.vert[w.poly[i].Vertexes[j + 1]]; DoiHeToaDo(ref p23D, 200, phiMatTroi, tetaMatTroi); p2.x = p23D.x; p2.y = p23D.y; //p2 = this.chieuPCoxy(p23D, 500); //MyLine(p1, p2, this.graphics); MyLine(p0, color, p1, p2, graphics); } Point3D p113D = w.vert[w.poly[i].Vertexes[0]]; DoiHeToaDo(ref p113D, 200, phiMatTroi, tetaMatTroi); p1.x = p113D.x; p1.y = p113D.y; Point3D p123D = w.vert[w.poly[i].Vertexes[j]]; DoiHeToaDo(ref p123D, 200, phiMatTroi, tetaMatTroi); p2.x = p123D.x; p2.y = p123D.y; MyLine(p0, color, p1, p2, graphics); } } }
/// <summary> /// Initializes this instance. /// </summary> private void Initialize() { Rectangle rec = this.ClientRectangle; this.bitmap = new Bitmap(rec.Width, rec.Height); this.graphics = Graphics.FromImage(this.bitmap); this.graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Point2D p0 = new Point2D(); p0.x = this.ClientSize.Width / 2 ; p0.y = this.ClientSize.Height / 2 ; earth = new Earth(p0); sun = new Sun(p0); orbit = new Orbit(p0); orbit.Draw(this.graphics); earth.Draw(this.graphics); sun.Draw(this.graphics); }