Skip to content

Commit

Permalink
Fix self-tangency test typo (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
stolstov authored Nov 22, 2019
1 parent 961b535 commit 73a8be8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,12 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
|| (xyindex == path_last);
if (m_bOGCRestrictions)
vi_prev.boundary = !is_closed_path && vi_prev.end_point;
else
else {
// for regular planar simplify, only the end points are allowed
// to coincide
vi_prev.boundary = vi_prev.end_point;
}

vi_prev.ipath = ipath;
vi_prev.x = pt.x;
vi_prev.y = pt.y;
Expand All @@ -506,11 +508,11 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
boolean end_point = (xyindex == path_start)
|| (xyindex == path_last);
if (m_bOGCRestrictions)
boundary = !is_closed_path && vi_prev.end_point;
boundary = !is_closed_path && end_point;
else
// for regular planar simplify, only the end points are allowed
// to coincide
boundary = vi_prev.end_point;
boundary = end_point;

vi.x = pt.x;
vi.y = pt.y;
Expand All @@ -522,22 +524,12 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
if (vi.x == vi_prev.x && vi.y == vi_prev.y) {
if (m_bOGCRestrictions) {
if (!vi.boundary || !vi_prev.boundary) {
// check that this is not the endpoints of a closed path
if ((vi.ipath != vi_prev.ipath)
|| (!vi.end_point && !vi_prev.end_point))// check
// that
// this
// is
// not
// the
// endpoints
// of
// a
// closed
// path
{
|| (!vi.end_point && !vi_prev.end_point)) {
// one of coincident vertices is not on the boundary
// this is either Non_simple_result::cross_over or
// Non_simple_result::ogc_self_tangency.
// this is either NonSimpleResult.CrossOver or
// NonSimpleResult.OGCPolylineSelfTangency.
// too expensive to distinguish between the two.
m_nonSimpleResult = new NonSimpleResult(
NonSimpleResult.Reason.OGCPolylineSelfTangency,
Expand All @@ -546,12 +538,9 @@ boolean checkSelfIntersectionsPolylinePlanar_() {
}
}
} else {
if (!vi.end_point || !vi_prev.end_point) {// one of
// coincident
// vertices is
// not an
// endpoint
m_nonSimpleResult = new NonSimpleResult(
if (!vi.end_point || !vi_prev.end_point) {
//one of coincident vertices is not an endpoint
m_nonSimpleResult = new NonSimpleResult(
NonSimpleResult.Reason.CrossOver, vi.ivertex,
vi_prev.ivertex);
return false;// common point not on the boundary
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/com/esri/core/geometry/TestOGC.java
Original file line number Diff line number Diff line change
Expand Up @@ -1036,4 +1036,13 @@ public void testFlattened() {
ogcGeometry = (OGCConcreteGeometryCollection)OGCGeometry.fromText("GEOMETRYCOLLECTION (MULTIPOINT (1 1), MULTILINESTRING ((1 2, 3 4)), MULTIPOLYGON (((1 2, 3 4, 5 6, 1 2))))");
assertTrue(ogcGeometry.isFlattened());
}

@Test
public void testIssue247IsSimple() {
//https://github.com/Esri/geometry-api-java/issues/247
String wkt = "MULTILINESTRING ((-103.4894322 25.6164519, -103.4889647 25.6159054, -103.489434 25.615654), (-103.489434 25.615654, -103.4894322 25.6164519), (-103.4897361 25.6168342, -103.4894322 25.6164519))";
OGCGeometry ogcGeom = OGCGeometry.fromText(wkt);
boolean b = ogcGeom.isSimple();
assertTrue(b);
}
}

0 comments on commit 73a8be8

Please sign in to comment.