karbon

vglobal.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, The Karbon Developers
3 Copyright (C) 2002, The Karbon Developers
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef __VGLOBAL_H__
22#define __VGLOBAL_H__
23
24#include <tdeglobal.h>
25
26// define some often used mathematical constants et al:
27
28// TODO: optimize those values.
29
30namespace VGlobal
31{
32 const double pi = 3.14159265358979323846; // pi
33 const double twopi = 6.28318530717958647692; // 2pi
34 const double pi_2 = 1.57079632679489661923; // pi/2
35 const double pi_180 = 0.01745329251994329576; // pi/180
36 const double one_pi_180 = 57.29577951308232087684; // 180/pi
37 const double sqrt2 = 1.41421356237309504880; // sqrt(2)
38 const double one_3 = 0.33333333333333333333; // 1/3
39 const double two_3 = 0.66666666666666666667; // 2/3
40 const double one_6 = 0.16666666666666666667; // 1/6
41 const double one_7 = 0.14285714285714285714; // 1/7
42
47 const double veryBigNumber = 1.0e8;
48 const double verySmallNumber = 1.0e-8;
49
53 const double flatnessTolerance = 0.01;
54
60 const double lengthTolerance = 0.005;
61
68 const double paramLengthTolerance = 0.001;
69
74 const double isNearRange = 0.001;
75
80 const double parallelTolerance = 0.99;
81
85 inline int sign( double a )
86 {
87 return a < 0.0
88 ? -1
89 : 1;
90 }
91
95 int binomialCoeff( unsigned n, unsigned k );
96
100 double factorialLn( unsigned n );
101
105 double gammaLn( double x );
106}
107
108#endif
109