testSphereGeometry.cpp   testStelSphereGeometry.cpp 
#include <config.h> #include <config.h>
#include <QtDebug> #include <QtDebug>
#include "SphereGeometry.hpp" #include "StelSphereGeometry.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
void _assert(bool b, QString msg = "") void _assert(bool b, QString msg = "")
{ {
if (!b) if (!b)
{ {
qFatal("FAILED: %s", qPrintable(msg)); qFatal("FAILED: %s", qPrintable(msg));
} }
} }
skipping to change at line 91 skipping to change at line 91
StelUtils::spheToRect(-deg2, +deg5, v3); StelUtils::spheToRect(-deg2, +deg5, v3);
StelGeom::ConvexPolygon squareVerti(v3, v2, v1, v0); StelGeom::ConvexPolygon squareVerti(v3, v2, v1, v0);
_assert(!contains(squareHoriz, squareVerti), "Special intersect cont ains failure"); _assert(!contains(squareHoriz, squareVerti), "Special intersect cont ains failure");
_assert(!contains(squareVerti, squareHoriz), "Special intersect cont ains failure"); _assert(!contains(squareVerti, squareHoriz), "Special intersect cont ains failure");
_assert(intersect(squareHoriz, squareVerti), "Special intersect fail ure"); _assert(intersect(squareHoriz, squareVerti), "Special intersect fail ure");
_assert(intersect(squareVerti, squareHoriz), "Special intersect fail ure"); _assert(intersect(squareVerti, squareHoriz), "Special intersect fail ure");
qDebug() << "Passed intersection tests"; qDebug() << "Passed intersection tests";
} }
void testPlaneIntersect2()
{
Vec3d p1,p2;
Vec3d vx(1,0,0);
Vec3d vz(0,0,1);
StelGeom::HalfSpace hx(vx, 0);
StelGeom::HalfSpace hz(vz, 0);
_assert(StelGeom::planeIntersect2(hx, hz, p1, p2)==true, "Plane inte
rsect failed");
_assert(p1==Vec3d(0,-1,0));
_assert(p2==Vec3d(0,1,0));
_assert(StelGeom::planeIntersect2(hx, hx, p1, p2)==false, "Plane non
-intersecting failure");
hx.d = std::sqrt(2.)/2.;
_assert(StelGeom::planeIntersect2(hx, hz, p1, p2)==true, "Plane/conv
ex intersect failed");
Vec3d res(p1-Vec3d(hx.d,-hx.d,0));
_assert(res.length()<0.0000001, QString("p1 wrong: %1").arg(p1.toStr
ing()));
res = p2-Vec3d(hx.d,hx.d,0);
_assert(res.length()<0.0000001, QString("p2 wrong: %1").arg(p2.toStr
ing()));
}
/************************************************************************ /************************************************************************
Run several of the time-related functions through paces. Run several of the time-related functions through paces.
************************************************************************/ ************************************************************************/
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
testHalfSpace(); testHalfSpace();
testContains(); testContains();
testPlaneIntersect2();
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 27 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/