예제 #1
0
        //多角形srcPolyを平行移動・回転する。
        //まず, 「多角形dstPolyの頂点dstPointId --> dstPointId + direction」と「多角形srcPolyの頂点srcPointId --> srcPointId - direction」
        //が同じ方向を向くように回転する。
        //次に, 「多角形dstPolyの頂点dstPointId」と「多角形srcPolyの頂点srcPointId」がくっつくように平行移動する。
        private void move(Poly dstPoly, Poly srcPoly, int dstPointId, int srcPointId, int direction, bool isUpdateLines = false)
        {
            Point mul = (dstPoly[dstPointId + direction] - dstPoly[dstPointId]) / (srcPoly[srcPointId - direction] - srcPoly[srcPointId]);

            mul /= mul.Abs;
            srcPoly.Mul(mul, isUpdateLines);

            Point t = dstPoly.points[dstPointId] - srcPoly.points[srcPointId];

            srcPoly.Trans(t, isUpdateLines);
        }
예제 #2
0
        //srcPolyとdstPolyを2点で合わせる
        private void move(Poly dstPoly, Poly srcPoly, int dstPointId, int srcPointId, bool turnflag, bool isUpdateLine)
        {
            if (turnflag)
            {
                srcPoly.Turn(isUpdateLine);
            }
            Point mul = (dstPoly[dstPointId + 1] - dstPoly[dstPointId]) / (srcPoly[srcPointId + 1] - srcPoly[srcPointId]);

            mul /= mul.Abs;
            srcPoly.Mul(mul, isUpdateLine);
            srcPoly.Trans(dstPoly[dstPointId] - srcPoly[srcPointId], isUpdateLine);
        }