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

Commitb0f2d68

Browse files
committed
Fix line_construct_pm() for the case of "infinite" (DBL_MAX) slope.
This code was just plain wrong: what you got was not a line through thegiven point but a line almost indistinguishable from the Y-axis, althoughnot truly vertical. The only caller that tries to use this function withm == DBL_MAX is dist_ps_internal for the case where the lseg is horizontal;it would end up producing the distance from the given point to the placewhere the lseg's line crosses the Y-axis. That function is used by otheroperators too, so there are several operators that could compute wrongdistances from a line segment to something else. Per bug #5745 fromjindiax.Back-patch to all supported branches.
1 parent8f742d1 commitb0f2d68

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎src/backend/utils/adt/geo_ops.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,13 +1072,20 @@ line_construct_pm(Point *pt, double m)
10721072
{
10731073
LINE*result= (LINE*)palloc(sizeof(LINE));
10741074

1075-
/* use "mx - y + yinter = 0" */
1076-
result->A=m;
1077-
result->B=-1.0;
10781075
if (m==DBL_MAX)
1079-
result->C=pt->y;
1076+
{
1077+
/* vertical - use "x = C" */
1078+
result->A=-1;
1079+
result->B=0;
1080+
result->C=pt->x;
1081+
}
10801082
else
1083+
{
1084+
/* use "mx - y + yinter = 0" */
1085+
result->A=m;
1086+
result->B=-1.0;
10811087
result->C=pt->y-m*pt->x;
1088+
}
10821089

10831090
#ifdefNOT_USED
10841091
result->m=m;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp