• 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
  • skyobjects
skyline.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  skyline.cpp - K Desktop Planetarium
3  -------------------
4  begin : Mon June 26 2006
5  copyright : (C) 2006 by Jason Harris
6  email : kstarss@30doradus.org
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
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. *
15  * *
16  ***************************************************************************/
17 
18 #include "skyline.h"
19 #include "kstarsdata.h"
20 #include "ksnumbers.h"
21 
22 SkyLine::SkyLine()
23 {}
24 
25 SkyLine::~SkyLine() {
26  clear();
27 }
28 
29 void SkyLine::clear() {
30  qDeleteAll( m_pList );
31  m_pList.clear();
32 }
33 
34 void SkyLine::append( SkyPoint *p ) {
35  m_pList.append( new SkyPoint( *p ) );
36 }
37 
38 void SkyLine::setPoint( int i, SkyPoint *p ) {
39  if ( i < 0 || i >= m_pList.size() ) {
40  kDebug() << i18n("SkyLine index error: no such point: %1", i );
41  return;
42  }
43  *m_pList[i] = *p;
44 }
45 
46 dms SkyLine::angularSize( int i ) const{
47  if ( i < 0 || i+1 >= m_pList.size() ) {
48  kDebug() << i18n("SkyLine index error: no such segment: %1", i );
49  return dms();
50  }
51 
52  SkyPoint *p1 = m_pList[i];
53  SkyPoint *p2 = m_pList[i+1];
54  double dalpha = p1->ra().radians() - p2->ra().radians();
55  double ddelta = p1->dec().radians() - p2->dec().radians() ;
56 
57  double sa = sin(dalpha/2.);
58  double sd = sin(ddelta/2.);
59 
60  double hava = sa*sa;
61  double havd = sd*sd;
62 
63  double aux = havd + cos (p1->dec().radians()) * cos(p2->dec().radians()) * hava;
64 
65  dms angDist;
66  angDist.setRadians( 2 * fabs(asin( sqrt(aux) )) );
67 
68  return angDist;
69 }
70 
71 void SkyLine::update( KStarsData *d, KSNumbers *num ) {
72  foreach ( SkyPoint *p, m_pList ) {
73  if ( num )
74  p->updateCoords( num );
75  p->EquatorialToHorizontal( d->lst(), d->geo()->lat() );
76  }
77 }
SkyPoint::ra
const dms & ra() const
Definition: skypoint.h:171
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
KStarsData::lst
dms * lst()
Definition: kstarsdata.h:161
SkyPoint::updateCoords
virtual void updateCoords(KSNumbers *num, bool includePlanets=true, const dms *lat=0, const dms *LST=0, bool forceRecompute=false)
Determine the current coordinates (RA, Dec) from the catalog coordinates (RA0, Dec0), accounting for both precession and nutation.
Definition: skypoint.cpp:317
KStarsData::geo
GeoLocation * geo()
Definition: kstarsdata.h:164
SkyLine::update
void update(KStarsData *data, KSNumbers *num=0)
Definition: skyline.cpp:71
SkyLine::clear
void clear()
Remove all points from list.
Definition: skyline.cpp:29
SkyLine::setPoint
void setPoint(int i, SkyPoint *p)
Set point i in the SkyLine.
Definition: skyline.cpp:38
skyline.h
SkyPoint
The sky coordinates of a point in the sky.
Definition: skypoint.h:50
SkyLine::angularSize
dms angularSize(int i=0) const
Definition: skyline.cpp:46
ksnumbers.h
dms
An angle, stored as degrees, but expressible in many ways.
Definition: dms.h:42
SkyLine::SkyLine
SkyLine()
Default Constructor (empty).
Definition: skyline.cpp:22
SkyPoint::dec
const dms & dec() const
Definition: skypoint.h:174
SkyPoint::EquatorialToHorizontal
void EquatorialToHorizontal(const dms *LST, const dms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates, given the local sidereal time and the observer's latitude.
Definition: skypoint.cpp:55
KSNumbers
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition: ksnumbers.h:43
GeoLocation::lat
const dms * lat() const
Definition: geolocation.h:79
NaN::d
const double d
Definition: nan.h:35
SkyLine::~SkyLine
~SkyLine()
Destructor.
Definition: skyline.cpp:25
kstarsdata.h
SkyLine::append
void append(SkyPoint *p)
Append a segment to the list by adding a new endpoint.
Definition: skyline.cpp:34
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