28 namespace except = lsst::pex::exceptions;
60 namespace ut = lsst::utils;
63 const long double pi = 3.141592653589793115997963468544;
64 return angleInRadians * 180./pi;
69 const long double pi = 3.141592653589793115997963468544;
70 return angleInDegrees * pi / 180.;
85 ra = round(ra*1e6)/1e6;
88 int hr = (int)
floor(ra/3600.);
91 int mn = (int)
floor(ra/60.);
94 return str(
boost::format(
"%02i:%02i:%05.2f") % hr % mn % ra);
107 string sgn = (dec<0) ?
"-" :
"+";
111 dec = fabs(round(dec*1e6)/1e6);
116 int min = (int)
floor(dec*60);
119 double sec = dec*3600;
120 sec =
floor(sec*100)/100.;
123 return boost::str(
boost::format(
"%s%02i:%02i:%05.2f") % sgn % degrees % min % sec);
159 string regexStr =
"(\\d+)";
160 regexStr.append(delimiter);
161 regexStr.append(
"(\\d+)");
162 regexStr.append(delimiter);
163 regexStr.append(
"([\\d\\.]+)");
165 static const boost::regex re(regexStr);
169 if(! boost::regex_match(raStr.c_str(), what, re)) {
170 string msg= boost::str(
boost::format(
"Failed to parse %s as a declination") % raStr);
176 double hours = std::stod(
string(what[1].first, what[1].second));
177 double mins = std::stod(
string(what[2].first, what[2].second));
178 double secs = std::stod(
string(what[3].first, what[3].second));
180 double raDeg = secs/3600.;
199 string regexStr =
"([\\d]+)";
200 regexStr.append(delimiter);
201 regexStr.append(
"(\\d+)");
202 regexStr.append(delimiter);
203 regexStr.append(
"([\\d\\.]+)");
206 static const boost::regex re(regexStr);
209 if(! boost::regex_search(decStr.c_str(), what, re)) {
210 string msg= boost::str(
boost::format(
"Failed to parse %s as a declination") % decStr);
215 double degrees = std::stod(
string(what[1].first, what[1].second));
216 double mins = std::stod(
string(what[2].first, what[2].second));
217 double secs = std::stod(
string(what[3].first, what[3].second));
219 degrees += ((secs/60.) +mins)/60.;
223 static const boost::regex pm(pmStr);
224 if(boost::regex_search(decStr, pm)) {
double decStrToDeg(std::string decStr, std::string delimiter=":")
std::string decRadToStr(double decRad)
double decStrToRad(std::string decStr, std::string delimiter=":")
double raStrToDeg(std::string raStr, std::string delimiter=":")
double raStrToRad(std::string raStr, std::string delimiter=":")
double radToDeg(long double angleInRadians)
std::string raRadToStr(double raRad)
double degToRad(long double angleInDegrees)
#define LSST_EXCEPT(type,...)
std::string raDecDegToStr(double raDeg, double decDeg)
Extent< int, N > floor(Extent< double, N > const &input)
std::string raDegToStr(double raDeg)
std::string decDegToStr(double decDeg)
std::string raDecRadToStr(double raRad, double decRad)