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