61 const long double pi = 3.141592653589793115997963468544;
62 return angleInRadians * 180./pi;
67 const long double pi = 3.141592653589793115997963468544;
68 return angleInDegrees * pi / 180.;
83 ra = round(ra*1e6)/1e6;
86 int hr = (int)
floor(ra/3600.);
89 int mn = (int)
floor(ra/60.);
92 return boost::str(
boost::format(
"%02i:%02i:%05.2f") % hr % mn % ra);
109 dec = fabs(round(dec*1e6)/1e6);
117 double sec = dec*3600;
118 sec =
floor(sec*100)/100.;
121 return boost::str(
boost::format(
"%s%02i:%02i:%05.2f") % sgn % degrees % min % sec);
162 regexStr.
append(delimiter);
163 regexStr.
append(
"(\\d+)");
164 regexStr.
append(delimiter);
165 regexStr.
append(
"([\\d\\.]+)");
167 const boost::regex re(regexStr);
171 if(! boost::regex_search(inStr.
c_str(), what, re)) {
173 "Failed to parse %s as a right ascension or declination with regex %s")
183 hh_or_dd += (mm + ss/60.0)/60.0;
187 static const boost::regex pm(pmStr);
188 if(boost::regex_search(inStr, pm))
206 return ra_hours * (360.0/24.0);
double decStrToDeg(std::string decStr, std::string delimiter=":")
std::string raDecDegToStr(double raDeg, double decDeg)
std::string decRadToStr(double decRad)
std::string raDecRadToStr(double raRad, double decRad)
AngleUnit constexpr degrees
constant with units of degrees
double sexagesimalStrToDecimal(std::string inStr, std::string delimiter)
Convert a sexagesimal string to a decimal double.
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)
Extent< int, N > floor(Extent< double, N > const &input)
Return the component-wise floor (round towards more negative).
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
double degToRad(long double angleInDegrees)
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
std::string raRadToStr(double raRad)
Convert a right ascension in radians to a string format.
std::string raDegToStr(double raDeg)
std::string decDegToStr(double decDeg)