Exemple #1
0
        //-------------------------------------------------------------------------------------------
        //Определение ориентации траектории
        private TrajectoryOrientation DetectTrajectoryOrientation(
            EllipseOrientaion primaryEllipseOrientation,    //Первоначальная ориентация
            double rotationAngle                            //Угол поворота первоначальной траектории
            )
        {
            TrajectoryOrientation trajectoryOrientation = TrajectoryOrientation.Undefined;

            if (primaryEllipseOrientation == EllipseOrientaion.NorthEast)
            {
                if (0 < rotationAngle)
                {
                    trajectoryOrientation = TrajectoryOrientation.AxisX;
                }
                else
                {
                    trajectoryOrientation = TrajectoryOrientation.AxisY;
                }
            }
            if (primaryEllipseOrientation == EllipseOrientaion.NorthWest)
            {
                if (0 < rotationAngle)
                {
                    trajectoryOrientation = TrajectoryOrientation.AxisY;
                }
                else
                {
                    trajectoryOrientation = TrajectoryOrientation.AxisX;
                }
            }
            return(trajectoryOrientation);
        }
Exemple #2
0
        //---------------------------------------------------------------------------------------------
        //Трансформация траектоории (центрирование, поворот, растяжение)
        private Curve2D TransformateTrajectory(
            Curve2D trajectory,
            EllipseDescriptor approximateEllipse
            )
        {
            //Центрирование
            Curve2D transformedTrajectory = this.CentreTrajectory(trajectory, approximateEllipse);

            //Поворот параллельно координатной оси
            double rotationAngleToAxis = approximateEllipse.GetAngleBetweenOxAndPrincipalAxis();

            transformedTrajectory =
                this.RotateTrajectory(transformedTrajectory, rotationAngleToAxis);

            //Растяжение
            EllipseOrientaion     primaryOrientation    = approximateEllipse.GetOrientaion();
            TrajectoryOrientation trajectoryOrientation =
                this.DetectTrajectoryOrientation(primaryOrientation, rotationAngleToAxis);
            double koefficientOfStretch = 1 / approximateEllipse.GetCompressionRatio();

            transformedTrajectory = this.StretchingTrajectory
                                        (transformedTrajectory, trajectoryOrientation, koefficientOfStretch);

            //Поворот траектории до пересечения первой точки с осью OX
            Point2D firstPointTrajectory = transformedTrajectory[0];
            double  rotationAngle        = Mathem.Arctg(firstPointTrajectory.Y, firstPointTrajectory.X);

            transformedTrajectory =
                this.RotateTrajectory(transformedTrajectory, rotationAngle);
            return(transformedTrajectory);
        }
Exemple #3
0
        //-------------------------------------------------------------------------------------------
        //Растяжение траектории до окружности
        private Curve2D StretchingTrajectory(
            Curve2D trajectory,
            TrajectoryOrientation trajectoryOrientation,
            double koefficientOfStretch
            )
        {
            Curve2D transformedTrajectory = null;

            if (trajectoryOrientation == TrajectoryOrientation.AxisX)
            {
                transformedTrajectory =
                    trajectory.GetStretchCurveAlongAxisY(koefficientOfStretch);
            }
            if (trajectoryOrientation == TrajectoryOrientation.AxisY)
            {
                transformedTrajectory =
                    trajectory.GetStretchCurveAlongAxisX(koefficientOfStretch);
            }
            return(transformedTrajectory);
        }