//--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- //Преобразовать точки к окружности private Point2D[] GetTransformedPoints(params Point2D[] points2D) { //this.EllipsePoints = points2D; EllipseApproximator ellipseApproximator = new EllipseApproximator(); EllipseDescriptor ellipseDescriptor = ellipseApproximator.Approximate(points2D); Point2D ellipseCentre = ellipseDescriptor.GetCentre(); points2D = PlaneManager.DisplacePoints(points2D, -ellipseCentre.X, -ellipseCentre.Y); double rotationAngle = ellipseDescriptor.GetAngleBetweenOxAndPrincipalAxis(); points2D = this.RotatePoints(-rotationAngle, points2D); EllipseOrientaion pointsOrientation = this.GetPointsOrientation(points2D); if (pointsOrientation == EllipseOrientaion.AxisY) { points2D = this.RotatePoints(Math.PI / 2, points2D); } double radiusX = ellipseDescriptor.GetSemiMajorAxis(); double radiusY = ellipseDescriptor.GetSemiMinorAxis(); double stretchCoefficient = radiusX / radiusY; Point2D[] stretchPoints = this.StretchPointsAlongAxisY(stretchCoefficient, points2D); this.EllipsePoints = stretchPoints; return(stretchPoints); }
//------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------- public double[] Compute( Point pointOne, Point pointTwo, int interferogramIndexOne, int interferogramIndexTwo ) { TrajectoryCreator trajectoryCreator = new TrajectoryCreator(this.interferograms); Curve2D trajectory = trajectoryCreator.GetTrajectory(pointOne, pointTwo); Point2D[] points = trajectory.GetPoints(); this.TrajectoryPoints = points; EllipseApproximator ellipseApproximator = new EllipseApproximator(); EllipseDescriptor ellipseDescriptor = ellipseApproximator.Approximate(points); Point2D ellipseCentre = ellipseDescriptor.GetCentre(); points = PlaneManager.DisplacePoints(points, -ellipseCentre.X, -ellipseCentre.Y); double x0 = points[0].X; double y0 = points[0].Y; double x1 = points[interferogramIndexOne].X; double y1 = points[interferogramIndexOne].Y; double x2 = points[interferogramIndexTwo].X; double y2 = points[interferogramIndexTwo].Y; double[] phaseShifts = this.GetPhaseShifts(x0, y0, x1, y1, x2, y2); return(phaseShifts); }
//--------------------------------------------------------------------------------------------- //Преобразовать точки к окружности private Point2D[] GetTransformedPoints(Point2D[] points2D) { EllipseApproximator ellipseApproximator = new EllipseApproximator(); EllipseDescriptor ellipseDescriptor = ellipseApproximator.Approximate(points2D); Point2D ellipseCentre = ellipseDescriptor.GetCentre(); points2D = PlaneManager.DisplacePoints(points2D, -ellipseCentre.X, -ellipseCentre.Y); double rotationAngle = ellipseDescriptor.GetAngleBetweenOxAndPrincipalAxis(); points2D = this.RotatePoints(points2D, -rotationAngle); EllipseOrientaion pointsOrientation = this.GetPointsOrientation(points2D); if (pointsOrientation == EllipseOrientaion.AxisY) { points2D = this.RotatePoints(points2D, Math.PI / 2); } double radiusX = ellipseDescriptor.GetSemiMajorAxis(); double radiusY = ellipseDescriptor.GetSemiMinorAxis(); CanonicalEllipseDescriptor canonicalEllipseDescriptor = new CanonicalEllipseDescriptor(radiusX, radiusY); Point2D[] correctedToEllipsePoints = this.CorrectPointsToCanonicalEllipse(points2D, canonicalEllipseDescriptor); this.EllipsePoints = correctedToEllipsePoints; CircleDescriptor circleDescriptor = new CircleDescriptor(new Point2D(0, 0), radiusX); Point2D[] correctedToCirclePoints = this.StretchToCircleAlongAxisY(correctedToEllipsePoints, circleDescriptor, 0); return(correctedToCirclePoints); }