예제 #1
0
        private static void SaveToBmp(List <Circle3D> projected)
        {
            int        size  = 2000;
            Bitmap     image = new Bitmap(size, size);
            double     b     = 5.0;
            ImageSpace i     = new ImageSpace(size, size);

            i.XMin = -b;
            i.XMax = b;
            i.YMin = -b;
            i.YMax = b;

            float scale = 0.5f;

            using (Graphics g = Graphics.FromImage(image))
            {
                for (int m = 0; m < projected.Count; m++)
                {
                    using (Pen p = new Pen(projected[m].Color, scale * 3.0f))
                    {
                        Circle c = projected[m].ToFlatCircle();
                        if (c.IsLine)
                        {
                            DrawUtils.DrawLine(-c.P2 * 25, c.P2 * 25, g, i, p);                                 // XXX - not general.
                        }
                        else
                        {
                            DrawUtils.DrawCircle(c, g, i, p);
                        }
                    }
                }
            }

            image.Save("outerCircles.png");
        }
예제 #2
0
        private void DrawMirrors(Bitmap image, Settings settings)
        {
            double     b = settings.Bounds;
            ImageSpace i = new ImageSpace(settings.Width, settings.Height);

            i.XMin = -b; i.XMax = b;
            i.YMin = -b; i.YMax = b;

            float scale = 2;

            List <Sphere> toDraw = new List <Sphere>();

            toDraw.AddRange(settings.Mirrors);
            //toDraw.Add( AlteredFacetForTrueApparent2DTilings( settings.Mirrors ) );

            using (Graphics g = Graphics.FromImage(image))
                using (Pen p = new Pen(Color.Red, scale * 3.0f))
                    //using( Pen p2 = new Pen( Color.FromArgb( 255, 255, 214, 0 ), 3.0f ) )
                    using (Pen p2 = new Pen(Color.Orange, scale * 3.0f))
                        using (Pen p3 = new Pen(Color.Orange, scale * 3.0f))
                            for (int m = 0; m < toDraw.Count; m++)
                            {
                                Sphere s = toDraw[m];
                                Circle c = H3Models.UHS.IdealCircle(s);         // XXX - not correct
                                if (c.IsLine)
                                {
                                    DrawUtils.DrawLine(-c.P2 * 25, c.P2 * 25, g, i, p);         // XXX - not general.
                                }
                                else
                                {
                                    Sphere temp = H3Models.BallToUHS(s);
                                    DrawUtils.DrawCircle(new Circle {
                                        Center = temp.Center, Radius = temp.Radius
                                    }, g, i, m == 0 ? p2 : m == 4 ? p3 : p);
                                }

                                /* // iii
                                 * Circle c = new Circle();
                                 * c.Radius = Math.Sqrt( 2 );
                                 * c.Center = new Vector3D( 1, Math.Sqrt( 2 ) );
                                 * DrawUtils.DrawCircle( c, g, i, p );
                                 * c.Center = new Vector3D( -1, Math.Sqrt( 2 ) );
                                 * DrawUtils.DrawCircle( c, g, i, p );
                                 * c.Center = new Vector3D( Math.Sqrt( 2 ) - 1, 0 );
                                 * c.Radius = 2 - Math.Sqrt( 2 );
                                 * DrawUtils.DrawCircle( c, g, i, p );
                                 *
                                 * DrawUtils.DrawLine( new Vector3D( -2, 0 ), new Vector3D( 2, 0 ), g, i, p );
                                 */
                            }
        }