• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
ksutils.h
Go to the documentation of this file.
1 /***************************************************************************
2  kstars.h - K Desktop Planetarium
3  -------------------
4  begin : Mon Jan 7 2002
5  copyright : (C) 2002 by Mark Hollomon
6  email : mhh@mindspring.com
7  ***************************************************************************/
8 /***************************************************************************
9  * *
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. *
14  * *
15  ***************************************************************************/
16 
27 #ifndef KSTARS_KSUTILS_H__
28 #define KSTARS_KSUTILS_H__
29 
30 #include <cstddef>
31 #include <Eigen/Core>
32 USING_PART_OF_NAMESPACE_EIGEN
33 #include <QPointF>
34 #include "dms.h"
35 
36 class QFile;
37 class QString;
38 class SkyPoint;
39 
40 namespace KSUtils {
51  bool openDataFile( QFile &file, const QString &filename );
52 
58  template<typename T>
59  inline T clamp(T x, T min, T max) {
60  if( x < min )
61  return min;
62  if( x > max )
63  return max;
64  return x;
65  }
66 
73  template<typename T>
74  inline T reduceAngle(T x, T min, T max) {
75  T delta = max - min;
76  return x - delta*floor( (x-min)/delta );
77  }
78 
82  inline Vector3d fromSperical(dms longitude, dms latitude) {
83  double sinL, sinB;
84  double cosL, cosB;
85  longitude.SinCos( sinL, cosL );
86  latitude.SinCos( sinB, cosB );
87  return Vector3d(cosB*cosL, cosB*sinL, sinB);
88  }
89 
91  inline QPointF vecToPoint(const Vector2f& vec) {
92  return QPointF( vec[0], vec[1] );
93  }
94 
96  inline Vector2f pointToVec(const QPointF& p) {
97  return Vector2f(p.x(),p.y());
98  }
99 
105  QString getDSSURL( const SkyPoint * const p );
106 
116  QString getDSSURL( const dms &ra, const dms &dec, float width = 0, float height = 0, const QString & type = "gif");
117 
129  QString toDirectionString( dms angle );
130 
131 }
132 
133 #endif
KSUtils::reduceAngle
T reduceAngle(T x, T min, T max)
Put angle into range.
Definition: ksutils.h:74
KSUtils::vecToPoint
QPointF vecToPoint(const Vector2f &vec)
Convert a vector to a point.
Definition: ksutils.h:91
KSUtils
KStars utility functions.
KSUtils::openDataFile
bool openDataFile(QFile &file, const QString &filename)
Attempt to open the data file named filename, using the QFile object "file".
dms.h
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
KSUtils::pointToVec
Vector2f pointToVec(const QPointF &p)
Convert a point to a vector.
Definition: ksutils.h:96
KSUtils::getDSSURL
QString getDSSURL(const SkyPoint *const p)
Create a URL to obtain a DSS image for a given SkyPoint.
KSUtils::fromSperical
Vector3d fromSperical(dms longitude, dms latitude)
Convert from spherical to cartesian coordiate system.
Definition: ksutils.h:82
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
KSUtils::clamp
T clamp(T x, T min, T max)
Clamp value into range.
Definition: ksutils.h:59
KSUtils::toDirectionString
QString toDirectionString(dms angle)
Return a string corresponding to an angle specifying direction.
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

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

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal