2020-07-15 18:05:52 +00:00
|
|
|
// Copyright 2020, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Wrapper header for <math.h> to ensure pi-related math constants are
|
|
|
|
* defined.
|
|
|
|
*
|
|
|
|
* Use this instead of directly including <math.H> in headers and when
|
|
|
|
* you need M_PI and its friends.
|
|
|
|
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
|
|
|
*
|
|
|
|
* @ingroup aux_math
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-12-02 23:41:52 +00:00
|
|
|
#define _USE_MATH_DEFINES // for M_PI // NOLINT
|
2020-07-15 18:05:52 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#include <cmath>
|
|
|
|
#endif
|
|
|
|
|
2021-12-02 23:41:52 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
2021-03-30 18:48:01 +00:00
|
|
|
|
|
|
|
// Might be missing on Windows.
|
|
|
|
#ifndef M_PI
|
|
|
|
#define M_PI (3.14159265358979323846)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Might be missing on Windows.
|
|
|
|
#ifndef M_PIl
|
|
|
|
#define M_PIl (3.14159265358979323846264338327950288)
|
|
|
|
#endif
|
|
|
|
|
2020-07-15 18:05:52 +00:00
|
|
|
#ifndef M_1_PI
|
|
|
|
#define M_1_PI (1. / M_PI)
|
|
|
|
#endif
|