コード例 #1
0
        // Create intermediate QDPoints by sweeping around a standard elliptical arc shape then manually
        // applying the rotation and translation to the QDPoint.
        //@Override
        public override List <QDShapeDBPoint> getIntermediatePoints(float spacing)
        {
            List <QDShapeDBPoint> pts = new List <QDShapeDBPoint>();
            // Get angle required to achieve desired QDPoint spacing at major axis extreme
            float angleStep = 2f * (float)Math.Atan(0.5f * spacing / mSemiX);

            // With a +ve CCW step, choose if we should sweep from start or finish to produce our arc
            float startSweep, finishSweep;

            if (direction == SweepDirection.Counterclockwise)
            {
                startSweep = QDUtils.QDUtils.degToRad(mStartAngleD); finishSweep = QDUtils.QDUtils.degToRad(mFinishAngleD);
            }
            else
            {
                startSweep = QDUtils.QDUtils.degToRad(mFinishAngleD); finishSweep = QDUtils.QDUtils.degToRad(mStartAngleD);
            }

            // Check whether the arc goes over the -pi barrier and adjust finish angle accordingly
            if (finishSweep < 0f && startSweep > finishSweep)
            {
                finishSweep += 2.0f * (float)Math.PI;
            }

            // Progress through the sweep
            for (float t = startSweep; t < finishSweep; t += angleStep)
            {
                QDPoint parametric   = new QDPoint(mSemiX * (float)Math.Cos(t), mSemiY * (float)Math.Sin(t));
                QDPoint rotatedPoint = new QDPoint((float)Math.Cos(mAngleR) * parametric.x - (float)Math.Sin(mAngleR) * parametric.y,
                                                   (float)Math.Sin(mAngleR) * parametric.x + (float)Math.Cos(mAngleR) * parametric.y);
                QDPoint        translatedPoint = new QDPoint(rotatedPoint.x + mCentre.x, rotatedPoint.y + mCentre.y);
                QDShapeDBPoint sampled         = new QDShapeDBPoint(translatedPoint, QDPointTypes.CIRCLE_CIRCUMFERENCE);
                pts.Add(sampled);
            }
            return(pts);
        }
コード例 #2
0
 public QDShapeDBPoint(QDShapeDBPoint other) : base(other)
 {
     type = other.type;
 }