예제 #1
0
파일: Geo.cpp 프로젝트: moretimes/template
void cut(points &p, point b, point a, points &res) {
	res.clear();
	int n = p.size();
	for (int i = 0; i < n; i ++) {
		point c = p[i];
		point d = p[next(i)];
		if (dcmp(det(b - a, c - a)) >= 0) res.push_back(c);
		if (dcmp(det(b - a, c - d)) != 0) {
			point cp = interpoint(line(a, b), line(c, d));
			if (onseg(cp, c, d)) res.push_back(cp);
		}
	}
}