forked from postgrespro/pgsphere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircle.h
More file actions
160 lines (128 loc) · 3.57 KB
/
circle.h
File metadata and controls
160 lines (128 loc) · 3.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#ifndef __PGS_CIRCLE_H__
#define __PGS_CIRCLE_H__
#include "euler.h"
/* Spherical circle declarations */
/*
* Spherical circle data structure: center and radius.
*/
typedef struct
{
SPoint center; /* the center of circle */
float8 radius; /* the circle radius in radians */
} SCIRCLE;
/*
* Checks whether two circles are equal.
*/
extern bool scircle_eq(const SCIRCLE *c1, const SCIRCLE *c2);
/*
* Checks whether a circle contains a point.
*/
extern bool spoint_in_circle(const SPoint *p, const SCIRCLE *c);
/*
* Transforms a circle using an Euler transformation.
*/
extern void euler_scircle_trans(SCIRCLE *out, const SCIRCLE *in, const SEuler *se);
/*
* Takes the input and stores it as a spherical circle.
*/
extern Datum spherecircle_in(PG_FUNCTION_ARGS);
/*
* Checks whether two circles are equal.
*/
extern Datum spherecircle_equal(PG_FUNCTION_ARGS);
/*
* Checks whether two circles are not equal.
*/
extern Datum spherecircle_equal_neg(PG_FUNCTION_ARGS);
/*
* Calculate the distance of two circles. If they overlap, this function
* returns 0.0.
*/
extern Datum spherecircle_distance(PG_FUNCTION_ARGS);
/*
* Calculate the distance of a circle and a point. If a circle contains a point,
* this function returns 0.0.
*/
extern Datum spherecircle_point_distance(PG_FUNCTION_ARGS);
/*
* Calculate the distance of a point and a circle. If a circle contains a point,
* this function returns 0.0.
*/
extern Datum spherecircle_point_distance_com(PG_FUNCTION_ARGS);
/*
* Checks whether a circle contains a point.
*/
extern Datum spherepoint_in_circle(PG_FUNCTION_ARGS);
/*
* Checks whether a circle doesn't contain a point.
*/
extern Datum spherepoint_in_circle_neg(PG_FUNCTION_ARGS);
/*
* Checks whether a circle contains a point.
*/
extern Datum spherepoint_in_circle_com(PG_FUNCTION_ARGS);
/*
* Checks whether a circle doesn't contain a point.
*/
extern Datum spherepoint_in_circle_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether a circle is contained by other circle.
*/
extern Datum spherecircle_in_circle(PG_FUNCTION_ARGS);
/*
* Checks whether a circle is not contained by other circle.
*/
extern Datum spherecircle_in_circle_neg(PG_FUNCTION_ARGS);
/*
* Checks whether a circle contains other circle.
*/
extern Datum spherecircle_in_circle_com(PG_FUNCTION_ARGS);
/*
* Checks whether circle does not contain other circle.
*/
extern Datum spherecircle_in_circle_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether two circles overlap.
*/
extern Datum spherecircle_overlap(PG_FUNCTION_ARGS);
/*
* Checks whether two circles overlap.
*/
extern Datum spherecircle_overlap_neg(PG_FUNCTION_ARGS);
/*
* Returns the center of a circle.
*/
extern Datum spherecircle_center(PG_FUNCTION_ARGS);
/*
* Returns the radius of a circle.
*/
extern Datum spherecircle_radius(PG_FUNCTION_ARGS);
/*
* Converts a point to a circle.
*/
extern Datum spherepoint_to_circle(PG_FUNCTION_ARGS);
/*
* Creates a circle from center and radius.
*/
extern Datum spherecircle_by_center(PG_FUNCTION_ARGS);
/*
* Creates a circle from center and radius(in degrees).
*/
extern Datum spherecircle_by_center_deg(PG_FUNCTION_ARGS);
/*
* Calculates the area of a circle in square radians.
*/
extern Datum spherecircle_area(PG_FUNCTION_ARGS);
/*
* Calculates the circumference of a circle in radians.
*/
extern Datum spherecircle_circ(PG_FUNCTION_ARGS);
/*
* Transforms a circle using an Euler transformation.
*/
extern Datum spheretrans_circle(PG_FUNCTION_ARGS);
/*
* Inverse transformation of a circle using an Euler transformation.
*/
extern Datum spheretrans_circle_inverse(PG_FUNCTION_ARGS);
#endif