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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
|
#ifndef __PGS_ELLIPSE_H__
#define __PGS_ELLIPSE_H__
#include "line.h"
/* Ellipse declarations */
/*
* Spherical ellipse data structure. A spherical ellipse is represented using
* two radii and an Euler transformation (ZXZ-axis). The "untransformed" ellipse
* is located on equator at position (0,0). The large radius is along equator.
*/
typedef struct
{
/*
* rad[0] is the large radius, rad[1] is the small radius of an ellipse in
* radians
*/
float8 rad[2];
float8 phi, /* the first rotation angle around z axis */
theta, /* the second rotation angle around x axis */
psi; /* the last rotation angle around z axis */
} SELLIPSE;
/*
* PGS_RELATIONSHIPS
*/
/* PGS_ELLIPSE_LINE_REL Ellipse and line */
#define PGS_ELLIPSE_LINE_AVOID 0 /* ellipse avoids line */
#define PGS_ELLIPSE_CONT_LINE 1 /* ellipse contains line */
#define PGS_ELLIPSE_LINE_OVER 2 /* ellipse overlaps line */
/* PGS_ELLIPSE_CIRCLE_REL Ellipse and circle */
#define PGS_ELLIPSE_CIRCLE_AVOID 0 /* ellipse avoids circle */
#define PGS_CIRCLE_CONT_ELLIPSE 1 /* circle contains ellipse */
#define PGS_ELLIPSE_CONT_CIRCLE 2 /* ellipse contains circle */
#define PGS_ELLIPSE_CIRCLE_EQUAL 3 /* ellipse equals circle */
#define PGS_ELLIPSE_CIRCLE_OVER 4 /* ellipse overlaps circle */
/* PGS_ELLIPSE_ELLIPSE_REL Ellipse and ellipse */
#define PGS_ELLIPSE_AVOID 0 /* ellipse avoids other ellipse */
#define PGS_ELLIPSE_CONT 1 /* ellipse contains other ellipse */
#define PGS_ELLIPSE_OVER 2 /* ellipse overlaps other ellipse */
/*
* Checks whether two ellipses are equal .
*/
bool sellipse_eq(const SELLIPSE *e1, const SELLIPSE *e2);
/*
* Returns the center of an ellipse.
*/
void sellipse_center(SPoint *sp, const SELLIPSE *e);
/*
* Checks whether a ellipse contains point.
*/
bool sellipse_cont_point(const SELLIPSE *se, const SPoint *sp);
/*
* Returns the large axis of an ellipse as line.
*/
bool sellipse_line(SLine *sl, const SELLIPSE *e);
/*
* Relationship between a line and an ellipse as PGS_ELLIPSE_LINE_REL int8 value.
*/
int8 sellipse_line_pos(const SELLIPSE *se, const SLine *sl);
/*
* Relationship between a circle and an ellipse as PGS_ELLIPSE_CIRCLE_REL int8 value.
*/
int8 sellipse_circle_pos(const SELLIPSE *se, const SCIRCLE *sc);
/*
* Returns the Euler transformation of an ellipse.
*/
void sellipse_trans(SEuler *se, const SELLIPSE *e);
/*
* Input of the spherical ellipse.
*/
Datum sphereellipse_in(PG_FUNCTION_ARGS);
/*
* Input of the spherical ellipse from center, axes and inclination.
*/
Datum sphereellipse_infunc(PG_FUNCTION_ARGS);
/*
* Returns the inclination of an ellipse.
*/
Datum sphereellipse_incl(PG_FUNCTION_ARGS);
/*
* Returns the length of the major axis of an ellipse.
*/
Datum sphereellipse_rad1(PG_FUNCTION_ARGS);
/*
* Returns the length of the minor axis of an ellipse.
*/
Datum sphereellipse_rad2(PG_FUNCTION_ARGS);
/*
* Returns the center of an ellipse.
*/
Datum sphereellipse_center(PG_FUNCTION_ARGS);
/*
* Returns the Euler transformation of an ellipse.
*/
Datum sphereellipse_trans(PG_FUNCTION_ARGS);
/*
* Casts a spherical ellipse as circle. The created circle is the boundary
* circle of ellipse. The diameter of returned circle is equal to length of
* major axis of ellipse.
*/
Datum sphereellipse_circle(PG_FUNCTION_ARGS);
/*
* Casts a spherical point to an ellipse.
*/
Datum spherepoint_ellipse(PG_FUNCTION_ARGS);
/*
* Casts a spherical circle to an ellipse.
*/
Datum spherecircle_ellipse(PG_FUNCTION_ARGS);
/*
* Checks whether two ellipses are equal.
*/
Datum sphereellipse_equal(PG_FUNCTION_ARGS);
/*
* Checks whether two ellipses are not equal.
*/
Datum sphereellipse_equal_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse contains a point.
*/
Datum sphereellipse_cont_point(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse doesn't contain a point.
*/
Datum sphereellipse_cont_point_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse contains a point.
*/
Datum sphereellipse_cont_point_com(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse doesn't contain a point.
*/
Datum sphereellipse_cont_point_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse contains a line.
*/
Datum sphereellipse_cont_line(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse doesn't contain a line.
*/
Datum sphereellipse_cont_line_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse contains a line.
*/
Datum sphereellipse_cont_line_com(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse doesn't contain a line.
*/
Datum sphereellipse_cont_line_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse and a line overlap.
*/
Datum sphereellipse_overlap_line(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse and a line don't overlap.
*/
Datum sphereellipse_overlap_line_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse and a line overlap.
*/
Datum sphereellipse_overlap_line_com(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse and a line don't overlap.
*/
Datum sphereellipse_overlap_line_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse contains a circle.
*/
Datum sphereellipse_cont_circle(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse doesn't contain a circle.
*/
Datum sphereellipse_cont_circle_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse contains a circle.
*/
Datum sphereellipse_cont_circle_com(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse doesn't contain a circle.
*/
Datum sphereellipse_cont_circle_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether a circle contains an ellipse.
*/
Datum spherecircle_cont_ellipse(PG_FUNCTION_ARGS);
/*
* Checks whether a circle doesn't contain an ellipse.
*/
Datum spherecircle_cont_ellipse_neg(PG_FUNCTION_ARGS);
/*
* Checks whether a circle contains an ellipse.
*/
Datum spherecircle_cont_ellipse_com(PG_FUNCTION_ARGS);
/*
* Checks whether a circle doesn't contain an ellipse.
*/
Datum spherecircle_cont_ellipse_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether a circle and an ellipse overlap.
*/
Datum sphereellipse_overlap_circle(PG_FUNCTION_ARGS);
/*
* Checks whether a circle and an ellipse don't overlap.
*/
Datum sphereellipse_overlap_circle_neg(PG_FUNCTION_ARGS);
/*
* Checks whether a circle and an ellipse overlap.
*/
Datum sphereellipse_overlap_circle_com(PG_FUNCTION_ARGS);
/*
* Checks whether a circle and an ellipse don't overlap.
*/
Datum sphereellipse_overlap_circle_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse contains other ellipse.
*/
Datum sphereellipse_cont_ellipse(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse doesn't contain other ellipse.
*/
Datum sphereellipse_cont_ellipse_neg(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse is contained by other ellipse.
*/
Datum sphereellipse_cont_ellipse_com(PG_FUNCTION_ARGS);
/*
* Checks whether an ellipse isn't contained by other ellipse.
*/
Datum sphereellipse_cont_ellipse_com_neg(PG_FUNCTION_ARGS);
/*
* Checks whether two ellipses overlap.
*/
Datum sphereellipse_overlap_ellipse(PG_FUNCTION_ARGS);
/*
* Checks whether two ellipses don't overlap.
*/
Datum sphereellipse_overlap_ellipse_neg(PG_FUNCTION_ARGS);
/*
* Transforms an ellipse using an Euler transformation.
*/
Datum spheretrans_ellipse(PG_FUNCTION_ARGS);
/*
* Transforms an ellipse using an Euler transformation.
*/
Datum spheretrans_ellipse_inv(PG_FUNCTION_ARGS);
#endif
|