Example #1
0
 LoTVPoint Rotate(LoTVPoint P)
 {
     LoTVPoint Result = new LoTVPoint((P.X - fxc) * Math.Cos(Alf) - (P.Y - fyc) * Math.Sin(Alf),
     ((P.X - fxc) * Math.Sin(Alf) + (P.Y - fyc) * Math.Cos(Alf)) * Math.Cos(Bet) - (P.Z - fzc) * Math.Sin(Bet),
     ((P.X - fxc) * Math.Sin(Alf) + (P.Y - fyc) * Math.Cos(Alf)) * Math.Sin(Bet) + (P.Z - fzc) * Math.Cos(Bet));
       return Result;
 }
Example #2
0
 public void Parse(string Input)
 {
     double AllX = 0, AllY = 0, AllZ = 0;
       double X, Y, Z;
       string[] Arr = Input.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
       int Length = Arr.Length;
       string[] Row;
       for (int i = 0; i < Length; i++)
       {
     if (Arr[i] != "" && Arr[i][0] != '#')
       switch (Arr[i].Substring(0, 2))
       {
     case "v ":
       Row = Arr[i].Split(null as string[], StringSplitOptions.RemoveEmptyEntries);
       Array.Resize(ref Points, ++PLength);
       X = double.Parse(Row[1], System.Globalization.CultureInfo.InvariantCulture);
       Y = double.Parse(Row[2], System.Globalization.CultureInfo.InvariantCulture);
       Z = double.Parse(Row[3], System.Globalization.CultureInfo.InvariantCulture);
       AllX += X;
       AllY += Y;
       AllZ += Z;
       Points[PLength - 1] = new LoTVPoint(X, Y, Z);
       break;
     case "f ":
       Row = Arr[i].Split(' ');
       string[] Temp;
       int[] F = new int[3];
       for (int k = 1; k <= 3; k++)
       {
         Temp = Row[k].Split('/');
         F[k - 1] = int.Parse(Temp[0]);
       }
       Array.Resize(ref Polygons, ++RLength);
       Polygons[RLength - 1] = new LoTVPolygon(F[0], F[1], F[2]);
       Array.Resize(ref Edges, ELength + 3);
       ELength += 3;
       Edges[ELength - 3] = new LoTVEdge(F[0], F[1]);
       Edges[ELength - 2] = new LoTVEdge(F[1], F[2]);
       Edges[ELength - 1] = new LoTVEdge(F[2], F[0]);
       break;
       }
       }
       Center = new LoTVPoint(AllX / PLength, AllY / PLength, AllZ / PLength);
 }
Example #3
0
 private Point IJ(LoTVPoint P)
 {
     double Xn = (P.X - fxc) * Math.Cos(Alf) - (P.Y - fyc) * Math.Sin(Alf);
       double Yn = ((P.X - fxc) * Math.Sin(Alf) + (P.Y - fyc) * Math.Cos(Alf)) * Math.Cos(Bet) - (P.Z - fzc) * Math.Sin(Bet);
       double Zn = ((P.X - fxc) * Math.Sin(Alf) + (P.Y - fyc) * Math.Cos(Alf)) * Math.Sin(Bet) + (P.Z - fzc) * Math.Cos(Bet);
       //Xn = Xn / (Zn * FA + 1);
       //Yn = Yn / (Zn * FA + 1);
       int X = (int)Math.Round(I2 * (Xn - Xmin) / (Xmax - Xmin));
       int Y = (int)Convert.ToInt32(J2 * (Yn - Ymax) / (Ymin - Ymax));
       return new Point(X, Y);
 }
Example #4
0
 public void GeLoTVPoint(LoTVPoint Input, out double Outx, out double Outy)
 {
     double cos = Math.Cos(Alf);
       double sin = Math.Sin(Alf);
       double x = Input.X;
       double y = Input.Y;
       double z = Input.Z;
       x = (x - x0) * cos - (y - y0) * sin;
       y = ((x - x0) * sin + (y - y0) * cos) * cos - (z - z0) * sin;
       z = ((x - x0) * sin + (y - y0) * cos) * sin + (z - z0) * cos;
       Outx = x / ((z / 0.5) + 1);
       Outy = y / ((z / 0.5) + 1);
 }