diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-02-26 04:46:47 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-02-26 04:46:47 +0000 |
commit | a32450a5855eed4bfd756ef292ee45d3c754665b (patch) | |
tree | 26735c3406d9f46d0f39accbe6ff1fb5cc5beedc /src/backend/utils/adt/geo_ops.c | |
parent | 757bf69a2e259c76baed94fa06e792664ab5ed67 (diff) | |
download | postgresql-a32450a5855eed4bfd756ef292ee45d3c754665b.tar.gz postgresql-a32450a5855eed4bfd756ef292ee45d3c754665b.zip |
pgindent run before 6.3 release, with Thomas' requested changes.
Diffstat (limited to 'src/backend/utils/adt/geo_ops.c')
-rw-r--r-- | src/backend/utils/adt/geo_ops.c | 285 |
1 files changed, 143 insertions, 142 deletions
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index c3845fdcc4f..83d3ce90b8f 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.30 1998/02/03 15:55:58 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.31 1998/02/26 04:37:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -135,14 +135,14 @@ single_decode(char *str, float8 *x, char **s) *s = cp; return (TRUE); -} /* single_decode() */ +} /* single_decode() */ static int single_encode(float8 x, char *str) { sprintf(str, "%.*g", digits8, x); return (TRUE); -} /* single_encode() */ +} /* single_encode() */ static int pair_decode(char *str, float8 *x, float8 *y, char **s) @@ -267,7 +267,7 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p) *ss = s; return (TRUE); -} /* path_decode() */ +} /* path_decode() */ static char * path_encode(bool closed, int npts, Point *pt) @@ -315,7 +315,7 @@ path_encode(bool closed, int npts, Point *pt) *cp = '\0'; return (result); -} /* path_encode() */ +} /* path_encode() */ /*------------------------------------------------------------- * pair_count - count the number of points @@ -385,7 +385,7 @@ box_in(char *str) } return (box); -} /* box_in() */ +} /* box_in() */ /* box_out - convert a box to external form. */ @@ -396,7 +396,7 @@ box_out(BOX *box) return (NULL); return (path_encode(-1, 2, (Point *) &(box->high))); -} /* box_out() */ +} /* box_out() */ /* box_construct - fill in a new box. @@ -620,7 +620,7 @@ box_width(BOX *box) *result = box->high.x - box->low.x; return (result); -} /* box_width() */ +} /* box_width() */ /* box_height - returns the height of the box @@ -796,7 +796,7 @@ line_construct_pm(Point *pt, double m) #endif return (result); -} /* line_construct_pm() */ +} /* line_construct_pm() */ static LINE * /* two points */ @@ -850,7 +850,7 @@ line_construct_pp(Point *pt1, Point *pt2) #endif } return (result); -} /* line_construct_pp() */ +} /* line_construct_pp() */ /*---------------------------------------------------------- @@ -875,7 +875,7 @@ line_parallel(LINE *l1, LINE *l2) } return (FPeq(l2->A, l1->A * (l2->B / l1->B))); -} /* line_parallel() */ +} /* line_parallel() */ #ifdef NOT_USED bool @@ -897,7 +897,7 @@ line_perp(LINE *l1, LINE *l2) } return (FPeq(((l1->A * l2->B) / (l1->B * l2->A)), -1.0)); -} /* line_perp() */ +} /* line_perp() */ #endif @@ -908,7 +908,7 @@ line_vertical(LINE *line) return (FPeq(line->A, -1.0) && FPzero(line->B)); #endif return (FPzero(line->B)); -} /* line_vertical() */ +} /* line_vertical() */ static bool line_horizontal(LINE *line) @@ -917,7 +917,7 @@ line_horizontal(LINE *line) return (FPzero(line->m)); #endif return (FPzero(line->A)); -} /* line_horizontal() */ +} /* line_horizontal() */ #ifdef NOT_USED bool @@ -1028,7 +1028,7 @@ line_interpt(LINE *l1, LINE *l2) printf("line_interpt- lines intersect at (%.*g,%.*g)\n", digits8, x, digits8, y); #endif return (result); -} /* line_interpt() */ +} /* line_interpt() */ /*********************************************************************** @@ -1094,7 +1094,7 @@ path_in(char *str) path->closed = (!isopen); return (path); -} /* path_in() */ +} /* path_in() */ char * @@ -1104,7 +1104,7 @@ path_out(PATH *path) return NULL; return (path_encode(path->closed, path->npts, (Point *) &(path->p[0]))); -} /* path_out() */ +} /* path_out() */ /*---------------------------------------------------------- @@ -1157,7 +1157,7 @@ path_isclosed(PATH *path) return FALSE; return (path->closed); -} /* path_isclosed() */ +} /* path_isclosed() */ bool path_isopen(PATH *path) @@ -1166,7 +1166,7 @@ path_isopen(PATH *path) return FALSE; return (!path->closed); -} /* path_isopen() */ +} /* path_isopen() */ int4 @@ -1176,7 +1176,7 @@ path_npoints(PATH *path) return 0; return (path->npts); -} /* path_npoints() */ +} /* path_npoints() */ PATH * path_close(PATH *path) @@ -1190,7 +1190,7 @@ path_close(PATH *path) result->closed = TRUE; return (result); -} /* path_close() */ +} /* path_close() */ PATH * @@ -1205,7 +1205,7 @@ path_open(PATH *path) result->closed = FALSE; return (result); -} /* path_open() */ +} /* path_open() */ PATH * @@ -1219,7 +1219,7 @@ path_copy(PATH *path) memmove((char *) result, (char *) path, size); return (result); -} /* path_copy() */ +} /* path_copy() */ /* path_inter - @@ -1272,11 +1272,11 @@ path_inter(PATH *p1, PATH *p2) /* if we dropped through, no two segs intersected */ return (FALSE); -} /* path_inter() */ +} /* path_inter() */ /* path_distance() * This essentially does a cartesian product of the lsegs in the - * two paths, and finds the min distance between any two lsegs + * two paths, and finds the min distance between any two lsegs */ double * path_distance(PATH *p1, PATH *p2) @@ -1314,7 +1314,7 @@ path_distance(PATH *p1, PATH *p2) } return (min); -} /* path_distance() */ +} /* path_distance() */ /*---------------------------------------------------------- @@ -1334,7 +1334,7 @@ path_length(PATH *path) *result += point_dt(&path->p[i], &path->p[i + 1]); return (result); -} /* path_length() */ +} /* path_length() */ #ifdef NOT_USED @@ -1349,7 +1349,7 @@ path_ln(PATH *path) result += point_dt(&path->p[i], &path->p[i + 1]); return (result); -} /* path_ln() */ +} /* path_ln() */ #endif @@ -1387,7 +1387,7 @@ point_in(char *str) point->y = y; return (point); -} /* point_in() */ +} /* point_in() */ char * point_out(Point *pt) @@ -1396,7 +1396,7 @@ point_out(Point *pt) return (NULL); return (path_encode(-1, 1, pt)); -} /* point_out() */ +} /* point_out() */ static Point * @@ -1480,7 +1480,7 @@ point_eq(Point *pt1, Point *pt2) bool point_ne(Point *pt1, Point *pt2) { - return (! point_eq(pt1, pt2)); + return (!point_eq(pt1, pt2)); } /*---------------------------------------------------------- @@ -1510,8 +1510,8 @@ double point_dt(Point *pt1, Point *pt2) { #ifdef GEODEBUG -printf("point_dt- segment (%f,%f),(%f,%f) length is %f\n", - pt1->x, pt1->y, pt2->x, pt2->y, HYPOT(pt1->x - pt2->x, pt1->y - pt2->y)); + printf("point_dt- segment (%f,%f),(%f,%f) length is %f\n", + pt1->x, pt1->y, pt2->x, pt2->y, HYPOT(pt1->x - pt2->x, pt1->y - pt2->y)); #endif return (HYPOT(pt1->x - pt2->x, pt1->y - pt2->y)); } @@ -1575,7 +1575,7 @@ lseg_in(char *str) #endif return (lseg); -} /* lseg_in() */ +} /* lseg_in() */ char * @@ -1585,7 +1585,7 @@ lseg_out(LSEG *ls) return (NULL); return (path_encode(FALSE, 2, (Point *) &(ls->p[0]))); -} /* lseg_out() */ +} /* lseg_out() */ /* lseg_construct - @@ -1633,7 +1633,7 @@ lseg_length(LSEG *lseg) result = point_distance(&lseg->p[0], &lseg->p[1]); return (result); -} /* lseg_length() */ +} /* lseg_length() */ /*---------------------------------------------------------- * Relative position routines. @@ -1671,15 +1671,15 @@ lseg_parallel(LSEG *l1, LSEG *l2) #endif return (FPeq(point_sl(&(l1->p[0]), &(l1->p[1])), point_sl(&(l2->p[0]), &(l2->p[1])))); -} /* lseg_parallel() */ +} /* lseg_parallel() */ /* lseg_perp() * Determine if two line segments are perpendicular. * * This code did not get the correct answer for - * '((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg + * '((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg * So, modified it to check explicitly for slope of vertical line - * returned by point_sl() and the results seem better. + * returned by point_sl() and the results seem better. * - thomas 1998-01-31 */ bool @@ -1692,15 +1692,15 @@ lseg_perp(LSEG *l1, LSEG *l2) m2 = point_sl(&(l2->p[0]), &(l2->p[1])); #ifdef GEODEBUG -printf("lseg_perp- slopes are %g and %g\n", m1, m2); + printf("lseg_perp- slopes are %g and %g\n", m1, m2); #endif if (FPzero(m1)) - return(FPeq(m2, DBL_MAX)); + return (FPeq(m2, DBL_MAX)); else if (FPzero(m2)) - return(FPeq(m1, DBL_MAX)); + return (FPeq(m1, DBL_MAX)); return (FPeq(m1 / m2, -1.0)); -} /* lseg_perp() */ +} /* lseg_perp() */ bool lseg_vertical(LSEG *lseg) @@ -1722,7 +1722,7 @@ lseg_eq(LSEG *l1, LSEG *l2) FPeq(l1->p[1].y, l2->p[1].y) && FPeq(l1->p[0].x, l2->p[0].x) && FPeq(l1->p[1].y, l2->p[1].y)); -} /* lseg_eq() */ +} /* lseg_eq() */ bool lseg_ne(LSEG *l1, LSEG *l2) @@ -1731,31 +1731,31 @@ lseg_ne(LSEG *l1, LSEG *l2) !FPeq(l1->p[1].y, l2->p[1].y) || !FPeq(l1->p[0].x, l2->p[0].x) || !FPeq(l1->p[1].y, l2->p[1].y)); -} /* lseg_ne() */ +} /* lseg_ne() */ bool lseg_lt(LSEG *l1, LSEG *l2) { return (FPlt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]))); -} /* lseg_lt() */ +} /* lseg_lt() */ bool lseg_le(LSEG *l1, LSEG *l2) { return (FPle(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]))); -} /* lseg_le() */ +} /* lseg_le() */ bool lseg_gt(LSEG *l1, LSEG *l2) { return (FPgt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]))); -} /* lseg_gt() */ +} /* lseg_gt() */ bool lseg_ge(LSEG *l1, LSEG *l2) { return (FPge(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]))); -} /* lseg_ge() */ +} /* lseg_ge() */ /*---------------------------------------------------------- @@ -1805,7 +1805,7 @@ lseg_dt(LSEG *l1, LSEG *l2) pfree(d); return (result); -} /* lseg_dt() */ +} /* lseg_dt() */ Point * @@ -1822,7 +1822,7 @@ lseg_center(LSEG *lseg) result->y = (lseg->p[0].y - lseg->p[1].y) / 2; return (result); -} /* lseg_center() */ +} /* lseg_center() */ /* lseg_interpt - @@ -1875,7 +1875,7 @@ lseg_interpt(LSEG *l1, LSEG *l2) pfree(tmp2); return (result); -} /* lseg_interpt() */ +} /* lseg_interpt() */ /*********************************************************************** ** @@ -2158,7 +2158,7 @@ dist_cpoly(CIRCLE *circle, POLYGON *poly) *result = 0; return (result); -} /* dist_cpoly() */ +} /* dist_cpoly() */ /*--------------------------------------------------------------------- @@ -2255,17 +2255,17 @@ close_pl(Point *pt, LINE *line) tmp = line_construct_pm(pt, invm); result = line_interpt(tmp, line); return (result); -} /* close_pl() */ +} /* close_pl() */ /* close_ps() * Closest point on line segment to specified point. * Take the closest endpoint if the point is left, right, - * above, or below the segment, otherwise find the intersection - * point of the segment and its perpendicular through the point. + * above, or below the segment, otherwise find the intersection + * point of the segment and its perpendicular through the point. * * Some tricky code here, relying on boolean expressions - * evaluating to only zero or one to use as an array index. + * evaluating to only zero or one to use as an array index. */ Point * close_ps(Point *pt, LSEG *lseg) @@ -2294,7 +2294,7 @@ close_ps(Point *pt, LSEG *lseg) if (lseg_vertical(lseg)) { #ifdef GEODEBUG -printf("close_ps- segment is vertical\n"); + printf("close_ps- segment is vertical\n"); #endif result = palloc(sizeof(*result)); result->x = lseg->p[0].x; @@ -2304,7 +2304,7 @@ printf("close_ps- segment is vertical\n"); else if (lseg_horizontal(lseg)) { #ifdef GEODEBUG -printf("close_ps- segment is horizontal\n"); + printf("close_ps- segment is horizontal\n"); #endif result = palloc(sizeof(*result)); result->x = pt->x; @@ -2316,7 +2316,7 @@ printf("close_ps- segment is horizontal\n"); tmp = line_construct_pm(pt, invm); result = interpt_sl(lseg, tmp); return (result); -} /* close_ps() */ +} /* close_ps() */ /* close_lseg() * Closest point to l1 on l2. @@ -2352,7 +2352,8 @@ close_lseg(LSEG *l1, LSEG *l2) if (*(d = dist_ps(&l2->p[1], l1)) < dist) { - if (result != NULL) pfree(result); + if (result != NULL) + pfree(result); result = close_ps(&l2->p[1], l1); memcpy(&point, result, sizeof(point)); @@ -2368,7 +2369,7 @@ close_lseg(LSEG *l1, LSEG *l2) } return (result); -} /* close_lseg() */ +} /* close_lseg() */ /* close_pb() * Closest point on or in box to specified point. @@ -2396,7 +2397,7 @@ close_pb(Point *pt, BOX *box) if (*(d = dist_ps(pt, &seg)) < dist) { dist = *d; - memcpy(&lseg,&seg,sizeof(lseg)); + memcpy(&lseg, &seg, sizeof(lseg)); } pfree(d); @@ -2406,7 +2407,7 @@ close_pb(Point *pt, BOX *box) if (*(d = dist_ps(pt, &seg)) < dist) { dist = *d; - memcpy(&lseg,&seg,sizeof(lseg)); + memcpy(&lseg, &seg, sizeof(lseg)); } pfree(d); @@ -2414,19 +2415,19 @@ close_pb(Point *pt, BOX *box) if (*(d = dist_ps(pt, &seg)) < dist) { dist = *d; - memcpy(&lseg,&seg,sizeof(lseg)); + memcpy(&lseg, &seg, sizeof(lseg)); } pfree(d); return (close_ps(pt, &lseg)); -} /* close_pb() */ +} /* close_pb() */ /* close_sl() * Closest point on line to line segment. * * XXX THIS CODE IS WRONG * The code is actually calculating the point on the line segment - * which is backwards from the routine naming convention. + * which is backwards from the routine naming convention. * Copied code to new routine close_ls() but haven't fixed this one yet. * - thomas 1998-01-31 */ @@ -2477,7 +2478,7 @@ close_ls(LINE *line, LSEG *lseg) pfree(d1); pfree(d2); return (result); -} /* close_ls() */ +} /* close_ls() */ /* close_sb() * Closest point on or in box to line segment. @@ -2534,7 +2535,7 @@ close_sb(LSEG *lseg, BOX *box) /* OK, we now have the closest line segment on the box boundary */ return (close_lseg(lseg, &bseg)); -} /* close_sb() */ +} /* close_sb() */ Point * close_lb(LINE *line, BOX *box) @@ -2662,7 +2663,7 @@ on_ppath(Point *pt, PATH *path) if (FPeq(yh, yl)) /* horizontal seg? */ if (FPge(pt->x, xl) && FPle(pt->x, xh) && FPeq(pt->y, yh)) - return (TRUE); /* pt lies on seg */ + return (TRUE); /* pt lies on seg */ else continue; /* skip other hz segs */ if (FPlt(yh, pt->y) || /* pt is strictly below seg */ @@ -2690,7 +2691,7 @@ on_ppath(Point *pt, PATH *path) return (above == UNDEF || /* path is horizontal */ inter % 2); /* odd # of intersections */ #endif -} /* on_ppath() */ +} /* on_ppath() */ bool @@ -2700,7 +2701,7 @@ on_sl(LSEG *lseg, LINE *line) return (FALSE); return (on_pl(&lseg->p[0], line) && on_pl(&lseg->p[1], line)); -} /* on_sl() */ +} /* on_sl() */ bool on_sb(LSEG *lseg, BOX *box) @@ -2709,7 +2710,7 @@ on_sb(LSEG *lseg, BOX *box) return (FALSE); return (on_pb(&lseg->p[0], box) && on_pb(&lseg->p[1], box)); -} /* on_sb() */ +} /* on_sb() */ /*--------------------------------------------------------------------- * inter_ @@ -2738,7 +2739,7 @@ inter_sl(LSEG *lseg, LINE *line) * * Segment completely inside box counts as intersection. * If you want only segments crossing box boundaries, - * try converting box to path first. + * try converting box to path first. * * Optimize for non-intersection by checking for box intersection first. * - thomas 1998-01-30 @@ -2789,7 +2790,7 @@ inter_sb(LSEG *lseg, BOX *box) /* if we dropped through, no two segs intersected */ return (FALSE); -} /* inter_sb() */ +} /* inter_sb() */ /* inter_lb() * Do line and box intersect? @@ -2884,7 +2885,7 @@ make_bound_box(POLYGON *poly) * "x0,y0,...,xn,yn" * also supports the older style "(x1,...,xn,y1,...yn)" *------------------------------------------------------------------*/ -POLYGON * +POLYGON * poly_in(char *str) { POLYGON *poly; @@ -2913,7 +2914,7 @@ poly_in(char *str) make_bound_box(poly); return (poly); -} /* poly_in() */ +} /* poly_in() */ /*--------------------------------------------------------------- * poly_out - convert internal POLYGON representation to the @@ -2927,7 +2928,7 @@ poly_out(POLYGON *poly) return NULL; return (path_encode(TRUE, poly->npts, &(poly->p[0]))); -} /* poly_out() */ +} /* poly_out() */ /*------------------------------------------------------- @@ -3001,7 +3002,7 @@ poly_same(POLYGON *polya, POLYGON *polyb) } return TRUE; #endif -} /* poly_same() */ +} /* poly_same() */ /*----------------------------------------------------------------- * Determine if polygon A overlaps polygon B by determining if @@ -3065,7 +3066,7 @@ poly_contain(POLYGON *polya, POLYGON *polyb) polya->boundbox.low.x, polya->boundbox.low.y, polya->boundbox.high.x, polya->boundbox.high.y); #endif return (FALSE); -} /* poly_contain() */ +} /* poly_contain() */ /*----------------------------------------------------------------- @@ -3085,7 +3086,7 @@ bool poly_contained(POLYGON *polya, POLYGON *polyb) { return (poly_contain(polyb, polya)); -} /* poly_contained() */ +} /* poly_contained() */ /* poly_contain_pt() @@ -3105,7 +3106,7 @@ poly_contain_pt(POLYGON *poly, Point *p) return (FALSE); return (point_inside(p, poly->npts, &(poly->p[0])) != 0); -} /* poly_contain_pt() */ +} /* poly_contain_pt() */ bool pt_contained_poly(Point *p, POLYGON *poly) @@ -3114,7 +3115,7 @@ pt_contained_poly(Point *p, POLYGON *poly) return (FALSE); return (poly_contain_pt(poly, p)); -} /* pt_contained_poly() */ +} /* pt_contained_poly() */ double * @@ -3130,7 +3131,7 @@ poly_distance(POLYGON *polya, POLYGON *polyb) *result = 0; return (result); -} /* poly_distance() */ +} /* poly_distance() */ /*********************************************************************** @@ -3146,7 +3147,7 @@ point(float8 *x, float8 *y) return (NULL); return (point_construct(*x, *y)); -} /* point() */ +} /* point() */ Point * @@ -3163,7 +3164,7 @@ point_add(Point *p1, Point *p2) result->y = (p1->y + p2->y); return (result); -} /* point_add() */ +} /* point_add() */ Point * point_sub(Point *p1, Point *p2) @@ -3179,7 +3180,7 @@ point_sub(Point *p1, Point *p2) result->y = (p1->y - p2->y); return (result); -} /* point_sub() */ +} /* point_sub() */ Point * point_mul(Point *p1, Point *p2) @@ -3195,7 +3196,7 @@ point_mul(Point *p1, Point *p2) result->y = (p1->x * p2->y) + (p1->y * p2->x); return (result); -} /* point_mul() */ +} /* point_mul() */ Point * point_div(Point *p1, Point *p2) @@ -3217,7 +3218,7 @@ point_div(Point *p1, Point *p2) result->y = ((p2->x * p1->y) - (p2->y * p1->x)) / div; return (result); -} /* point_div() */ +} /* point_div() */ /*********************************************************************** @@ -3237,7 +3238,7 @@ box(Point *p1, Point *p2) result = box_construct(p1->x, p2->x, p1->y, p2->y); return (result); -} /* box() */ +} /* box() */ BOX * box_add(BOX *box, Point *p) @@ -3251,7 +3252,7 @@ box_add(BOX *box, Point *p) (box->high.y + p->y), (box->low.y + p->y)); return (result); -} /* box_add() */ +} /* box_add() */ BOX * box_sub(BOX *box, Point *p) @@ -3265,7 +3266,7 @@ box_sub(BOX *box, Point *p) (box->high.y - p->y), (box->low.y - p->y)); return (result); -} /* box_sub() */ +} /* box_sub() */ BOX * box_mul(BOX *box, Point *p) @@ -3285,7 +3286,7 @@ box_mul(BOX *box, Point *p) pfree(low); return (result); -} /* box_mul() */ +} /* box_mul() */ BOX * box_div(BOX *box, Point *p) @@ -3305,7 +3306,7 @@ box_div(BOX *box, Point *p) pfree(low); return (result); -} /* box_div() */ +} /* box_div() */ /*********************************************************************** @@ -3357,7 +3358,7 @@ path_add(PATH *p1, PATH *p2) } return (result); -} /* path_add() */ +} /* path_add() */ /* path_add_pt() * Translation operator. @@ -3380,7 +3381,7 @@ path_add_pt(PATH *path, Point *point) } return (result); -} /* path_add_pt() */ +} /* path_add_pt() */ PATH * path_sub_pt(PATH *path, Point *point) @@ -3400,7 +3401,7 @@ path_sub_pt(PATH *path, Point *point) } return (result); -} /* path_sub_pt() */ +} /* path_sub_pt() */ /* path_mul_pt() @@ -3427,7 +3428,7 @@ path_mul_pt(PATH *path, Point *point) } return (result); -} /* path_mul_pt() */ +} /* path_mul_pt() */ PATH * path_div_pt(PATH *path, Point *point) @@ -3450,7 +3451,7 @@ path_div_pt(PATH *path, Point *point) } return (result); -} /* path_div_pt() */ +} /* path_div_pt() */ bool @@ -3460,7 +3461,7 @@ path_contain_pt(PATH *path, Point *p) return (FALSE); return ((path->closed ? (point_inside(p, path->npts, &(path->p[0])) != 0) : FALSE)); -} /* path_contain_pt() */ +} /* path_contain_pt() */ bool pt_contained_path(Point *p, PATH *path) @@ -3469,7 +3470,7 @@ pt_contained_path(Point *p, PATH *path) return (FALSE); return (path_contain_pt(path, p)); -} /* pt_contained_path() */ +} /* pt_contained_path() */ Point * @@ -3486,9 +3487,9 @@ path_center(PATH *path) result = NULL; return (result); -} /* path_center() */ +} /* path_center() */ -POLYGON * +POLYGON * path_poly(PATH *path) { POLYGON *poly; @@ -3516,7 +3517,7 @@ path_poly(PATH *path) make_bound_box(poly); return (poly); -} /* path_polygon() */ +} /* path_polygon() */ /* upgradepath() @@ -3556,7 +3557,7 @@ upgradepath(PATH *path) } return (result); -} /* upgradepath() */ +} /* upgradepath() */ bool isoldpath(PATH *path) @@ -3565,7 +3566,7 @@ isoldpath(PATH *path) return (FALSE); return (path->npts == (path->p[0].y + 1)); -} /* isoldpath() */ +} /* isoldpath() */ /*********************************************************************** @@ -3581,7 +3582,7 @@ poly_npoints(POLYGON *poly) return (FALSE); return (poly->npts); -} /* poly_npoints() */ +} /* poly_npoints() */ Point * @@ -3605,7 +3606,7 @@ poly_center(POLYGON *poly) } return (result); -} /* poly_center() */ +} /* poly_center() */ BOX * @@ -3619,13 +3620,13 @@ poly_box(POLYGON *poly) box = box_copy(&poly->boundbox); return (box); -} /* poly_box() */ +} /* poly_box() */ /* box_poly() * Convert a box to a polygon. */ -POLYGON * +POLYGON * box_poly(BOX *box) { POLYGON *poly; @@ -3653,7 +3654,7 @@ box_poly(BOX *box) box_fill(&poly->boundbox, box->high.x, box->low.x, box->high.y, box->low.y); return (poly); -} /* box_poly() */ +} /* box_poly() */ PATH * @@ -3680,7 +3681,7 @@ poly_path(POLYGON *poly) } return (path); -} /* poly_path() */ +} /* poly_path() */ /* upgradepoly() @@ -3688,7 +3689,7 @@ poly_path(POLYGON *poly) * Old-style: '(x1,x2,...,y1,y2,...)' * New-style: '(x1,y1,x2,y2,...)' */ -POLYGON * +POLYGON * upgradepoly(POLYGON *poly) { POLYGON *result; @@ -3729,12 +3730,12 @@ upgradepoly(POLYGON *poly) } return (result); -} /* upgradepoly() */ +} /* upgradepoly() */ /* revertpoly() * Reverse effect of upgradepoly(). */ -POLYGON * +POLYGON * revertpoly(POLYGON *poly) { POLYGON *result; @@ -3775,7 +3776,7 @@ revertpoly(POLYGON *poly) } return (result); -} /* revertpoly() */ +} /* revertpoly() */ /*********************************************************************** @@ -3854,7 +3855,7 @@ circle_in(char *str) elog(ERROR, "Bad circle external representation '%s'", str); return (circle); -} /* circle_in() */ +} /* circle_in() */ /* circle_out - convert a circle to external form. */ @@ -3886,7 +3887,7 @@ circle_out(CIRCLE *circle) *cp = '\0'; return (result); -} /* circle_out() */ +} /* circle_out() */ /*---------------------------------------------------------- @@ -3902,7 +3903,7 @@ circle_same(CIRCLE *circle1, CIRCLE *circle2) return (FPeq(circle1->radius, circle2->radius) && FPeq(circle1->center.x, circle2->center.x) && FPeq(circle1->center.y, circle2->center.y)); -} /* circle_same() */ +} /* circle_same() */ /* circle_overlap - does circle1 overlap circle2? */ @@ -3986,37 +3987,37 @@ bool circle_eq(CIRCLE *circle1, CIRCLE *circle2) { return (FPeq(circle_ar(circle1), circle_ar(circle2))); -} /* circle_eq() */ +} /* circle_eq() */ bool circle_ne(CIRCLE *circle1, CIRCLE *circle2) { return (!circle_eq(circle1, circle2)); -} /* circle_ne() */ +} /* circle_ne() */ bool circle_lt(CIRCLE *circle1, CIRCLE *circle2) { return (FPlt(circle_ar(circle1), circle_ar(circle2))); -} /* circle_lt() */ +} /* circle_lt() */ bool circle_gt(CIRCLE *circle1, CIRCLE *circle2) { return (FPgt(circle_ar(circle1), circle_ar(circle2))); -} /* circle_gt() */ +} /* circle_gt() */ bool circle_le(CIRCLE *circle1, CIRCLE *circle2) { return (FPle(circle_ar(circle1), circle_ar(circle2))); -} /* circle_le() */ +} /* circle_le() */ bool circle_ge(CIRCLE *circle1, CIRCLE *circle2) { return (FPge(circle_ar(circle1), circle_ar(circle2))); -} /* circle_ge() */ +} /* circle_ge() */ /*---------------------------------------------------------- @@ -4039,7 +4040,7 @@ circle_copy(CIRCLE *circle) memmove((char *) result, (char *) circle, sizeof(CIRCLE)); return (result); -} /* circle_copy() */ +} /* circle_copy() */ /* circle_add_pt() @@ -4059,7 +4060,7 @@ circle_add_pt(CIRCLE *circle, Point *point) result->center.y += point->y; return (result); -} /* circle_add_pt() */ +} /* circle_add_pt() */ CIRCLE * circle_sub_pt(CIRCLE *circle, Point *point) @@ -4075,7 +4076,7 @@ circle_sub_pt(CIRCLE *circle, Point *point) result->center.y -= point->y; return (result); -} /* circle_sub_pt() */ +} /* circle_sub_pt() */ /* circle_mul_pt() @@ -4099,7 +4100,7 @@ circle_mul_pt(CIRCLE *circle, Point *point) result->radius *= HYPOT(point->x, point->y); return (result); -} /* circle_mul_pt() */ +} /* circle_mul_pt() */ CIRCLE * circle_div_pt(CIRCLE *circle, Point *point) @@ -4119,7 +4120,7 @@ circle_div_pt(CIRCLE *circle, Point *point) result->radius /= HYPOT(point->x, point->y); return (result); -} /* circle_div_pt() */ +} /* circle_div_pt() */ /* circle_area - returns the area of the circle. @@ -4179,7 +4180,7 @@ circle_distance(CIRCLE *circle1, CIRCLE *circle2) *result = 0; return (result); -} /* circle_distance() */ +} /* circle_distance() */ bool @@ -4196,14 +4197,14 @@ circle_contain_pt(CIRCLE *circle, Point *point) pfree(d); return (within); -} /* circle_contain_pt() */ +} /* circle_contain_pt() */ bool pt_contained_circle(Point *point, CIRCLE *circle) { return (circle_contain_pt(circle, point)); -} /* circle_contain_pt() */ +} /* circle_contain_pt() */ /* dist_pc - returns the distance between @@ -4221,7 +4222,7 @@ dist_pc(Point *point, CIRCLE *circle) *result = 0; return (result); -} /* dist_pc() */ +} /* dist_pc() */ /* circle_center - returns the center point of the circle. @@ -4286,7 +4287,7 @@ circle(Point *center, float8 *radius) } -BOX * +BOX * circle_box(CIRCLE *circle) { BOX *box; @@ -4305,7 +4306,7 @@ circle_box(CIRCLE *circle) box->low.y = circle->center.y - delta; return (box); -} /* circle_box() */ +} /* circle_box() */ /* box_circle() * Convert a box to a circle. @@ -4326,10 +4327,10 @@ box_circle(BOX *box) circle->radius = point_dt(&circle->center, &box->high); return (circle); -} /* box_circle() */ +} /* box_circle() */ -POLYGON * +POLYGON * circle_poly(int npts, CIRCLE *circle) { POLYGON *poly; @@ -4403,7 +4404,7 @@ poly_circle(POLYGON *poly) elog(ERROR, "Unable to convert polygon to circle", NULL); return (circle); -} /* poly_circle() */ +} /* poly_circle() */ /*********************************************************************** @@ -4471,7 +4472,7 @@ point_inside(Point *p, int npts, Point plist[]) return 1; } return 0; -} /* point_inside() */ +} /* point_inside() */ /* lseg_crossing() @@ -4534,7 +4535,7 @@ lseg_crossing(double x, double y, double px, double py) return (HIT_IT); return (FPgt((sgn * z), 0) ? 0 : 2 * sgn); } -} /* lseg_crossing() */ +} /* lseg_crossing() */ static bool @@ -4594,4 +4595,4 @@ plist_same(int npts, Point p1[], Point p2[]) } return (FALSE); -} /* plist_same() */ +} /* plist_same() */ |