Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 396571d

Browse files
author
Thomas G. Lockhart
committed
Very minor cleanup of no-op code.
1 parent 9b24e7f commit 396571d

File tree

1 file changed

+9
-66
lines changed

1 file changed

+9
-66
lines changed

src/backend/utils/adt/geo_ops.c

+9-66
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.38 1998/10/26 01:01:33 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.39 1998/10/29 18:11:28 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -2733,18 +2733,6 @@ on_pb(Point *pt, BOX *box)
27332733
bool
27342734
on_ppath(Point *pt, PATH *path)
27352735
{
2736-
#if FALSE
2737-
int above,
2738-
next, /* is the seg above the ray? */
2739-
inter, /* # of times path crosses ray */
2740-
hi; /* index inc of higher seg (0,1) */
2741-
double x,
2742-
yh,
2743-
yl,
2744-
xh,
2745-
xl;
2746-
2747-
#endif
27482736
int i,
27492737
n;
27502738
double a,
@@ -2753,8 +2741,9 @@ on_ppath(Point *pt, PATH *path)
27532741
if (!PointerIsValid(pt) || !PointerIsValid(path))
27542742
return FALSE;
27552743

2744+
/*-- OPEN --*/
27562745
if (!path->closed)
2757-
{ /*-- OPEN --*/
2746+
{
27582747
n = path->npts - 1;
27592748
a = point_dt(pt, &path->p[0]);
27602749
for (i = 0; i < n; i++)
@@ -2768,58 +2757,8 @@ on_ppath(Point *pt, PATH *path)
27682757
return FALSE;
27692758
}
27702759

2760+
/*-- CLOSED --*/
27712761
return point_inside(pt, path->npts, path->p);
2772-
#if FALSE
2773-
inter = 0; /*-- CLOSED --*/
2774-
above = FPgt(path->p[0].y, pt->y) ? ABOVE :
2775-
FPlt(path->p[0].y, pt->y) ? BELOW : UNDEF;
2776-
2777-
for (i = 0; i < path->npts; i++)
2778-
{
2779-
hi = path->p[i].y < path->p[NEXT(i)].y;
2780-
2781-
/*
2782-
* must take care of wrap around to original vertex for closed
2783-
* paths
2784-
*/
2785-
yh = (i + hi < path->npts) ? path->p[i + hi].y : path->p[0].y;
2786-
yl = (i + !hi < path->npts) ? path->p[i + !hi].y : path->p[0].y;
2787-
hi = path->p[i].x < path->p[NEXT(i)].x;
2788-
xh = (i + hi < path->npts) ? path->p[i + hi].x : path->p[0].x;
2789-
xl = (i + !hi < path->npts) ? path->p[i + !hi].x : path->p[0].x;
2790-
/* skip seg if it doesn't touch the ray */
2791-
2792-
if (FPeq(yh, yl)) /* horizontal seg? */
2793-
if (FPge(pt->x, xl) && FPle(pt->x, xh) &&
2794-
FPeq(pt->y, yh))
2795-
return TRUE; /* pt lies on seg */
2796-
else
2797-
continue; /* skip other hz segs */
2798-
if (FPlt(yh, pt->y) || /* pt is strictly below seg */
2799-
FPgt(yl, pt->y)) /* strictly above */
2800-
continue;
2801-
2802-
/* seg touches the ray, find out where */
2803-
2804-
x = FPeq(xh, xl) /* vertical seg? */
2805-
? path->p[i].x
2806-
: (pt->y - path->p[i].y) /
2807-
point_sl(&path->p[i],
2808-
&path->p[NEXT(i)]) +
2809-
path->p[i].x;
2810-
if (FPeq(x, pt->x)) /* pt lies on this seg */
2811-
return TRUE;
2812-
2813-
/* does the seg actually cross the ray? */
2814-
2815-
next = FPgt(path->p[NEXT(i)].y, pt->y) ? ABOVE :
2816-
FPlt(path->p[NEXT(i)].y, pt->y) ? BELOW : above;
2817-
inter += FPge(x, pt->x) && next != above;
2818-
above = next;
2819-
}
2820-
return (above == UNDEF || /* path is horizontal */
2821-
inter % 2); /* odd # of intersections */
2822-
#endif
28232762
} /* on_ppath() */
28242763

28252764

@@ -3577,9 +3516,13 @@ path_contain_pt(PATH *path, Point *p)
35773516
if (!PointerIsValid(path) || !PointerIsValid(p))
35783517
return FALSE;
35793518

3580-
return (path->closed ? (point_inside(p, path->npts, &(path->p[0])) != 0) : FALSE);
3519+
return (on_ppath(p, path));
35813520
} /* path_contain_pt() */
35823521

3522+
/* pt_contained_path
3523+
* Point in or on path? This is the same as on_ppath.
3524+
* - thomas 1998-10-29
3525+
*/
35833526
bool
35843527
pt_contained_path(Point *p, PATH *path)
35853528
{

0 commit comments

Comments
 (0)