Exemple #1
0
        //----------------------------------------------------------------------
        //
        // Constructor
        //
        //----------------------------------------------------------------------
        public Cog(double radius, PointF position, List<PointF> pointList, Cog parentCog, System.Windows.Forms.TextBox output)
        {
            this.radius = radius;

            this.position = position;

            this.pointList = pointList;

            this.output = output;

            ComputeEnclosingRectangle();

            this.angle = 0;
            this.childAngle = 0;
            
            this.parentCog = parentCog;

            CalculateLoopLimit();
        }
Exemple #2
0
        public void AddChild(double newRadius)
        {
            if (childCog != null)
            {
                childAngle = angle;
                childCog.AddChild(newRadius);
            }
            else
            {

                double fullDistance = radius + newRadius;

                PointF newPosition = new PointF(position.X + (float)(fullDistance * Math.Cos(angle)), position.Y + (float)(fullDistance * Math.Sin(angle)));

                childCog = new Cog(newRadius, newPosition, pointList, this, output);
            }
            CalculateLoopLimit();
        }
Exemple #3
0
        private void CreateCogsFromCurrentSettings()        
        {
            List<int> currentSettings = cogSettings[cogSettings.Count - 1];

            int cogSize;

            cog = null;

            if (currentSettings.Count > 1)
            {
                cogSize = currentSettings[0];

                cog = new Cog(cogSize, new PointF(pictureBoxDisplay.Width / 2, pictureBoxDisplay.Height / 2), pointList, null, textBoxOutput);


                for (int i = 1; i < currentSettings.Count; i++ )   // we add a sentinel
                {
                    cogSize = Convert.ToInt32(currentSettings[i]);

                    cog.AddChild(cogSize);
                }
            }

        }