Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
arahlin committed Oct 23, 2023
1 parent fa343ba commit ffc614f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions maps/src/FlatSkyProjection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ void FlatSkyProjection::SetDeltaCenter(double delta)
if (fabs(delta) > 90 * deg)
log_fatal("Delta center out of range");
delta0_ = delta;
cosdelta0_ = COS(delta0_ / rad);
sindelta0_ = SIN(delta0_ / rad);
cosdelta0_ = COS(delta0_ / rad);
q0_ = get_origin_rotator(alpha0_, delta0_);
}

Expand Down Expand Up @@ -307,10 +307,9 @@ FlatSkyProjection::XYToAngle(double x, double y) const
break;
}

double dalpha = alpha - alpha0_;

static const double circ = 360 * deg;
static const double halfcirc = 180 * deg;
double dalpha = alpha - alpha0_;

if (dalpha > halfcirc)
alpha -= circ;
Expand Down Expand Up @@ -387,6 +386,7 @@ FlatSkyProjection::QuatToXY(quat q) const

// Rotate to projection center
quat qr = ~q0_ * q * q0_;
double cc = qr.R_component_2();
double k;

switch(proj_) {
Expand All @@ -395,20 +395,19 @@ FlatSkyProjection::QuatToXY(quat q) const
break;
}
case Proj3: {
double c = ASIN(qr.R_component_2());
k = (90 * deg - rad * c) / COS(c);
k = rad * acos(cc) / sqrt((1. - cc) * (1. + cc));
break;
}
case Proj4: {
k = rad * (2. / (1. + qr.R_component_2()));
k = rad * (2. / (1. + cc));
break;
}
case Proj5: {
k = rad * sqrt(2. / (1. + qr.R_component_2()));
k = rad * sqrt(2. / (1. + cc));
break;
}
case Proj6: {
k = rad / qr.R_component_2();
k = rad / cc;
break;
}
default:
Expand Down Expand Up @@ -442,7 +441,7 @@ FlatSkyProjection::XYToQuat(double x, double y) const
if (rho < 1e-8) {
q = quat(0, 1, 0, 0);
} else if (proj_ == Proj2) {
double cc = sqrt(1 - rho * rho);
double cc = sqrt((1. - rho) * (1. + rho));
q = quat(0, cc, x, -y);
} else {
double c;
Expand Down

0 comments on commit ffc614f

Please sign in to comment.