Beispiel #1
0
        public static PointInPlane MovePoint(PointInPlane pointToMoveIn, PointInPlane moveVectorIn)
        {
            PointInPlane aMovedPoint = new PointInPlane();

            aMovedPoint = pointToMoveIn + moveVectorIn;

            return(aMovedPoint);
        }
        public PointInPlane GetPlaneCoordinates(int xIn, int yIn)
        {
            PointInPlane tempPointInPlane = new PointInPlane();

            tempPointInPlane.x = Math.Min(ViewRectangle.StartX, ViewRectangle.EndX) + (double)xIn * (Math.Abs(ViewRectangle.EndX - ViewRectangle.StartX) / (double)ScreenWidth);
            tempPointInPlane.y = Math.Min(ViewRectangle.StartY, ViewRectangle.EndY) + (double)yIn * (Math.Abs(ViewRectangle.EndY - ViewRectangle.StartY) / (double)ScreenHeight);

            return(tempPointInPlane);
        }
Beispiel #3
0
        public static PointInPlane ScalePoint(PointInPlane startPointIn, PointInPlane endPointIn, double scalingIn)
        {
            PointInPlane aNewEndPoint = new PointInPlane();

            aNewEndPoint.x = startPointIn.x + (endPointIn.x - startPointIn.x) * scalingIn;
            aNewEndPoint.y = startPointIn.y + (endPointIn.y - startPointIn.y) * scalingIn;

            return(aNewEndPoint);
        }
Beispiel #4
0
        public static PointInPlane RotatePoint(PointInPlane pointToRotateIn, PointInPlane rotationCenterIn, double rotationAngleIn)
        {
            PointInPlane aRotatedPoint = new PointInPlane();

            aRotatedPoint.x = rotationCenterIn.x + (pointToRotateIn.x - rotationCenterIn.x) * Math.Cos(rotationAngleIn) - (pointToRotateIn.y - rotationCenterIn.y) * Math.Sin(rotationAngleIn);
            aRotatedPoint.y = rotationCenterIn.y + (pointToRotateIn.x - rotationCenterIn.x) * Math.Sin(rotationAngleIn) + (pointToRotateIn.y - rotationCenterIn.y) * Math.Cos(rotationAngleIn);

            return(aRotatedPoint);
        }
        //help method for line rotation
        private PointInPlane RotateLine(PointInPlane startPointIn, PointInPlane endPointIn, double angleIn)
        {
            PointInPlane aPointInPlane = new PointInPlane();

            aPointInPlane.x = (endPointIn.x - startPointIn.x) * Math.Cos(angleIn) - (endPointIn.y - startPointIn.y) * Math.Sin(angleIn) + startPointIn.x; // calculation of x coordinate of rotated point (triangle vertex)
            aPointInPlane.y = (endPointIn.x - startPointIn.x) * Math.Sin(angleIn) + (endPointIn.y - startPointIn.y) * Math.Cos(angleIn) + startPointIn.y; // calculation of y coordinate of rotated point (triangle vertex)

            return(aPointInPlane);
        }
Beispiel #6
0
        public IList <LineInPlane> ReturnListOfInPlaneLines()
        {
            List <LineInPlane> aListOfInPlaneLines = new List <LineInPlane>();

            PointInPlane tempPointXStartYStart = StartPoint;
            PointInPlane tempPointXStartYEnd   = new PointInPlane(StartPoint.x, EndPoint.y);
            PointInPlane tempPointXEndYStart   = new PointInPlane(EndPoint.x, StartPoint.y);
            PointInPlane tempPointXEndYEnd     = EndPoint;

            aListOfInPlaneLines.Add(new LineInPlane(tempPointXStartYStart, tempPointXStartYEnd));
            aListOfInPlaneLines.Add(new LineInPlane(tempPointXStartYEnd, tempPointXEndYEnd));
            aListOfInPlaneLines.Add(new LineInPlane(tempPointXEndYEnd, tempPointXEndYStart));
            aListOfInPlaneLines.Add(new LineInPlane(tempPointXEndYStart, tempPointXStartYStart));

            return(aListOfInPlaneLines);
        }
        public ComputedFractalValues ReturnComputedFractalValues(RectangleInPlane fractalRectangleIn, int xMaxIn, int yMaxIn, IList <FractalColorValue> fractalColorValuesIn, System.Windows.Forms.ProgressBar fractalProgressIn)
        {
            if (fractalColorValuesIn.Count < NumberOfColorUsed)
            {
                throw new FractalObserverException("Fractal PythagorasTree needs more colors that are available in the input parameter fractalColorValuesIn!");
            }

            ComputedFractalValues aComputedFractalValues = new ComputedFractalValues();

            aComputedFractalValues.ShallFillInterior = false;

            ComputedFractalValue aCFValue = new ComputedFractalValue();

            FractalColorValue aFractalColorValue = ReturnColor(fractalColorValuesIn);

            aCFValue.ColorValue  = aFractalColorValue;
            aCFValue.TypeOfShape = TypesOfShape.Lines;
            aCFValue.UsedTypeOfCoordinateSystem = TypesOfCoordinateSystem.Plane;

            PointInPlane aStartingPoint = new PointInPlane(myFractalArea.MinX, myFractalArea.MaxY);
            PointInPlane aEndingPoint   = new PointInPlane(myFractalArea.MaxX, myFractalArea.MaxY);

            const int aStartingIteration = 0;

            const double aAngle = Math.PI / 3.0; // angle of -60 degrees - equilateral triangle

            PointInPlane tempPointInPlane = RotateLine(aStartingPoint, aEndingPoint, aAngle);

            CreateNewCurveAndAddItToCFV(aEndingPoint, aStartingPoint, fractalColorValuesIn, ref aCFValue, aStartingIteration);

            CreateNewCurveAndAddItToCFV(aStartingPoint, tempPointInPlane, fractalColorValuesIn, ref aCFValue, aStartingIteration);

            CreateNewCurveAndAddItToCFV(tempPointInPlane, aEndingPoint, fractalColorValuesIn, ref aCFValue, aStartingIteration);

            aComputedFractalValues.AddComputedFractalValue(aCFValue);

            return(aComputedFractalValues);
        }
Beispiel #8
0
        public ComputedFractalValues ReturnComputedFractalValues(RectangleInPlane fractalRectangleIn, int xMaxIn, int yMaxIn, IList <FractalColorValue> fractalColorValuesIn, System.Windows.Forms.ProgressBar fractalProgressIn)
        {
            if (fractalColorValuesIn.Count < NumberOfColorUsed)
            {
                throw new FractalObserverException("Fractal PythagorasTree needs more colors that are available in the input parameter fractalColorValuesIn!");
            }

            ComputedFractalValues aComputedFractalValues = new ComputedFractalValues();

            aComputedFractalValues.ShallFillInterior = false;

            PointInPlane[] aStartingRectanglePoints = new PointInPlane[4];
            aStartingRectanglePoints[0] = new PointInPlane(myFractalArea.MinX, myFractalArea.MaxY);
            aStartingRectanglePoints[1] = new PointInPlane(myFractalArea.MaxX, myFractalArea.MaxY);
            aStartingRectanglePoints[2] = new PointInPlane(myFractalArea.MaxX, myFractalArea.MinY);
            aStartingRectanglePoints[3] = new PointInPlane(myFractalArea.MinX, myFractalArea.MinY);

            const int aStartingIteration = 0;

            CreateSquare(aStartingRectanglePoints, fractalColorValuesIn, ref aComputedFractalValues, aStartingIteration);

            return(aComputedFractalValues);
        }
        // recursive method - this method computes the points of snowflake
        private void CreateNewCurveAndAddItToCFV(PointInPlane startPointIn, PointInPlane endPointIn, IList <FractalColorValue> fractalColorValuesIn, ref ComputedFractalValue cfvIn, int currentIterationIn)
        {
            if (currentIterationIn < (MaximumNumberOfIterations - 1))
            {
                const double aAngle = Math.PI / 3.0; // angle of 60 degrees - equilateral triangle

                PointInPlane aOneThirdPoint = new PointInPlane(startPointIn.x + (endPointIn.x - startPointIn.x) / 3.0, startPointIn.y + (endPointIn.y - startPointIn.y) / 3.0);

                PointInPlane aTwoThirdPoint = new PointInPlane(startPointIn.x + (endPointIn.x - startPointIn.x) / 1.5, startPointIn.y + (endPointIn.y - startPointIn.y) / 1.5);

                PointInPlane aRotatedLinePoint = RotateLine(aOneThirdPoint, aTwoThirdPoint, aAngle);

                CreateNewCurveAndAddItToCFV(startPointIn, aOneThirdPoint, fractalColorValuesIn, ref cfvIn, currentIterationIn + 1);
                CreateNewCurveAndAddItToCFV(aOneThirdPoint, aRotatedLinePoint, fractalColorValuesIn, ref cfvIn, currentIterationIn + 1);
                CreateNewCurveAndAddItToCFV(aRotatedLinePoint, aTwoThirdPoint, fractalColorValuesIn, ref cfvIn, currentIterationIn + 1);
                CreateNewCurveAndAddItToCFV(aTwoThirdPoint, endPointIn, fractalColorValuesIn, ref cfvIn, currentIterationIn + 1);
            }
            else
            {
                cfvIn.AddComputedPoint(startPointIn);
                cfvIn.AddComputedPoint(endPointIn);
            }
        }
Beispiel #10
0
 public RectangleInPlane(PointInPlane startPointIn, PointInPlane endPointIn)
 {
     StartPoint = startPointIn;
     EndPoint   = endPointIn;
 }
Beispiel #11
0
 public RectangleInPlane(double startXIn, double endXIn, double startYIn, double endYIn)
 {
     StartPoint = new PointInPlane(startXIn, startYIn);
     EndPoint   = new PointInPlane(endXIn, endYIn);
 }
Beispiel #12
0
        // recursive method - here are computed the squares of pythagoras tree
        private void CreateSquare(PointInPlane[] rectanglePointsIn, IList <FractalColorValue> fractalColorValuesIn /*, SquareOrientation squareOrientationIn*/, ref ComputedFractalValues cfvIn, int currentIterationIn)
        {
            if (rectanglePointsIn.Length < 4)
            {
                throw new FractalObserverException("The input parameter rectanglePointsIn in Methode CreateSquare must have at least four values (for each vertex one) !");
            }

            ComputedFractalValue aCFValue = new ComputedFractalValue();

            FractalColorValue aFractalColorValue = ReturnColor(currentIterationIn, fractalColorValuesIn);

            aCFValue.ColorValue  = aFractalColorValue;
            aCFValue.TypeOfShape = TypesOfShape.Rectangle;
            aCFValue.UsedTypeOfCoordinateSystem = TypesOfCoordinateSystem.Plane;

            aCFValue.AddComputedPoint(rectanglePointsIn[0]);
            aCFValue.AddComputedPoint(rectanglePointsIn[1]);
            aCFValue.AddComputedPoint(rectanglePointsIn[2]);
            aCFValue.AddComputedPoint(rectanglePointsIn[3]);

            cfvIn.AddComputedFractalValue(aCFValue);

            if (currentIterationIn < MaximumNumberOfIterations)
            {
                double aScalingCoefficient = 1.0 / Math.Sqrt(2.0);
                double aRotationAngle      = Math.PI / 4.0;

                { // right rectangle values computed
                    PointInPlane[] aNewRightRectangle = new PointInPlane[4];

                    PointInPlane aMovingVector = rectanglePointsIn[2] - rectanglePointsIn[1];

                    // scale to new rectangle
                    aNewRightRectangle[1] = rectanglePointsIn[1];
                    aNewRightRectangle[0] = PointInPlane.ScalePoint(rectanglePointsIn[1], rectanglePointsIn[0], aScalingCoefficient);
                    aNewRightRectangle[2] = PointInPlane.ScalePoint(rectanglePointsIn[1], rectanglePointsIn[2], aScalingCoefficient);
                    aNewRightRectangle[3] = PointInPlane.ScalePoint(rectanglePointsIn[1], rectanglePointsIn[3], aScalingCoefficient);

                    // rotate to new rectangle
                    aNewRightRectangle[0] = PointInPlane.RotatePoint(aNewRightRectangle[0], aNewRightRectangle[1], aRotationAngle);
                    aNewRightRectangle[1] = PointInPlane.RotatePoint(aNewRightRectangle[1], aNewRightRectangle[1], aRotationAngle);
                    aNewRightRectangle[2] = PointInPlane.RotatePoint(aNewRightRectangle[2], aNewRightRectangle[1], aRotationAngle);
                    aNewRightRectangle[3] = PointInPlane.RotatePoint(aNewRightRectangle[3], aNewRightRectangle[1], aRotationAngle);

                    // move to new rectangle position
                    aNewRightRectangle[0] = PointInPlane.MovePoint(aNewRightRectangle[0], aMovingVector);
                    aNewRightRectangle[1] = PointInPlane.MovePoint(aNewRightRectangle[1], aMovingVector);
                    aNewRightRectangle[2] = PointInPlane.MovePoint(aNewRightRectangle[2], aMovingVector);
                    aNewRightRectangle[3] = PointInPlane.MovePoint(aNewRightRectangle[3], aMovingVector);

                    CreateSquare(aNewRightRectangle, fractalColorValuesIn, ref cfvIn, currentIterationIn + 1);
                }

                { // left rectangle values computed
                    aRotationAngle = -Math.PI / 4.0;

                    PointInPlane[] aNewLeftRectangle = new PointInPlane[4];

                    PointInPlane aMovingVector = rectanglePointsIn[3] - rectanglePointsIn[0];

                    // scale to new rectangle
                    aNewLeftRectangle[0] = rectanglePointsIn[0];
                    aNewLeftRectangle[1] = PointInPlane.ScalePoint(rectanglePointsIn[0], rectanglePointsIn[1], aScalingCoefficient);
                    aNewLeftRectangle[2] = PointInPlane.ScalePoint(rectanglePointsIn[0], rectanglePointsIn[2], aScalingCoefficient);
                    aNewLeftRectangle[3] = PointInPlane.ScalePoint(rectanglePointsIn[0], rectanglePointsIn[3], aScalingCoefficient);

                    // rotate to new rectangle
                    aNewLeftRectangle[0] = PointInPlane.RotatePoint(aNewLeftRectangle[0], aNewLeftRectangle[0], aRotationAngle);
                    aNewLeftRectangle[1] = PointInPlane.RotatePoint(aNewLeftRectangle[1], aNewLeftRectangle[0], aRotationAngle);
                    aNewLeftRectangle[2] = PointInPlane.RotatePoint(aNewLeftRectangle[2], aNewLeftRectangle[0], aRotationAngle);
                    aNewLeftRectangle[3] = PointInPlane.RotatePoint(aNewLeftRectangle[3], aNewLeftRectangle[0], aRotationAngle);

                    // move to new rectangle position
                    aNewLeftRectangle[0] = PointInPlane.MovePoint(aNewLeftRectangle[0], aMovingVector);
                    aNewLeftRectangle[1] = PointInPlane.MovePoint(aNewLeftRectangle[1], aMovingVector);
                    aNewLeftRectangle[2] = PointInPlane.MovePoint(aNewLeftRectangle[2], aMovingVector);
                    aNewLeftRectangle[3] = PointInPlane.MovePoint(aNewLeftRectangle[3], aMovingVector);

                    CreateSquare(aNewLeftRectangle, fractalColorValuesIn, ref cfvIn, currentIterationIn + 1);
                }
            }
        }
Beispiel #13
0
        private void FractalImage_MouseMove(object sender, MouseEventArgs e)
        {
            ScreenPlaneCoordinatesTransfornation tempTransformation = new ScreenPlaneCoordinatesTransfornation(FractalImage.Width, FractalImage.Height, myFractalObserverConfiguration.CurrentRectangle);
            Point aCurrentMouseLocation = e.Location;

            if (showZoomRectangleToolStripMenuItem.Checked == true && myShowZoomRectangleAndAllowModification)
            {
                // Getting the screen coordinates of zoom rectangle
                Point aStartPoint      = tempTransformation.GetScreenCoordinates(myFractalObserverConfiguration.ZoomRectangle.StartX, myFractalObserverConfiguration.ZoomRectangle.StartY);
                Point aEndPoint        = tempTransformation.GetScreenCoordinates(myFractalObserverConfiguration.ZoomRectangle.EndX, myFractalObserverConfiguration.ZoomRectangle.EndY);
                bool  aModifyRectangle = false;

                // finding out if the current mouse pointer position is near or in the zoom rectangle, if yes - then change the mouse pointer shape
                if (!myMouseIsDown)
                {
                    if (Math.Abs(aCurrentMouseLocation.X - aStartPoint.X) < myLimitForZoomRectangleChange && aCurrentMouseLocation.Y > Math.Min(aStartPoint.Y, aEndPoint.Y) && aCurrentMouseLocation.Y < Math.Max(aStartPoint.Y, aEndPoint.Y))
                    {
                        myCurrentZoomRectangleOperation = ZoomingRectangleOperations.LeftSizing;
                        this.Cursor = Cursors.SizeWE;
                    }
                    else if (Math.Abs(aCurrentMouseLocation.X - aEndPoint.X) < myLimitForZoomRectangleChange && aCurrentMouseLocation.Y > Math.Min(aStartPoint.Y, aEndPoint.Y) && aCurrentMouseLocation.Y < Math.Max(aStartPoint.Y, aEndPoint.Y))
                    {
                        myCurrentZoomRectangleOperation = ZoomingRectangleOperations.RightSizing;
                        this.Cursor = Cursors.SizeWE;
                    }
                    else if (Math.Abs(aCurrentMouseLocation.Y - aStartPoint.Y) < myLimitForZoomRectangleChange && aCurrentMouseLocation.X > Math.Min(aStartPoint.X, aEndPoint.X) && aCurrentMouseLocation.X < Math.Max(aStartPoint.X, aEndPoint.X))
                    {
                        myCurrentZoomRectangleOperation = ZoomingRectangleOperations.UpSizing;
                        this.Cursor = Cursors.SizeNS;
                    }
                    else if (Math.Abs(aCurrentMouseLocation.Y - aEndPoint.Y) < myLimitForZoomRectangleChange && aCurrentMouseLocation.X > Math.Min(aStartPoint.X, aEndPoint.X) && aCurrentMouseLocation.X < Math.Max(aStartPoint.X, aEndPoint.X))
                    {
                        myCurrentZoomRectangleOperation = ZoomingRectangleOperations.DownSizing;
                        this.Cursor = Cursors.SizeNS;
                    }
                    else if (aCurrentMouseLocation.X > Math.Min(aStartPoint.X, aEndPoint.X) && aCurrentMouseLocation.X < Math.Max(aStartPoint.X, aEndPoint.X) &&
                             aCurrentMouseLocation.Y > Math.Min(aStartPoint.Y, aEndPoint.Y) && aCurrentMouseLocation.Y < Math.Max(aStartPoint.Y, aEndPoint.Y))
                    {
                        myCurrentZoomRectangleOperation = ZoomingRectangleOperations.Panning;
                        this.Cursor = Cursors.Hand;
                    }
                    else
                    {
                        myCurrentZoomRectangleOperation = ZoomingRectangleOperations.None;
                        this.Cursor = Cursors.Default;
                    }
                }

                // if mouse button is pressed and the mouse pointer is on the right area then zooming rectangle will be modified
                if (myMouseIsDown)
                {
                    PointInPlane tempNewPoint = tempTransformation.GetPlaneCoordinates(aCurrentMouseLocation.X, aCurrentMouseLocation.Y);

                    // corrections of new zooming rectangle, it cannot be set outside the current view area
                    if (tempNewPoint.x <= myFractalObserverConfiguration.CurrentRectangle.MinX)
                    {
                        tempNewPoint.x = myFractalObserverConfiguration.CurrentRectangle.MinX;
                    }

                    if (tempNewPoint.y <= myFractalObserverConfiguration.CurrentRectangle.MinY)
                    {
                        tempNewPoint.y = myFractalObserverConfiguration.CurrentRectangle.MinY;
                    }

                    if (tempNewPoint.x >= myFractalObserverConfiguration.CurrentRectangle.MaxX)
                    {
                        tempNewPoint.x = myFractalObserverConfiguration.CurrentRectangle.MaxX;
                    }

                    if (tempNewPoint.y >= myFractalObserverConfiguration.CurrentRectangle.MaxY)
                    {
                        tempNewPoint.y = myFractalObserverConfiguration.CurrentRectangle.MaxY;
                    }

                    if (myCurrentZoomRectangleOperation == ZoomingRectangleOperations.LeftSizing)
                    {
                        // correction of zoom rectangle - it cannot be too small, then it is not allowed to further reduce its size
                        if (Math.Abs(aEndPoint.X - aCurrentMouseLocation.X) < myLowerSizeLimitForZoomRectangle)
                        {
                            int aSign = Math.Sign(aEndPoint.X - aStartPoint.X);
                            tempNewPoint.x = tempTransformation.GetPlaneCoordinates(aEndPoint.X - aSign * myLowerSizeLimitForZoomRectangle, aCurrentMouseLocation.Y).x;
                        }
                        myFractalObserverConfiguration.ZoomRectangle.StartX = tempNewPoint.x;
                        aModifyRectangle = true;
                    }
                    else if (myCurrentZoomRectangleOperation == ZoomingRectangleOperations.RightSizing)
                    {
                        // correction of zoom rectangle - it cannot be too small, then it is not allowed to further reduce its size
                        if (Math.Abs(aStartPoint.X - aCurrentMouseLocation.X) < myLowerSizeLimitForZoomRectangle)
                        {
                            int aSign = Math.Sign(aEndPoint.X - aStartPoint.X);
                            tempNewPoint.x = tempTransformation.GetPlaneCoordinates(aStartPoint.X + aSign * myLowerSizeLimitForZoomRectangle, aCurrentMouseLocation.Y).x;
                        }
                        myFractalObserverConfiguration.ZoomRectangle.EndX = tempNewPoint.x;
                        aModifyRectangle = true;
                    }
                    else if (myCurrentZoomRectangleOperation == ZoomingRectangleOperations.UpSizing)
                    {
                        // correction of zoom rectangle - it cannot be too small, then it is not allowed to further reduce its size
                        if (Math.Abs(aEndPoint.Y - aCurrentMouseLocation.Y) < myLowerSizeLimitForZoomRectangle)
                        {
                            int aSign = Math.Sign(aEndPoint.Y - aStartPoint.Y);
                            tempNewPoint.y = tempTransformation.GetPlaneCoordinates(aCurrentMouseLocation.X, aEndPoint.Y - aSign * myLowerSizeLimitForZoomRectangle).y;
                        }
                        myFractalObserverConfiguration.ZoomRectangle.StartY = tempNewPoint.y;
                        aModifyRectangle = true;
                    }
                    else if (myCurrentZoomRectangleOperation == ZoomingRectangleOperations.DownSizing)
                    {
                        // correction of zoom rectangle - it cannot be too small, then it is not allowed to further reduce its size
                        if (Math.Abs(aStartPoint.Y - aCurrentMouseLocation.Y) < myLowerSizeLimitForZoomRectangle)
                        {
                            int aSign = Math.Sign(aEndPoint.Y - aStartPoint.Y);
                            tempNewPoint.y = tempTransformation.GetPlaneCoordinates(aCurrentMouseLocation.X, aStartPoint.Y - aSign * myLowerSizeLimitForZoomRectangle).y;
                        }
                        myFractalObserverConfiguration.ZoomRectangle.EndY = tempNewPoint.y;
                        aModifyRectangle = true;
                    }
                    else if (myCurrentZoomRectangleOperation == ZoomingRectangleOperations.Panning)
                    {
                        // computing the new zooming rectangle coordinates if panning occured
                        if (!myIsPanNow)
                        {
                            myStartingDifferenceForPan = tempNewPoint - myFractalObserverConfiguration.ZoomRectangle.StartPoint;
                            myIsPanNow = true;
                        }

                        if (myIsPanNow) // if zoom rectangle is currenty in panning operation - then the following code is ran
                        {
                            double aRectangleWidth  = myFractalObserverConfiguration.ZoomRectangle.Width;
                            double aRectangleHeight = myFractalObserverConfiguration.ZoomRectangle.Height;
                            myFractalObserverConfiguration.ZoomRectangle.StartX = tempNewPoint.x - myStartingDifferenceForPan.x;
                            myFractalObserverConfiguration.ZoomRectangle.StartY = tempNewPoint.y - myStartingDifferenceForPan.y;
                            myFractalObserverConfiguration.ZoomRectangle.EndX   = myFractalObserverConfiguration.ZoomRectangle.StartX + aRectangleWidth;
                            myFractalObserverConfiguration.ZoomRectangle.EndY   = myFractalObserverConfiguration.ZoomRectangle.StartY + aRectangleHeight;

                            // during panning the zoom rectangle cannot be moved outside of current view, the checks for this are following
                            if (myFractalObserverConfiguration.ZoomRectangle.MinX < myFractalObserverConfiguration.CurrentRectangle.MinX)
                            {
                                myFractalObserverConfiguration.ZoomRectangle.MinX = myFractalObserverConfiguration.CurrentRectangle.MinX;
                                myFractalObserverConfiguration.ZoomRectangle.MaxX = myFractalObserverConfiguration.ZoomRectangle.MinX + aRectangleWidth;
                            }
                            if (myFractalObserverConfiguration.ZoomRectangle.MaxX > myFractalObserverConfiguration.CurrentRectangle.MaxX)
                            {
                                myFractalObserverConfiguration.ZoomRectangle.MaxX = myFractalObserverConfiguration.CurrentRectangle.MaxX;
                                myFractalObserverConfiguration.ZoomRectangle.MinX = myFractalObserverConfiguration.ZoomRectangle.MaxX - aRectangleWidth;
                            }
                            if (myFractalObserverConfiguration.ZoomRectangle.MinY < myFractalObserverConfiguration.CurrentRectangle.MinY)
                            {
                                myFractalObserverConfiguration.ZoomRectangle.MinY = myFractalObserverConfiguration.CurrentRectangle.MinY;
                                myFractalObserverConfiguration.ZoomRectangle.MaxY = myFractalObserverConfiguration.ZoomRectangle.MinY + aRectangleHeight;
                            }
                            if (myFractalObserverConfiguration.ZoomRectangle.MaxY > myFractalObserverConfiguration.CurrentRectangle.MaxY)
                            {
                                myFractalObserverConfiguration.ZoomRectangle.MaxY = myFractalObserverConfiguration.CurrentRectangle.MaxY;
                                myFractalObserverConfiguration.ZoomRectangle.MinY = myFractalObserverConfiguration.ZoomRectangle.MaxY - aRectangleHeight;
                            }
                        }

                        aModifyRectangle = true;
                    }

                    // if zooming rectangle was modified and mouse button is pressed then modify the zoom rectangle
                    if (aModifyRectangle)
                    {
                        // invalidation of screen (onpaint will be called on this area, and new zooming rectangle will be drawn)
                        FractalImage.Invalidate();
                        FractalImage.Update();
                    }
                }
            }
            else
            {
                myCurrentZoomRectangleOperation = ZoomingRectangleOperations.None;
                this.Cursor = Cursors.Default;
            }

            // showing of current mouse position in plane coordinates in status bar
            PointInPlane tempMousePositionInPlane = tempTransformation.GetPlaneCoordinates(aCurrentMouseLocation.X, aCurrentMouseLocation.Y);

            tsStatusLabelMousePosition.Text = "Current Mouse Position : X = " + Convert.ToString(tempMousePositionInPlane.x, CultureInfo.CurrentCulture) + " Y= " + Convert.ToString(tempMousePositionInPlane.y, CultureInfo.CurrentCulture);
        }
Beispiel #14
0
 public LineInPlane(PointInPlane beginIn, PointInPlane endIn)
 {
     begin = beginIn;
     end   = endIn;
 }
Beispiel #15
0
        public static PointInPlane operator -(PointInPlane firstIn, PointInPlane secondIn)
        {
            PointInPlane aPointInPlane = new PointInPlane(firstIn.x - secondIn.x, firstIn.y - secondIn.y);

            return(aPointInPlane);
        }
 public void AddComputedPoint(PointInPlane pointIn)
 {
     myListOfPlanePositions.Add(pointIn);
 }