コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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;
 }
コード例 #6
0
ファイル: Objects.cs プロジェクト: HinataSoft/Eclipsor
 public Binary(IPointObject p1, IPointObject p2)
 {
     this.o1 = new Orbit(p1);
     this.o2 = new Orbit(p2);
 }
コード例 #7
0
ファイル: Objects.cs プロジェクト: HinataSoft/Eclipsor
 public Orbit(IPointObject point)
 {
     this.point = point;
 }
コード例 #8
0
 public int Add(IPointObject value)
 {
     return base.Add(value);
 }