void PaintPoint(Graphics g, float zoom, float offs, IPointObject p) { if (p is Binary) { PaintBinary(g, zoom, offs, (Binary)p); } if (p is Star) { PaintStar(g, zoom, offs, (Star)p); } }
private static void FillStars(IPointObject obj, IList <Star> result) { if (obj is Binary) { Binary bin = (Binary)obj; FillStars(bin.o1.point, result); FillStars(bin.o2.point, result); } if (obj is Star) { result.Add((Star)obj); } }
public static IList <Star> GetStars(IPointObject obj) { lock (starsLockObject) { IList <Star> result; if (stars.TryGetValue(obj, out result)) { return(result); } result = new List <Star>(); stars[obj] = result; FillStars(obj, result); return(result); } }
public static List <StarMoved> GetAngledStars(IPointObject obj, double angle) { var stars = new List <StarMoved>(); double sin = Math.Sin(angle); double cos = Math.Cos(angle); foreach (Star origStar in RendererHelper.GetStars(obj)) { var star = new StarMoved( radius: origStar.radius, exitance: origStar.exitance, x: origStar.center.x, y: origStar.center.y * cos - origStar.center.z * sin, z: -origStar.center.y * sin - origStar.center.z * cos ); stars.Add(star); } return(stars); }
public static void GetBoundingBoxTop(IPointObject obj, out double width, out double height) { width = 0; height = 0; foreach (Star star in GetStars(obj)) { double x = Math.Max(Math.Abs(star.center.x - star.radius), Math.Abs(star.center.x + star.radius)); double y = Math.Max(Math.Abs(star.center.y - star.radius), Math.Abs(star.center.y + star.radius)); if (x > width) { width = x; } if (y > height) { height = y; } } width *= 2; height *= 2; }
public Binary(IPointObject p1, IPointObject p2) { this.o1 = new Orbit(p1); this.o2 = new Orbit(p2); }
public Orbit(IPointObject point) { this.point = point; }
public int Add(IPointObject value) { return base.Add(value); }