/usr/include/wfmath-0.3/wfmath/const.h is in libwfmath-0.3-dev 0.3.12-3ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | // const.h (Defined constants for the WFMath library)
//
// The WorldForge Project
// Copyright (C) 2001, 2002 The WorldForge Project
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// For information about WorldForge and its authors, please contact
// the Worldforge Web Site at http://www.worldforge.org.
// Author: Ron Steinke
// Created: 2001-12-7
#ifndef WFMATH_CONST_H
#define WFMATH_CONST_H
#include <cfloat>
#ifdef _MSC_VER
#if _MSC_VER < 1500
#error "You are using an older version of MSVC++ with extremely poor"
#error "template support. Please use at least version 2008,"
#error "or try a different compiler."
#endif
#endif
/// Generic library namespace
namespace WFMath {
// WFMath::Foo::toAtlas() has to return a definite type,
// we deal with supporting both 0.4 and 0.6 by forward declaring
// types which we define in the AtlasConv header
class AtlasInType;
class AtlasOutType;
template<int dim> class AxisBox;
template<int dim> class Ball;
template<int dim> class Point;
template<int dim> class Polygon;
template<int dim> class RotBox;
template<int dim> class RotMatrix;
template<int dim> class Segment;
template<int dim> class Vector;
class Quaternion;
// Constants
/// The constant pi
const double Pi = 3.14159265358979323846264338327950288419716939937508;
/// The square root of pi
const double SqrtPi = 1.77245385090551602729816748334114518279754945612237;
/// The natural logarithm of pi
const double LogPi = 1.14472988584940017414342735135305871164729481291530;
/// The square root of 2
const double Sqrt2 = 1.41421356237309504880168872420969807856967187537693;
/// The square root of 3
const double Sqrt3 = 1.73205080756887729352744634150587236694280525381037;
/// The natural logarithm of 2
const double Log2 = 0.69314718055994530941723212145817656807550013436025;
/// Determines how close to machine precision the library tries to come.
#define WFMATH_PRECISION_FUDGE_FACTOR 30
/// How long we can let RotMatrix and Quaternion go before fixing normalization
#define WFMATH_MAX_NORM_AGE ((WFMATH_PRECISION_FUDGE_FACTOR * 2) / 3)
/// Basic floating point type
typedef float CoordType;
/// This is the attempted precision of the library.
#define WFMATH_EPSILON (WFMATH_PRECISION_FUDGE_FACTOR * FLT_EPSILON)
/// Max value of CoordType
#define WFMATH_MAX FLT_MAX
/// Min value of CoordType
#define WFMATH_MIN FLT_MIN
// Basic comparisons
double _ScaleEpsilon(double x1, double x2, double epsilon);
double _ScaleEpsilon(const CoordType* x1, const CoordType* x2,
int length, double epsilon = WFMATH_EPSILON);
/// Test for equality up to precision epsilon
/**
* Returns true if the difference between the numbers is less
* than epsilon. Note that epsilon is multiplied by 2 raised
* to the power of the exponent of the smaller number. So,
* for example, Equal(0.00010000, 0.00010002, 1.0e-4) will not
* compare equal, but Equal(0.00010000, 0.00010002, 1.0e-3) will.
**/
template<class C>
inline bool Equal(const C& c1, const C& c2, double epsilon = WFMATH_EPSILON)
{return c1.isEqualTo(c2, epsilon);}
bool Equal(double x1, double x2, double epsilon = WFMATH_EPSILON);
// Avoid template and expensive casts from float to doubles.
bool Equal(float x1, float x2, double epsilon = WFMATH_EPSILON);
// These let us avoid including <algorithm> for the sake of
// std::max() and std::min().
inline CoordType FloatMax(CoordType a, CoordType b)
{return (a > b) ? a : b;}
inline CoordType FloatMin(CoordType a, CoordType b)
{return (a < b) ? a : b;}
inline CoordType FloatClamp(CoordType val, CoordType min, CoordType max)
{return (min >= val) ? min : (max <= val ? max : val);}
inline double DoubleMax(double a, double b)
{return (a > b) ? a : b;}
inline double DoubleMin(double a, double b)
{return (a < b) ? a : b;}
inline double DoubleClamp(double val, double min, double max)
{return (min >= val) ? min : (max <= val ? max : val);}
} // namespace WFMath
#endif // WFMATH_CONST_H
|