MobilityDB 1.3
Loading...
Searching...
No Matches
pose.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2025, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2025, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27 *
28 *****************************************************************************/
29
34#ifndef __POSE_H__
35#define __POSE_H__
36
37/* PostgreSQL */
38#include <postgres.h>
39/* MEOS */
40#include <meos.h>
41#include <meos_pose.h>
42
43/*****************************************************************************
44 * Struct definitions
45 *****************************************************************************/
46
55struct Pose
56{
59 uint8_t srid[3];
60 double data[];
61};
62
63/*****************************************************************************
64 * fmgr macros
65 *****************************************************************************/
66
67#define DatumGetPoseP(X) ((Pose *) DatumGetPointer(X))
68#define PosePGetDatum(X) PointerGetDatum(X)
69#define PG_GETARG_POSE_P(X) DatumGetPoseP(PG_GETARG_DATUM(X))
70#define PG_RETURN_POSE_P(X) PG_RETURN_POINTER(X)
71
72/*****************************************************************************/
73
74/* Validity functions */
75
76extern bool ensure_valid_pose_geo(const Pose *pose, const GSERIALIZED *gs);
77extern bool ensure_valid_pose_stbox(const Pose *pose, const STBox *box);
78extern bool ensure_valid_pose_pose(const Pose *pose1, const Pose *pose2);
79extern bool ensure_valid_poseset_pose(const Set *s, const Pose *pose);
80
81/* Collinear and interpolation functions */
82
83extern bool pose_collinear(const Pose *pose1, const Pose *pose2,
84 const Pose *pose3, double ratio);
85extern Pose *posesegm_interpolate(const Pose *start, const Pose *end,
86 double ratio);
87extern long double posesegm_locate(const Pose *start, const Pose *end,
88 const Pose *value);
89
90/* Input/output functions */
91
92extern char *pose_wkt_out(const Pose *pose, bool extended, int maxdd);
93
94extern Pose *pose_parse(const char **str, bool end);
95
96extern Datum datum_pose_point(Datum pose);
98
99/* Transformation functions */
100
101extern Datum datum_pose_round(Datum pose, Datum size);
102
103/* Distance */
104
105extern Datum pose_distance(Datum pose1, Datum pose2);
106
107/* Box functions */
108
109extern bool pose_set_stbox(const Pose *pose, STBox *box);
110extern void posearr_set_stbox(const Datum *values, int count, STBox *box);
111extern bool pose_timestamptz_set_stbox(const Pose *pose, TimestampTz t,
112 STBox *box);
113extern bool pose_tstzspan_set_stbox(const Pose *pose, const Span *p,
114 STBox *box);
115
116/*****************************************************************************/
117
118#endif /* __POSE_H__ */
bool pose_timestamptz_set_stbox(const Pose *pose, TimestampTz t, STBox *box)
Return in the last argument a spatiotemporal box constructed from a pose and a timestamptz.
Definition: tpose_boxops.c:193
void posearr_set_stbox(const Datum *values, int count, STBox *box)
Return in the last argument a spatiotemporal box contructed from an array of poses.
Definition: tpose_boxops.c:82
bool pose_tstzspan_set_stbox(const Pose *pose, const Span *p, STBox *box)
Return in the last argument a spatiotemporal box constructed from a pose and a timestamptz span.
Definition: tpose_boxops.c:231
External API of the Mobility Engine Open Source (MEOS) library.
bool ensure_valid_pose_stbox(const Pose *pose, const STBox *box)
Ensure the validity of a pose and a spatiotemporal box.
Definition: pose.c:87
Datum datum_pose_round(Datum pose, Datum size)
Return a pose with the precision of the values set to a number of decimal places.
Definition: pose.c:980
Datum datum_pose_rotation(Datum pose)
Convert a pose into a geometry point.
Definition: pose.c:904
Pose * pose_parse(const char **str, bool end)
Parse a pose value from the buffer.
Definition: pose.c:347
long double posesegm_locate(const Pose *start, const Pose *end, const Pose *value)
Return a float in (0,1) if a network point segment intersects a network point, return -1....
Definition: pose.c:224
bool pose_set_stbox(const Pose *pose, STBox *box)
Set the spatiotemporal box from the pose value.
Definition: tpose_boxops.c:64
Pose * posesegm_interpolate(const Pose *start, const Pose *end, double ratio)
Return the pose value interpolated from the two poses and a ratio.
Definition: pose.c:137
Datum pose_distance(Datum pose1, Datum pose2)
Return the distance between the two poses.
Definition: pose.c:1167
bool ensure_valid_pose_geo(const Pose *pose, const GSERIALIZED *gs)
Ensure the validity of a pose and a geometry/geography.
Definition: pose.c:73
bool ensure_valid_pose_pose(const Pose *pose1, const Pose *pose2)
Ensure the validity of two circular poses.
Definition: pose.c:100
Datum datum_pose_point(Datum pose)
Convert a pose into a geometry point.
Definition: pose.c:841
char * pose_wkt_out(const Pose *pose, bool extended, int maxdd)
Output a pose in the Well-Known Text (WKT) representation.
Definition: pose.c:498
bool ensure_valid_poseset_pose(const Set *s, const Pose *pose)
Return true if a set and a pose are valid for set operations.
Definition: pose.c:115
bool pose_collinear(const Pose *pose1, const Pose *pose2, const Pose *pose3, double ratio)
Return true if the three values are collinear.
Definition: pose.c:295
int64 TimestampTz
Definition: postgres_ext_defs.in.h:22
signed char int8
Definition: postgres_ext_defs.in.h:9
uintptr_t Datum
Definition: postgres_ext_defs.in.h:7
signed int int32
Definition: postgres_ext_defs.in.h:11
Definition: postgis_ext_defs.in.h:170
int8 flags
flags
Definition: pose.h:58
int32 vl_len_
varlena header (do not touch directly!)
Definition: pose.h:57
uint8_t srid[3]
srid
Definition: pose.h:59
double data[]
position and orientation values
Definition: pose.h:60
Basic functions for static pose objects.
Definition: pose.h:56
Structure to represent spatiotemporal boxes.
Definition: meos.h:134
Structure to represent sets of values.
Definition: meos.h:80
Structure to represent spans (a.k.a.
Definition: meos.h:94
int const GSERIALIZED * gs
Definition: trgeo_spatialrels.h:52