StelSphereGeometry.cpp   StelSphereGeometry.cpp 
skipping to change at line 79 skipping to change at line 79
//! Special constructor for 4 points polygon //! Special constructor for 4 points polygon
Polygon::Polygon(const Vec3d &e0,const Vec3d &e1,const Vec3d &e2, const Vec 3d &e3) Polygon::Polygon(const Vec3d &e0,const Vec3d &e1,const Vec3d &e2, const Vec 3d &e3)
{ {
reserve(4); reserve(4);
push_back(e0); push_back(e0);
push_back(e1); push_back(e1);
push_back(e2); push_back(e2);
push_back(e3); push_back(e3);
} }
ConvexPolygon ConvexPolygon::fullSky()
{
ConvexPolygon poly;
poly.asConvex().push_back(HalfSpace(Vec3d(1.,0.,0.), -1.));
return poly;
}
//! Check if the polygon is valid, i.e. it has no side >180
bool ConvexPolygon::checkValid() const
{
const ConvexS& cvx = asConvex();
const Polygon& poly = asPolygon();
if (cvx.size()<3)
return false;
bool res=true;
for (size_t i=0;i<cvx.size();++i)
{
// Check that all points not on the current convex plane are
included in it
for (size_t p=0;p<cvx.size()-2;++p)
res &= cvx[i].contains(poly[(p+i+2)%poly.size()]);
}
return res;
}
//! Return the convex polygon area in steradians //! Return the convex polygon area in steradians
// TODO Optimize using add oc formulas from http://en.wikipedia.org/wiki/So lid_angle // TODO Optimize using add oc formulas from http://en.wikipedia.org/wiki/So lid_angle
double ConvexPolygon::getArea() const double ConvexPolygon::getArea() const
{ {
// Use Girard's theorem // Use Girard's theorem
double angleSum=0.; double angleSum=0.;
const ConvexS& cvx = asConvex(); const ConvexS& cvx = asConvex();
const int size = cvx.size(); const int size = cvx.size();
if (size==1) if (size==1)
 End of changes. 1 change blocks. 
0 lines changed or deleted 25 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/