@@ -73,17 +73,17 @@ PG_FUNCTION_INFO_V1(spherebox_cont_box_com_neg);
7373PG_FUNCTION_INFO_V1 (spherebox_overlap_box );
7474PG_FUNCTION_INFO_V1 (spherebox_overlap_box_neg );
7575
76- /*
77- * Checks the box: if latitude of south-west corner is larger than north-east
78- * corner, swap both positions.
79- */
76+ /*
77+ * Checks the box: ifthe latitude ofa south-west corner is larger
78+ * than that of a north-east corner, swap both positions.
79+ */
8080static void
8181sbox_check (SBOX * box )
8282{
8383if (FPgt (box -> sw .lat ,box -> ne .lat ))
8484{
8585/* swap */
86- SPoint sp ;
86+ SPoint sp ;
8787
8888memcpy ((void * )& sp , (void * )& box -> sw ,sizeof (SPoint ));
8989memcpy ((void * )& box -> sw , (void * )& box -> ne ,sizeof (SPoint ));
@@ -96,9 +96,9 @@ sbox_check(SBOX *box)
9696}
9797}
9898
99- /*
100- * Puts" center" of box"b" into point"c" and returns it.
101- */
99+ /*
100+ * Putsthe ' center' ofa boxb' intoa point'c' and returns it.
101+ */
102102static void
103103sbox_center (SPoint * c ,const SBOX * b )
104104{
@@ -108,10 +108,9 @@ sbox_center(SPoint *c, const SBOX *b)
108108c -> lng += PI ;
109109}
110110
111-
112- /*
113- * Relationship between circle and box as PGS_BOX_CIRCLE_REL int8 value.
114- */
111+ /*
112+ * Relationship between a circle and a box as PGS_BOX_CIRCLE_REL int8 value.
113+ */
115114static int8
116115sbox_circle_pos (const SCIRCLE * sc ,const SBOX * sb )
117116{
@@ -129,11 +128,11 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
129128const SPoint tmpn = {0.0 ,PIH };
130129const SPoint tmps = {0.0 ,- PIH };
131130
132- if (spoint_eq (& sb -> ne ,& tmpn )
133- && FPge (sc -> center .lat - sc -> radius ,sb -> sw .lat ))
131+ if (spoint_eq (& sb -> ne ,& tmpn )&&
132+ FPge (sc -> center .lat - sc -> radius ,sb -> sw .lat ))
134133{
135- if (spoint_eq (& sc -> center ,& tmpn )
136- && FPeq (sc -> radius , (PIH - sb -> sw .lat )))
134+ if (spoint_eq (& sc -> center ,& tmpn )&&
135+ FPeq (sc -> radius , (PIH - sb -> sw .lat )))
137136{
138137return PGS_BOX_CIRCLE_EQUAL ;
139138}
@@ -142,11 +141,11 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
142141return PGS_BOX_CONT_CIRCLE ;
143142}
144143}
145- else if (spoint_eq (& sb -> sw ,& tmps )
146- && FPle (sc -> center .lat + sc -> radius ,sb -> ne .lat ))
144+ else if (spoint_eq (& sb -> sw ,& tmps )&&
145+ FPle (sc -> center .lat + sc -> radius ,sb -> ne .lat ))
147146{
148- if (spoint_eq (& sc -> center ,& tmps )
149- && FPeq (sc -> radius , (PIH + sb -> ne .lat )))
147+ if (spoint_eq (& sc -> center ,& tmps )&&
148+ FPeq (sc -> radius , (PIH + sb -> ne .lat )))
150149{
151150return PGS_BOX_CIRCLE_EQUAL ;
152151}
@@ -218,8 +217,8 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
218217}
219218if (bcc && lat_b_cont_c )
220219{
221- bool touw = false,
222- toue = false;
220+ bool touw = false,
221+ toue = false;
223222
224223if (pw == PGS_CIRCLE_LINE_OVER )
225224{
@@ -250,14 +249,14 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
250249}
251250
252251/*
253- * Relationship between line and boxAS PGS_BOX_LINE_REL int8 value.
252+ * Relationship betweena line anda boxas PGS_BOX_LINE_REL int8 value.
254253 */
255254static int8
256255sbox_line_pos (const SLine * sl ,const SBOX * sb )
257256{
258257SPoint p1 ,p2 ,pbg ,ped ;
259258SPoint lc [4 ];
260- int8 pw ,pe ,lcn ,lcs ;
259+ int8 pw ,pe ,lcn ,lcs ;
261260SLine bw ,be ;
262261float8 minlat ,maxlat ;
263262
@@ -307,8 +306,8 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
307306
308307
309308/* special case: east/west boundaries are connected */
310- if ((FPeq (sb -> ne .lat ,PIH )|| FPeq (sb -> sw .lat ,- PIH ))
311- && FPeq (fabs (sb -> sw .lng - sb -> ne .lng ),PI ))
309+ if ((FPeq (sb -> ne .lat ,PIH )|| FPeq (sb -> sw .lat ,- PIH ))&&
310+ FPeq (fabs (sb -> sw .lng - sb -> ne .lng ),PI ))
312311{
313312if (FPeq (sb -> ne .lat ,PIH ))
314313{
@@ -377,8 +376,8 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
377376
378377if (pw && pe )
379378{
380- SPoint sp ;
381- int i ;
379+ SPoint sp ;
380+ int i ;
382381
383382for (i = 0 ;i < lcn ;i ++ )
384383{
@@ -403,7 +402,7 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
403402}
404403else if (!pw && !pe )
405404{
406- int i ;
405+ int i ;
407406
408407for (i = 0 ;i < lcn ;i ++ )
409408{
@@ -417,10 +416,10 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
417416return PGS_BOX_LINE_OVER ;
418417}
419418
420- /*
421- * Returns the relationship between box and path as PGS_BOX_PATH_REL int8
422- * value.
423- */
419+ /*
420+ * Returns the relationship betweena box anda path as
421+ * PGS_BOX_PATH_REL int8 value.
422+ */
424423static int8
425424sbox_path_pos (const SPATH * path ,const SBOX * box )
426425{
@@ -475,8 +474,8 @@ sbox_path_pos(const SPATH *path, const SBOX *box)
475474}
476475
477476/*
478- * Returns the relationship between polygon and box as PGS_BOX_POLY_REL int8
479- * value.
477+ * Returns the relationship betweena polygon anda box as
478+ *PGS_BOX_POLY_REL int8 value.
480479 */
481480static int8
482481sbox_poly_pos (const SPOLY * poly ,const SBOX * box )
@@ -535,13 +534,13 @@ sbox_poly_pos(const SPOLY *poly, const SBOX *box)
535534return PGS_BOX_POLY_AVOID ;
536535}
537536}
538- /* box and polygonare overlapping */
537+ /* box and polygonoverlap */
539538return PGS_BOX_POLY_OVER ;
540539}
541540
542541
543542/*
544- * Relationship between ellipse and box as PGS_BOX_ELLIPSE_REL int8 value.
543+ * Relationship betweenan ellipse and a box as PGS_BOX_ELLIPSE_REL int8 value.
545544 */
546545static int8
547546sbox_ellipse_pos (const SELLIPSE * ell ,const SBOX * box )
@@ -558,7 +557,7 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
558557
559558if (spoint_eq (& box -> sw ,& box -> ne ))
560559{
561- bool scp = sellipse_cont_point (ell ,& box -> sw );
560+ bool scp = sellipse_cont_point (ell ,& box -> sw );
562561
563562if (scp )
564563{
@@ -622,8 +621,8 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
622621{
623622/* full latitude range */
624623if ((po == PGS_CIRCLE_CONT_ELLIPSE
625- || po == PGS_ELLIPSE_CIRCLE_EQUAL )
626- && pi == PGS_ELLIPSE_CIRCLE_AVOID )
624+ || po == PGS_ELLIPSE_CIRCLE_EQUAL )&&
625+ pi == PGS_ELLIPSE_CIRCLE_AVOID )
627626{
628627return PGS_BOX_CONT_ELLIPSE ;
629628}
@@ -643,8 +642,8 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
643642if (FPzero (box -> sw .lng )&& FPeq (box -> ne .lng ,PID ))
644643{
645644/* full latitude range */
646- if (po == PGS_ELLIPSE_CIRCLE_AVOID
647- && pi == PGS_ELLIPSE_CIRCLE_AVOID )
645+ if (po == PGS_ELLIPSE_CIRCLE_AVOID &&
646+ pi == PGS_ELLIPSE_CIRCLE_AVOID )
648647{
649648return PGS_BOX_CONT_ELLIPSE ;
650649}
@@ -673,9 +672,9 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
673672pe == PGS_ELLIPSE_LINE_AVOID )
674673{
675674/* center is between west and east meridians */
676- if ((FPgt (box -> sw .lng ,box -> ne .lng )
677- && (FPle (ec .lng ,box -> ne .lng )|| FPgt (ec .lng ,box -> sw .lng )))
678- || (FPle (box -> sw .lng ,box -> ne .lng )&&
675+ if ((FPgt (box -> sw .lng ,box -> ne .lng )&&
676+ (FPle (ec .lng ,box -> ne .lng )|| FPgt (ec .lng ,box -> sw .lng )))||
677+ (FPle (box -> sw .lng ,box -> ne .lng )&&
679678(FPge (ec .lng ,box -> sw .lng )&& FPle (ec .lng ,box -> ne .lng ))))
680679{
681680if (FPeq (sco .center .lat ,sci .center .lat ))
@@ -694,8 +693,8 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
694693else
695694{
696695/* equator modus */
697- if (po == PGS_ELLIPSE_CIRCLE_AVOID
698- && pi == PGS_ELLIPSE_CIRCLE_AVOID )
696+ if (po == PGS_ELLIPSE_CIRCLE_AVOID &&
697+ pi == PGS_ELLIPSE_CIRCLE_AVOID )
699698{
700699return PGS_BOX_CONT_ELLIPSE ;
701700}
@@ -726,8 +725,9 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
726725sbox_center (& ec ,box );
727726
728727/* ellipse contains box */
729- if (pw == PGS_ELLIPSE_CONT_LINE && pe == PGS_ELLIPSE_CONT_LINE
730- && sellipse_cont_point (ell ,& ec ))
728+ if (pw == PGS_ELLIPSE_CONT_LINE &&
729+ pe == PGS_ELLIPSE_CONT_LINE &&
730+ sellipse_cont_point (ell ,& ec ))
731731{
732732return PGS_ELLIPSE_CONT_BOX ;
733733}
@@ -737,9 +737,9 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
737737
738738}
739739
740- /*
741- * Relationship betweenbox and box as PGS_BOX_REL int8 value.
742- */
740+ /*
741+ * Relationship betweentwo boxes as PGS_BOX_REL int8 value.
742+ */
743743static int8
744744sbox_box_pos (const SBOX * b1 ,const SBOX * b2 ,bool recheck )
745745{
@@ -822,8 +822,8 @@ sbox_eq(SBOX *b1, SBOX *b2)
822822bool
823823sbox_cont_point (const SBOX * b ,const SPoint * p )
824824{
825- if ((FPeq (p -> lat ,b -> ne .lat )&& FPeq (p -> lat ,PIH ))
826- || (FPeq (p -> lat ,b -> sw .lat )&& FPeq (p -> lat ,- PIH )))
825+ if ((FPeq (p -> lat ,b -> ne .lat )&& FPeq (p -> lat ,PIH ))||
826+ (FPeq (p -> lat ,b -> sw .lat )&& FPeq (p -> lat ,- PIH )))
827827{
828828return true;
829829}
@@ -845,7 +845,6 @@ sbox_cont_point(const SBOX *b, const SPoint *p)
845845return true;
846846}
847847
848-
849848Datum
850849spherebox_in (PG_FUNCTION_ARGS )
851850{
@@ -873,7 +872,6 @@ spherebox_in(PG_FUNCTION_ARGS)
873872PG_RETURN_POINTER (box );
874873}
875874
876-
877875Datum
878876spherebox_in_from_points (PG_FUNCTION_ARGS )
879877{
@@ -1496,7 +1494,6 @@ spherebox_overlap_ellipse_com_neg(PG_FUNCTION_ARGS)
14961494PG_RETURN_BOOL (!(sbox_ellipse_pos (e ,b )> PGS_BOX_ELLIPSE_AVOID ));
14971495}
14981496
1499-
15001497Datum
15011498spherebox_cont_box (PG_FUNCTION_ARGS )
15021499{