Skip to content

Commit 785374f

Browse files
committed
fix comments & code for line
1 parent 57e64aa commit 785374f

File tree

2 files changed

+137
-173
lines changed

2 files changed

+137
-173
lines changed

line.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#include "line.h"
22

3-
/*
4-
* Line functions
5-
*/
3+
/* Line functions */
64

75
PG_FUNCTION_INFO_V1(sphereline_in);
86
PG_FUNCTION_INFO_V1(sphereline_from_point);
@@ -37,8 +35,7 @@ PG_FUNCTION_INFO_V1(spheretrans_line);
3735
PG_FUNCTION_INFO_V1(spheretrans_line_inverse);
3836

3937
/*
40-
* Swaps begin and end of the line. "out" is pointer to the result spherical
41-
* line. "in" is pointer to the input spherical line.
38+
* Swaps the beginning and ending of the line.
4239
*/
4340
static void
4441
sline_swap_beg_end(SLine *out, const SLine *in)
@@ -190,7 +187,6 @@ sline_min_max_lat(const SLine *sl, float8 *minlat, float8 *maxlat)
190187
}
191188
else
192189
{
193-
194190
SEuler se;
195191
SLine nl;
196192
SPoint tp;
@@ -386,7 +382,8 @@ sphereline_circle_pos(const SLine *sl, const SCIRCLE *sc)
386382
}
387383
else if (FPle(((c.center.lat < 0) ? (-c.center.lat) : (c.center.lat)),
388384
c.radius) &&
389-
FPge(c.center.lng, p[0].lng) && FPle(c.center.lng, p[1].lng))
385+
FPge(c.center.lng, p[0].lng) &&
386+
FPle(c.center.lng, p[1].lng))
390387
{
391388
return PGS_CIRCLE_LINE_OVER;
392389
}
@@ -500,8 +497,8 @@ sline_sline_pos(const SLine *l1, const SLine *l2)
500497
/* Check, sl2 is at equator */
501498
if (FPzero(p[2].lat) && FPzero(p[3].lat))
502499
{
503-
bool a1 = spoint_at_sline(&p[2], &sl1);
504-
bool a2 = spoint_at_sline(&p[3], &sl1);
500+
bool a1 = spoint_at_sline(&p[2], &sl1);
501+
bool a2 = spoint_at_sline(&p[3], &sl1);
505502

506503
if (a1 && a2)
507504
{
@@ -648,15 +645,15 @@ sline_center(SPoint *c, const SLine *sl)
648645
Datum
649646
sphereline_in(PG_FUNCTION_ARGS)
650647
{
651-
SLine *sl = (SLine *) palloc(sizeof(SLine));
652-
char *c = PG_GETARG_CSTRING(0);
648+
SLine *sl = (SLine *) palloc(sizeof(SLine));
649+
char *c = PG_GETARG_CSTRING(0);
653650
unsigned char etype[3];
654651
float8 eang[3],
655652
length;
656653
SEuler se,
657-
stmp,
658-
so;
659-
int i;
654+
stmp,
655+
so;
656+
int i;
660657

661658
void sphere_yyparse(void);
662659

@@ -1039,8 +1036,7 @@ spheretrans_line_inverse(PG_FUNCTION_ARGS)
10391036
Datum ret;
10401037

10411038
spheretrans_inverse(&tmp, se);
1042-
ret = DirectFunctionCall2(
1043-
spheretrans_line,
1039+
ret = DirectFunctionCall2(spheretrans_line,
10441040
sl, PointerGetDatum(&tmp));
10451041
PG_RETURN_DATUM(ret);
10461042

0 commit comments

Comments
 (0)