StelProjector.cpp   StelProjector.cpp 
skipping to change at line 67 skipping to change at line 67
QString StelProjector::getHtmlSummary() const QString StelProjector::getHtmlSummary() const
{ {
return QString("<h3>%1</h3><p>%2</p><b>%3</b>%4").arg(getNameI18()). arg(getDescriptionI18()).arg(q_("Maximum FOV: ")).arg(getMaxFov())+QChar(0x 00B0); return QString("<h3>%1</h3><p>%2</p><b>%3</b>%4").arg(getNameI18()). arg(getDescriptionI18()).arg(q_("Maximum FOV: ")).arg(getMaxFov())+QChar(0x 00B0);
} }
/************************************************************************* /*************************************************************************
Return a convex polygon on the sphere which includes the viewport in the Return a convex polygon on the sphere which includes the viewport in the
current frame current frame
*************************************************************************/ *************************************************************************/
StelGeom::ConvexPolygon StelProjector::getViewportConvexPolygon(double marg inX, double marginY) const SphericalRegionP StelProjector::getViewportConvexPolygon(double marginX, do uble marginY) const
{ {
Vec3d e0, e1, e2, e3; Vec3d e0, e1, e2, e3;
bool ok = unProject(0-marginX,0-marginY,e0); const Vec4i& vp = viewportXywh;
ok &= unProject(getViewportWidth()+marginX,0-marginY,e1); bool ok = unProject(vp[0]-marginX,vp[1]-marginY,e0);
ok &= unProject(getViewportWidth()+marginX,getViewportHeight()+margi ok &= unProject(vp[0]+vp[2]+marginX,vp[1]-marginY,e1);
nY,e2); ok &= unProject(vp[0]+vp[2]+marginX,vp[1]+vp[3]+marginY,e2);
ok &= unProject(0-marginX,getViewportHeight()+marginY,e3); ok &= unProject(vp[0]-marginX,vp[1]+vp[3]+marginY,e3);
if (!ok) if (!ok)
{ {
// Special case for handling degenerated cases, use full sky . // Special case for handling degenerated cases, use full sky .
//qDebug() << "!ok"; //qDebug() << "!ok";
return StelGeom::ConvexPolygon::fullSky(); return SphericalRegionP((SphericalRegion*)(new AllSkySpheric alRegion()));
} }
e0.normalize(); e0.normalize();
e1.normalize(); e1.normalize();
e2.normalize(); e2.normalize();
e3.normalize(); e3.normalize();
StelGeom::ConvexPolygon res = needGlFrontFaceCW() ? StelGeom::Convex if (needGlFrontFaceCW())
Polygon(e1, e0, e3, e2) : StelGeom::ConvexPolygon(e0, e1, e2, e3); {
if (res.checkValid()) Vec3d v = e0;
return res; e0 = e3;
//qDebug() << "!valid"; e3 = v;
return StelGeom::ConvexPolygon::fullSky(); v = e1;
e1 = e2;
e2 = v;
}
const double d = e3*((e2-e3)^(e1-e3));
if (d > 0)
{
SphericalConvexPolygon* res = new SphericalConvexPolygon(e0,
e1, e2, e3);
if (res->checkValid())
{
return SphericalRegionP(res);
}
qDebug() << "!valid";
delete res;
}
//return SphericalRegionP((SphericalRegion*)(new AllSkySphericalRegi
on()));
const SphericalCap& hp = getBoundingSphericalCap();
return SphericalRegionP(new SphericalCap(hp));
} }
// Return a Halfspace containing the whole viewport // Return a Halfspace containing the whole viewport
StelGeom::HalfSpace StelProjector::getBoundingHalfSpace() const SphericalCap StelProjector::getBoundingSphericalCap() const
{ {
StelGeom::HalfSpace result; SphericalCap result;
bool ok = unProject(viewportXywh[0]+0.5*viewportXywh[2], viewportXyw h[1]+0.5*viewportXywh[3], result.n); bool ok = unProject(viewportXywh[0]+0.5*viewportXywh[2], viewportXyw h[1]+0.5*viewportXywh[3], result.n);
Q_ASSERT(ok); // The central point should be at a valid position b y definition Q_ASSERT(ok); // The central point should be at a valid position b y definition
Q_ASSERT(fabs(result.n.lengthSquared()-1.)<0.000001);
// Now need to determine the aperture // Now need to determine the aperture
Vec3d e0,e1,e2,e3,e4,e5; Vec3d e0,e1,e2,e3,e4,e5;
const Vec4i& vp = viewportXywh; const Vec4i& vp = viewportXywh;
ok &= unProject(vp[0],vp[1],e0); ok &= unProject(vp[0],vp[1],e0);
ok &= unProject(vp[0]+vp[2],vp[1],e1); ok &= unProject(vp[0]+vp[2],vp[1],e1);
ok &= unProject(vp[0]+vp[2],vp[1]+vp[3],e2); ok &= unProject(vp[0]+vp[2],vp[1]+vp[3],e2);
ok &= unProject(vp[0],vp[1]+vp[3],e3); ok &= unProject(vp[0],vp[1]+vp[3],e3);
ok &= unProject(vp[0],vp[1]+vp[3]/2,e4); ok &= unProject(vp[0],vp[1]+vp[3]/2,e4);
ok &= unProject(vp[0]+vp[2],vp[1]+vp[3]/2,e5); ok &= unProject(vp[0]+vp[2],vp[1]+vp[3]/2,e5);
if (!ok) if (!ok)
{ {
// Some points were in invalid positions // Some points were in invalid positions, use full sky.
result.d = -1.; result.d = -1.;
return result; return result;
} }
result.d = result.n*e0; result.d = result.n*e0;
double h = result.n*e1; double h = result.n*e1;
if (result.d > h) if (result.d > h)
result.d=h; result.d=h;
h = result.n*e2; h = result.n*e2;
if (result.d > h) if (result.d > h)
result.d=h; result.d=h;
 End of changes. 8 change blocks. 
16 lines changed or deleted 36 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/