Example #1
0
 public static void DoiHeToaDo(ref Point3D p1, float R, double phi, double teta)
 {
     double x = p1.x, y = p1.y, z = p1.z;
     p1.x = Math.Round(-x * Math.Sin(teta) + y * Math.Cos(teta));
     p1.y = Math.Round(-x * Math.Cos(teta) * Math.Sin(phi) - y * Math.Sin(teta) * Math.Sin(phi) + z * Math.Cos(phi));
     p1.z = Math.Round(-x * Math.Cos(teta) * Math.Cos(phi) - y * Math.Sin(teta) * Math.Cos(phi) - z * Math.Sin(phi) + R);
 }
Example #2
0
 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;
 }
Example #3
0
 /// <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;
 }
Example #4
0
        public static void tinhPhapVector(ref B_Rep w, double phiTraiDat, double tetaTraiDat)
        {
            Point3D p1 = new Point3D();
            Point3D p2 = new Point3D();
            Point3D p3 = new Point3D();
            Vector n = new Vector();

            for (int i = 0; i < w.nPoly - 2; i++)
            {

                p1 = w.vert[w.poly[i].Vertexes[0]];
                p2 = w.vert[w.poly[i].Vertexes[1]];
                p3 = w.vert[w.poly[i].Vertexes[2]];

                DoiHeToaDo(ref p1, 200, phiTraiDat, tetaTraiDat);
                DoiHeToaDo(ref p2, 200, phiTraiDat, tetaTraiDat);
                DoiHeToaDo(ref p3, 200, phiTraiDat, tetaTraiDat);

                n.x = p1.y * (p2.z - p3.z) + p2.y * (p3.z - p1.z) + p3.y * (p1.z - p2.z);
                n.y = p1.z * (p2.x - p3.x) + p2.z * (p3.x - p1.x) + p3.z * (p1.x - p2.x);
                n.z = p1.x * (p2.y - p3.y) + p2.x * (p3.y - p1.y) + p3.x * (p1.y - p2.y);
                w.poly[i].PVector = n;
            }
        }
Example #5
0
 /// <summary>
 /// Xoays the diem OZ.
 /// </summary>
 /// <param name="p">The p.</param>
 /// <param name="a">A.</param>
 /// <returns></returns>
 public static Point3D xoayDiemOZ(Point3D p, float a)
 {
     Point3D q = new Point3D();
     q.x = p.x * Math.Cos(a) - p.y * Math.Sin(a);
     q.y = p.x * Math.Sin(a) + p.y * Math.Cos(a);
     q.z = p.z;
     return q;
 }