private static Rectangle? Rect( Circle c, ImageSpace i ) { if( double.IsInfinity( c.Radius ) ) return null; Vector3D upperLeft = i.Pixel( new Vector3D( c.Center.X - c.Radius, c.Center.Y + c.Radius, 0 ) ); double width = i.Width( c.Radius * 2 ); double height = i.Height( c.Radius * 2 ); Rectangle rect = new Rectangle( (int)upperLeft.X, (int)upperLeft.Y, (int)width, (int)height ); return rect; }
static private Rectangle?Rect(Circle c, ImageSpace i) { if (double.IsInfinity(c.Radius)) { return(null); } Vector3D upperLeft = i.Pixel(new Vector3D(c.Center.X - c.Radius, c.Center.Y + c.Radius, 0)); double width = i.Width(c.Radius * 2); double height = i.Height(c.Radius * 2); Rectangle rect = new Rectangle((int)upperLeft.X, (int)upperLeft.Y, (int)width, (int)height); return(rect); }
static public void DrawCircle(Circle c, Graphics g, ImageSpace i) { if (double.IsInfinity(c.Radius)) { return; } Vector3D upperLeft = i.Pixel(new Vector3D(c.Center.X - c.Radius, c.Center.Y + c.Radius, 0)); double width = i.Width(c.Radius * 2); double height = i.Height(c.Radius * 2); Rectangle rect = new Rectangle((int)upperLeft.X, (int)upperLeft.Y, (int)width, (int)height); using (Pen pen = new Pen(Color.Black, 1.0f)) g.DrawEllipse(pen, rect); }