Beispiel #1
0
 public RingPoint(Ring parentRing, double x, double y, int spokeIndex, ValueChangedMethod valueChanged)
 {
     ParentRing   = parentRing;
     X            = x;
     Y            = y;
     SpokeIndex   = spokeIndex;
     ValueChanged = valueChanged;
 }
Beispiel #2
0
        public Ring(double ringRadius, int perimeterPoints, ValueChangedMethod valueChanged)
        {
            RingRadius = ringRadius;
            ringPoints = new RingPoint[perimeterPoints];
            int ringArcStep = 360 / perimeterPoints;

            for (int j = 0; j < perimeterPoints; j++)
            {
                int arcAngle  = j * ringArcStep;
                int workAngle = arcAngle % 90;

                double y = Math.Cos(workAngle * (Math.PI / 180));
                double x = Math.Sin(workAngle * (Math.PI / 180));

                if (arcAngle >= 0 && arcAngle < 90)
                {
                    y = -y;
                }
                else if (arcAngle >= 90 && arcAngle < 180)
                {
                    double temp = y;
                    y = x;
                    x = temp;
                }
                else if (arcAngle >= 180 && arcAngle < 270)
                {
                    x = -x;
                }
                else if (arcAngle >= 270 && arcAngle < 360)
                {
                    double temp = y;
                    y = -x;
                    x = -temp;
                }

                double scaledX = x * ringRadius;
                double scaledY = y * ringRadius;

                ringPoints[j] = new RingPoint(this, scaledX, scaledY, j, valueChanged);
            }
        }