/src/geos/include/geos/util/math.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2001-2002 Vivid Solutions Inc. |
7 | | * Copyright (C) 2006 Refractions Research Inc. |
8 | | * |
9 | | * This is free software; you can redistribute and/or modify it under |
10 | | * the terms of the GNU Lesser General Public Licence as published |
11 | | * by the Free Software Foundation. |
12 | | * See the COPYING file for more information. |
13 | | * |
14 | | **********************************************************************/ |
15 | | |
16 | | #pragma once |
17 | | |
18 | | namespace geos { |
19 | | namespace util { |
20 | | |
21 | | /// Symmetric Rounding Algorithm |
22 | | double sym_round(double val); |
23 | | |
24 | | /// Asymmetric Rounding Algorithm |
25 | | double java_math_round(double val); |
26 | | |
27 | | /// Equivalent to Java Math.rint() |
28 | | double rint_vc(double val); |
29 | | |
30 | | |
31 | | /// Default rounding method for GEOS |
32 | | /// |
33 | | /// @note Always use this rounding method, to easy easy switching |
34 | | /// between different rounding method for the whole codebase. |
35 | | inline double |
36 | | round(double val) |
37 | 0 | { |
38 | 0 | return java_math_round(val); |
39 | 0 | } |
40 | | |
41 | | /// Equivalent to std::clamp() in C++17 |
42 | | double clamp(double x, double min, double max); |
43 | | |
44 | | } |
45 | | } // namespace geos::util |