39 bool EGS_2DPolygon::checkCCW(
const vector<EGS_2DVector> &points) {
41 for (
int j=0; j<points.size()-1; j++) {
42 A += (points[j].x*points[j+1].y - points[j+1].x*points[j].y);
60 for (
int j=0; j<ncut; j++) {
68 int n = points.size();
72 points.push_back(points[0]);
75 bool ccw = checkCCW(points);
89 for (j=0; j<n-2; j++) {
93 for (
int i=j+2; i<n; i++) {
101 for (j=0; j<n; j++) {
107 d =
new EGS_Float [np-1];
109 pc =
new bool [np-1];
112 for (j=0; j<np-1; j++) {
142 for (j=0; j<np-1; j++) {
148 for (
int i=0; i<np-1; i++) {
149 if (i != j && i != j1) {
150 if (!inside(j,p[i])) {
167 for (j=0; j<np-1; j++) {
169 for (
int i=0; i<np; i++) {
170 if (i < j || i > j+1)
if (!inside(j,p[i])) {
179 for (i=j; i<np-1; i++) {
182 for (i=0; i<=j; i++) {
189 vector<EGS_2DVector> chull;
190 vector<EGS_2DVector> ipol;
191 vector<EGS_2DPolygon *> tmp_pol;
192 chull.push_back(pp[0]);
193 chull.push_back(pp[1]);
196 bool doing_chull=
true;
197 for (EGS_I64 loopCount=0; loopCount<=
loopMax; ++loopCount) {
199 egsFatal(
"EGS_2DPolygon::EGS_2DPolygon: Too many iterations were required! Input may be invalid, or consider increasing loopMax.");
207 EGS_Float ds = sperp*chull[nc-1];
208 bool all_inside=
true;
209 for (
int i=j+1; i<n; i++) {
210 if (sperp*pp[i] < ds) {
217 ipol.push_back(pp[j]);
219 tmp_pol.push_back(newp);
223 chull.push_back(pp[j]);
229 ipol.push_back(chull[nc-1]);
231 ipol.push_back(pp[j]);
239 ncut = tmp_pol.size();
241 for (j=0; j<ncut; j++) {
const EGS_I64 loopMax
The maximum number of iterations for near-infinite loops.
A class representing 2D vectors.
~EGS_2DPolygon()
Destructor.
const EGS_Float veryFar
A very large float.
EGS_2DPolygon and EGS_PolygonT class header file.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
A class to represent a polygon in a plane (a 2D polygon).
EGS_2DPolygon(vector< EGS_2DVector > &points, bool Open=false)
Construct a polygon from the 2D points points.