/// <summary> /// Draw the sphere to the graphics output /// </summary> /// <param name="gr"></param> public void Draw(Graphics gr, double distance) { Sphere2D sphere2D = ToSphere2D(distance); sphere2D.Pen = pen; sphere2D.Draw(gr); }
/// <summary> /// Fill the sphere on the graphics output /// </summary> /// <param name="gr"></param> public void Fill(Graphics gr, double distance) { Sphere2D sphere2D = ToSphere2D(distance); sphere2D.Brush = brush; sphere2D.Fill(gr); }
/// <summary> /// convert the 3D sphere to a 2D sphere /// </summary> /// <param name="distance">from the user to the screen</param> /// <returns></returns> private Sphere2D ToSphere2D(double distance) { Point2D center2D = center.Projection(distance); double temp = (double)Math.Sqrt(center.X * center.X + center.Y * center.Y); double radius2D = (radius + temp) * distance / (distance - center.Z) - center2D.Magnitude; Sphere2D sphere2D = new Sphere2D(center2D, radius2D); return(sphere2D); }