File: point.h

package info (click to toggle)
pgsphere 1.1.1%2B2020-10-20-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,700 kB
  • sloc: ansic: 12,032; sql: 6,091; cpp: 853; makefile: 216; perl: 168; yacc: 145; xml: 66; lex: 55; sh: 1
file content (93 lines) | stat: -rw-r--r-- 1,887 bytes parent folder | download | duplicates (3)
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
#ifndef __PGS_POINT_H__
#define __PGS_POINT_H__

#include "vector3d.h"
#include "sbuffer.h"

/* This file contains declarations for spherical point and functions. */

/*
 * The data structure definition of a spherical point.
 */
typedef struct
{
	float8	lng;	/* longitude value in radians */
	float8	lat;	/* latitude value in radians */
} SPoint;

/*
 * Calculate the distance between two spherical points in radians.
 */
float8	spoint_dist(const SPoint *p1, const SPoint *p2);

/*
 * Check whether two points are equal.
 */
bool	spoint_eq(const SPoint *p1, const SPoint *p2);

/*
 * Check the longitude and latitude values of a spherical point.
 */
void	spoint_check(SPoint *spoint);

/*
 * Transforms a 3d vector into a spherical point.
 */
void	vector3d_spoint(SPoint *p, const Vector3D *v);

/*
 * Transforms a spherical point into a 3d vector.
 */
void	spoint_vector3d(Vector3D *v, const SPoint *p);

/*
 * Take the input and store it as a spherical point.
 */
Datum	spherepoint_in(PG_FUNCTION_ARGS);

/*
 * Create a spherical point from longitude and latitude both in radians.
 */
Datum	spherepoint_from_long_lat(PG_FUNCTION_ARGS);

/*
 * Calculate the distance between two spherical points.
 */
Datum	spherepoint_distance(PG_FUNCTION_ARGS);

/*
 * Longitude of a spherical point.
 */
Datum	spherepoint_long(PG_FUNCTION_ARGS);

/*
 * Latitude of a spherical point.
 */
Datum	spherepoint_lat(PG_FUNCTION_ARGS);

/*
 * Cartesian x-value of a spherical point.
 */
Datum	spherepoint_x(PG_FUNCTION_ARGS);

/*
 * Cartesian y-value of a spherical point.
 */
Datum	spherepoint_y(PG_FUNCTION_ARGS);

/*
 * Cartesian z-value of a spherical point.
 */
Datum	spherepoint_z(PG_FUNCTION_ARGS);

/*
 * Cartesian values of a spherical point as an array.
 */
Datum	spherepoint_xyz(PG_FUNCTION_ARGS);

/*
 * Check whether two points are equal.
 */
Datum	spherepoint_equal(PG_FUNCTION_ARGS);

#endif