在使用GPC計算多邊形的交的時候,出現問題ip
//1.2. 另外一種方法,判斷新的多邊形是否和老多邊形相交
Poly cross = (PolyDefault) Clip.intersection( filed, polyNig );
get
若filed 爲兩個分離的多邊形,則出現計算問題:io
catch (Exception exception) {class
exception.printStackTrace();
}List
不知道如何解決!!!file
後記:exception
沒辦法,只能修改掉,使用遍歷方式遍歷
// 對一個複合多邊形判斷交 public static Poly intersection(Poly poly, Poly p2) { Poly p0 = new PolyDefault(); List<Poly> p1 = new ArrayList<>(); int num = poly.getNumInnerPoly(); if (num > 1) { for (int i = 0; i < num; ++i) { Poly psin = (PolyDefault) poly.getInnerPoly(i); p1.add(psin); } p0 = intersection(p1, p2); } else { p0 = (PolyDefault) Clip.intersection(poly, p2); } return p0; }