public void checkValidity() { final Coordinate[] coords = new Coordinate[getFaceOrder() + 1]; final WB_Point point = geometryfactory.createPoint(); final WB_Map2D context = geometryfactory.createEmbeddedPlane(getPlane()); HE_Halfedge he = _halfedge; int i = 0; do { context.mapPoint3D(he.getVertex(), point); coords[i] = new Coordinate(point.xd(), point.yd(), i); he = he.getNextInFace(); i++; } while (he != _halfedge); context.mapPoint3D(he.getVertex(), point); coords[i] = new Coordinate(point.xd(), point.yd(), i); he = he.getNextInFace(); final Polygon inputPolygon = new GeometryFactory().createPolygon(coords); final IsValidOp isValidOp = new IsValidOp(inputPolygon); if (!IsValidOp.isValid(inputPolygon)) { System.out.println(this); System.out.println(this.getFaceArea() + " " + this.getFaceNormal()); he = _halfedge; i = 0; do { System.out.println(" " + i + ": " + he.getVertex()); he = he.getNextInFace(); i++; } while (he != _halfedge); System.out.println(isValidOp.getValidationError()); } }