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

Commit5154eba

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 parent1d5edff commit5154eba

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
@@ -1070,13 +1070,20 @@ line_construct_pm(Point *pt, double m)
10701070
{
10711071
LINE*result= (LINE*)palloc(sizeof(LINE));
10721072

1073-
/* use "mx - y + yinter = 0" */
1074-
result->A=m;
1075-
result->B=-1.0;
10761073
if (m==DBL_MAX)
1077-
result->C=pt->y;
1074+
{
1075+
/* vertical - use "x = C" */
1076+
result->A=-1;
1077+
result->B=0;
1078+
result->C=pt->x;
1079+
}
10781080
else
1081+
{
1082+
/* use "mx - y + yinter = 0" */
1083+
result->A=m;
1084+
result->B=-1.0;
10791085
result->C=pt->y-m*pt->x;
1086+
}
10801087

10811088
#ifdefNOT_USED
10821089
result->m=m;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp