• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

ksutils.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           ksutils.cpp  -  K Desktop Planetarium
00003                              -------------------
00004     begin                : Mon Jan  7 10:48:09 EST 2002
00005     copyright            : (C) 2002 by Mark Hollomon
00006     email                : mhh@mindspring.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include <kstandarddirs.h>
00019 #include <qfile.h>
00020 #include "ksutils.h"
00021 
00022 bool KSUtils::openDataFile( QFile &file, const QString &s ) {
00023     bool result;
00024     QString FileName = locate( "appdata", s );
00025 
00026     if ( !FileName.isNull() ) {
00027         file.setName( FileName );
00028         if ( !file.open( IO_ReadOnly ) ) {
00029             result = false;
00030         } else {
00031             result = true;
00032         }
00033     } else {
00034         result = false;
00035     }
00036 
00037     return result;
00038 }
00039 
00040 long double KSUtils::lagrangeInterpolation( const long double x[], const long double v[], int n, long double xval) {
00041     long double value = 0;
00042     for (int i=1; i<n; ++i) {
00043         long double c = 1.0;
00044         for (int j = 1; j<n;++j) 
00045             if (i != j)
00046                 c *= (xval - x[j]) / (x[i] - x[j]);
00047         value += c *v[i];
00048     }
00049     
00050     return value;
00051 }

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal