1 /***************************************************************************
2 ksutils.cpp - K Desktop Planetarium
4 begin : Mon Jan 7 10:48:09 EST 2002
5 copyright : (C) 2002 by Mark Hollomon
6 email : mhh@mindspring.com
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #include <kstandarddirs.h>
22 bool KSUtils::openDataFile( QFile
&file
, const QString
&s
) {
24 QString FileName
= locate( "appdata", s
);
26 if ( !FileName
.isNull() ) {
27 file
.setName( FileName
);
28 if ( !file
.open( IO_ReadOnly
) ) {
40 long double KSUtils::lagrangeInterpolation( const long double x
[], const long double v
[], int n
, long double xval
) {
41 long double value
= 0;
42 for (int i
=1; i
<n
; ++i
) {
44 for (int j
= 1; j
<n
;++j
)
46 c
*= (xval
- x
[j
]) / (x
[i
] - x
[j
]);