From e719f97a520a8a9e3e8cd560411c7b830b4cb6ec Mon Sep 17 00:00:00 2001
From: Oliver Bock <oliver.bock@aei.mpg.de>
Date: Tue, 13 May 2008 09:43:12 +0200
Subject: [PATCH] Fixed search marker positioning

* Arguments need to be passed in degrees not radians
* Conversion is done right after shared memory parsing (we only need degrees anyway)
---
 EinsteinS5R3Adapter.cpp |  5 +++++
 EinsteinS5R3Adapter.h   | 10 ++++++----
 Starsphere.cpp          |  4 ++--
 StarsphereS5R3.cpp      |  4 ++--
 StarsphereS5R3.h        |  4 ++--
 5 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/EinsteinS5R3Adapter.cpp b/EinsteinS5R3Adapter.cpp
index 5df4e36..03a2bad 100644
--- a/EinsteinS5R3Adapter.cpp
+++ b/EinsteinS5R3Adapter.cpp
@@ -42,6 +42,11 @@ void EinsteinS5R3Adapter::parseApplicationInformation()
 		{		 
 			cerr << "Incompatible shared memory data encountered!" << endl;
 		}
+		else {
+			// convert radians to degrees
+			m_WUSkyPosRightAscension *= 180/PI;
+			m_WUSkyPosDeclination *= 180/PI;
+		}
 	}
 }
 
diff --git a/EinsteinS5R3Adapter.h b/EinsteinS5R3Adapter.h
index 0b83864..8f5d9a7 100644
--- a/EinsteinS5R3Adapter.h
+++ b/EinsteinS5R3Adapter.h
@@ -7,6 +7,8 @@
 
 using namespace std;
 
+#define PI 3.14159265
+
 /**
  * \brief Adapter class which facilitates communications with the \b Einstein\@Home S5R3 application
  * 
@@ -42,14 +44,14 @@ public:
     /**
 	 * \brief Retrieves the right ascension of the currently searched sky position
 	 * 
-	 * \return The right ascension (in radians)
+	 * \return The right ascension (in degrees)
 	 */
     double wuSkyPosRightAscension() const;
     
     /**
 	 * \brief Retrieves the declination of the currently searched sky position
 	 * 
-	 * \return The right ascension (in radians)
+	 * \return The right ascension (in degrees)
 	 */
     double wuSkyPosDeclination() const;
     
@@ -83,10 +85,10 @@ private:
 	/// Pointer to the (parent) BOINC client adapter
 	BOINCClientAdapter *boincClient;
 	
-	/// Right ascension of the currently searched sky position
+	/// Right ascension of the currently searched sky position (in degrees)
 	double m_WUSkyPosRightAscension;
 	
-	/// Declination of the currently searched sky position
+	/// Declination of the currently searched sky position (in degrees)
 	double m_WUSkyPosDeclination;
 	
 	/// The completion fraction of the active work unit
diff --git a/Starsphere.cpp b/Starsphere.cpp
index 52745c1..18a1e92 100644
--- a/Starsphere.cpp
+++ b/Starsphere.cpp
@@ -474,13 +474,13 @@ void Starsphere::make_search_marker(GLfloat RAdeg, GLfloat DEdeg, GLfloat size)
 		glPopMatrix();
 		
 		// searchlight line out to marker (OFF!)
-		if (false) {
+		if(false) {
 			glBegin(GL_LINES);
 				sphVertex3D(RAdeg, DEdeg, 0.50*sphRadius);
 				sphVertex3D(RAdeg, DEdeg, 0.95*sphRadius);
 			glEnd();
 		}
-	
+
 	glEndList();
 }
 
diff --git a/StarsphereS5R3.cpp b/StarsphereS5R3.cpp
index b84d9fc..7203f2b 100644
--- a/StarsphereS5R3.cpp
+++ b/StarsphereS5R3.cpp
@@ -54,7 +54,7 @@ void StarsphereS5R3::refreshBOINCInformation()
 		// we've got a new position, update search marker and HUD
 		m_CurrentRightAscension = m_EinsteinAdapter.wuSkyPosRightAscension();
 		m_RefreshSearchMarker = true;
-		buffer << "Ascension: " << fixed << m_CurrentRightAscension * 360/PI2 << " deg" << ends;
+		buffer << "Ascension: " << fixed << m_CurrentRightAscension << " deg" << ends;
 		m_WUSkyPosRightAscension = buffer.str();
 		buffer.str("");
 	}
@@ -63,7 +63,7 @@ void StarsphereS5R3::refreshBOINCInformation()
 		// we've got a new position, update search marker and HUD
 		m_CurrentDeclination = m_EinsteinAdapter.wuSkyPosDeclination();
 		m_RefreshSearchMarker = true;
-		buffer << "Declination: " << fixed << m_CurrentDeclination * 360/PI2 << " deg" << ends;
+		buffer << "Declination: " << fixed << m_CurrentDeclination << " deg" << ends;
 		m_WUSkyPosDeclination = buffer.str();
 		buffer.str("");
 	}
diff --git a/StarsphereS5R3.h b/StarsphereS5R3.h
index d10388c..80fa995 100644
--- a/StarsphereS5R3.h
+++ b/StarsphereS5R3.h
@@ -79,10 +79,10 @@ private:
 	/// Specialized BOINC client adapter instance for information retrieval
 	EinsteinS5R3Adapter m_EinsteinAdapter;
 	
-	/// Local copy of the current WU's search parameter "Right-Ascension"
+	/// Local copy of the current WU's search parameter "Right-Ascension" (degrees)
 	string m_WUSkyPosRightAscension;
 	
-	/// Local copy of the current WU's search parameter "Declination"
+	/// Local copy of the current WU's search parameter "Declination" (degrees)
 	string m_WUSkyPosDeclination;
 	
 	/// Local copy of the current WU's search parameter "Percent done"
-- 
GitLab