1 /***************************************************************************
2 kstars.h - K Desktop Planetarium
5 copyright : (C) 2002 by Mark Hollomon
6 email : mhh@mindspring.com
7 ***************************************************************************/
8 /***************************************************************************
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 ***************************************************************************/
18 *@short KStars utility functions
19 *@author Mark Hollomon
21 *Static functions for various purposes.
22 *The openDataFile() function searches the standard KDE directories
23 *for the data filename given as an argument.
24 *(it is impossible to instantiate a KSUtils object; just use the static functions).
27 #ifndef KSTARS_KSUTILS_H_
28 #define KSTARS_KSUTILS_H_
34 /**Attempt to open the data file named filename, using the QFile object "file".
35 *First look in the standard KDE directories, then look in a local "data"
36 *subdirectory. If the data file cannot be found or opened, display a warning
38 *@short Open a data file.
39 *@param &file The QFile object to be opened
40 *@param filename The name of the data file.
41 *@returns bool Returns true if data file was opened successfully.
42 *@returns a reference to the opened file.
44 static bool openDataFile( QFile
&file
, const QString
&filename
);
46 /** Lagrange interpolation using a maximum number of 10 points.
47 *@param x[] double array with x values
48 *@param v[] double array with y values
49 *@param n number of points to use for interpolation
50 *@param xval value for which we are looking for the y value.
52 static long double lagrangeInterpolation(const long double x
[], const long double v
[], int n
, long double xval
);
55 /**Constructor. This class is just a collection of static functions, so
56 *we have made the constructor private (so it is not possible to
57 *instantiate a KSUtils object).