Esempio n. 1
0
        void sphere(double r, int nx, int ny, int X, int Y, int Z, PointType pointType)
        {
            int    ix, iy;
            double x = X, y = Y, z = Z;

            for (iy = 0; iy < ny; ++iy)
            {
                GL.Begin(BeginMode.QuadStrip);
                if (pointType.Equals(PointType.StartPoint))
                {
                    GL.Color3(Color.Blue);
                }
                else
                {
                    GL.Color3(Color.Orange);
                }
                for (ix = 0; ix <= nx; ++ix)
                {
                    x = X + r * Math.Sin(iy * Math.PI / ny) * Math.Cos(2 * ix * Math.PI / nx);
                    y = Y + r * Math.Sin(iy * Math.PI / ny) * Math.Sin(2 * ix * Math.PI / nx);
                    z = Z + r * Math.Cos(iy * Math.PI / ny);
                    GL.Normal3(x, y, z);//нормаль направлена от центра
                    GL.TexCoord2((double)ix / (double)nx, (double)iy / (double)ny);
                    GL.Vertex3(x, y, z);

                    x = X + r * Math.Sin((iy + 1) * Math.PI / ny) * Math.Cos(2 * ix * Math.PI / nx);
                    y = Y + r * Math.Sin((iy + 1) * Math.PI / ny) * Math.Sin(2 * ix * Math.PI / nx);
                    z = Z + r * Math.Cos((iy + 1) * Math.PI / ny);
                    GL.Normal3(x, y, z);
                    GL.TexCoord2((double)ix / (double)nx, (double)(iy + 1) / (double)ny);
                    GL.Vertex3(x, y, z);
                }
                GL.End();
            }
        }
Esempio n. 2
0
 public static void Equal(PointType expected, PointType actual, int precision)
 {
     if (!expected.Equals(actual, precision))
     {
         throw new EqualException(
                   string.Format(CultureInfo.CurrentCulture, "Expected : {0}", expected.ToString("F" + precision)),
                   string.Format(CultureInfo.CurrentCulture, "Actual : {0}", actual.ToString("F" + precision))
                   );
     }
 }
Esempio n. 3
0
        public override bool Equals(object obj)
        {
            var other = obj as IntervalType;

            return(other != null && PointType.Equals(other.PointType));
        }