示例#1
0
        private bool TryGetNextPoint(Point currentPoint, int vertexIndex, out Point nextPoint)
        {
            Vertex chosenVertex = Vertices[vertexIndex];
            int    x            = (int)ExtraMath.MiddleValueByCompression(currentPoint.X, chosenVertex.X, chosenVertex.compressionRatio);
            int    y            = (int)ExtraMath.MiddleValueByCompression(currentPoint.Y, chosenVertex.Y, chosenVertex.compressionRatio);

            nextPoint = new Point(x, y);

            Point rotationCenter = chosenVertex.Point;

            foreach (Rule r in Rules)
            {
                rotationCenter = r.AlterCenterOfRotation(vertexIndex, chosenVertex.Point);
            }
            nextPoint = ExtraMath.RotatePointAroundOrigin(nextPoint, rotationCenter, chosenVertex.rotation);

            foreach (Rule r in Rules)
            {
                return(r.IsPointValid(nextPoint, MemoryBitmap));
            }

            return(true);
        }