コード例 #1
0
ファイル: GA.cs プロジェクト: 0Entropy/Nesting
            // "No Fit Polygon"
            // "orbit" this DNA's poly around other DNA's poly
            public Polygon NFP(DNA other)
            {
                var thisPath = this.pattern.Select(v => new IntPoint(v.x, v.y)).ToList();
                //var start = this.pattern[0];
                var otherPath = other.pattern.Select(v => new IntPoint(v.x, v.y)).ToList();

                otherPath.Reverse();

                //var solution = Clipper.MinkowskiSum(thisPath, otherPath, false);
                var solution = Clipper.MinkowskiDiff(thisPath, otherPath);//, false);
                //var _outmostRect = new Rect();
                Polygon _outmostPolygon = solution[0].Select(p => new Vector2(p.X /* + start.x*/, p.Y /* + start.y*/)).ToList();

                return(_outmostPolygon);
            }