Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e7111e

Browse files
committed
Fix sline_sline_pos, add tests for degenerate polygons
1 parent710b338 commit5e7111e

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

‎expected/poly.out

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,15 @@ SELECT spoly '{(0d,0d),(10d,10d),(0d,10d),(10d,0d)}';
350350
ERROR: spherepoly_from_array: a line segment overlaps or polygon too large
351351
LINE 1: SELECT spoly '{(0d,0d),(10d,10d),(0d,10d),(10d,0d)}';
352352
^
353+
--- degenerate polygons -----
354+
SELECT spoly '{(0d,1d),(0d,2d),(0d,3d)}';
355+
ERROR: spherepoly_from_array: a line segment overlaps or polygon too large
356+
LINE 1: SELECT spoly '{(0d,1d),(0d,2d),(0d,3d)}';
357+
^
358+
SELECT spoly '{(1d,0d),(2d,0d),(3d,0d)}';
359+
ERROR: spherepoly_from_array: a line segment overlaps or polygon too large
360+
LINE 1: SELECT spoly '{(1d,0d),(2d,0d),(3d,0d)}';
361+
^
353362
--- functions
354363
SELECT npoints( spoly '{(10d,0d),(10d,1d),(15d,0d)}');
355364
npoints

‎sql/poly.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ SELECT spoly_deg(NULL::float8[]);
9696

9797
SELECT spoly'{(0d,0d),(10d,10d),(0d,10d),(10d,0d)}';
9898

99+
--- degenerate polygons -----
100+
101+
SELECT spoly'{(0d,1d),(0d,2d),(0d,3d)}';
102+
103+
SELECT spoly'{(1d,0d),(2d,0d),(3d,0d)}';
104+
99105
--- functions
100106

101107
SELECT npoints( spoly'{(10d,0d),(10d,1d),(15d,0d)}');

‎src/line.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,15 +494,6 @@ sline_sline_pos(const SLine *l1, const SLine *l2)
494494
vector3d_spoint(&p[2],&v[1][0]);
495495
vector3d_spoint(&p[3],&v[1][1]);
496496

497-
/* check connected lines */
498-
if (FPgt(il2->length,0.0)&& (vector3d_eq(&v[0][0],&v[1][0])||
499-
vector3d_eq(&v[0][0],&v[1][1])||
500-
vector3d_eq(&v[0][1],&v[1][0])||
501-
vector3d_eq(&v[0][1],&v[1][1])))
502-
{
503-
returnPGS_LINE_CONNECT;
504-
}
505-
506497
/* Check, sl2 is at equator */
507498
if (FPzero(p[2].lat)&&FPzero(p[3].lat))
508499
{
@@ -527,6 +518,15 @@ sline_sline_pos(const SLine *l1, const SLine *l2)
527518
returnPGS_LINE_AVOID;
528519
}
529520

521+
/* check connected lines */
522+
if (FPgt(il2->length,0.0)&& (vector3d_eq(&v[0][0],&v[1][0])||
523+
vector3d_eq(&v[0][0],&v[1][1])||
524+
vector3d_eq(&v[0][1],&v[1][0])||
525+
vector3d_eq(&v[0][1],&v[1][1])))
526+
{
527+
returnPGS_LINE_CONNECT;
528+
}
529+
530530
/* Now sl2 is not at equator */
531531

532532
if (FPle(il2->length,seg_length))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp