MySQL 8.1.0
Source Code Documentation
distance_sphere.h
Go to the documentation of this file.
1// Copyright (c) 2017, 2023, Oracle and/or its affiliates.
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License, version 2.0,
5// as published by the Free Software Foundation.
6//
7// This program is also distributed with certain software (including
8// but not limited to OpenSSL) that is licensed under separate terms,
9// as designated in a particular file or component or in included license
10// documentation. The authors of MySQL hereby grant you an additional
11// permission to link the program and your derivative works with the
12// separately licensed software that they have included with MySQL.
13//
14// This program is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License, version 2.0, for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with this program; if not, write to the Free Software
21// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22
23/// @file
24///
25/// Interface for determining the approximate distance between two geometries by
26/// assuming the world is a sphere.
27
28#ifndef SQL_GIS_DISTANCE_SPHERE_H_INCLUDED
29#define SQL_GIS_DISTANCE_SPHERE_H_INCLUDED
30
31#include "sql/dd/types/spatial_reference_system.h" // dd::Spatial_reference_system
32#include "sql/gis/geometries.h" // gis::Geometry
33
34namespace gis {
35
36/// Compute the approximate distance between two geometries by assuming the
37/// world is a sphere.
38///
39/// The coordinate system of the geometries must match the coordinate system of
40/// the SRID. It is the caller's responsibility to guarantee this.
41///
42/// @param[in] srs The spatial reference system.
43/// @param[in] g1 Geometry 1.
44/// @param[in] g2 Geometry 2.
45/// @param[in] func_name Function name used in error reporting.
46/// @param[in] sphere_radius Radius of sphere.
47/// @param[out] result Distance between g1 and g2. Invalid if `result_null`.
48/// @param[out] result_null Whether return value is `NULL` instead of `result`.
49///
50/// @retval false Success.
51/// @retval true An error has occurred. The error has been reported with
52/// my_error().
54 const Geometry *g1, const Geometry *g2,
55 const char *func_name, double sphere_radius,
56 double *result, bool *result_null) noexcept;
57
58} // namespace gis
59
60#endif // include guard
Definition: spatial.h:212
Definition: spatial_reference_system.h:52
This file declares the geometry class hierarchy used by the server as the internal representation of ...
Definition: area.cc:46
bool distance_sphere(const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, const char *func_name, double sphere_radius, double *result, bool *result_null) noexcept
Compute the approximate distance between two geometries by assuming the world is a sphere.
Definition: distance_sphere.cc:145
Definition: result.h:29