bool CompareProjection::Compare(const CompareProjection &other) const { return positive(max_delta) && SimpleDistance(corners.top_left, other.corners.top_left, latitude_cos) <= max_delta && SimpleDistance(corners.top_right, other.corners.top_right, latitude_cos) <= max_delta && SimpleDistance(corners.bottom_left, other.corners.bottom_left, latitude_cos) <= max_delta && SimpleDistance(corners.bottom_right, other.corners.bottom_right, latitude_cos) <= max_delta; }
CompareProjection::CompareProjection(const WindowProjection &projection) :corners(projection), latitude_cos(corners.top_left.latitude.fastcosine()), max_delta(SimpleDistance(corners.top_left, corners.top_right, latitude_cos) / projection.GetScreenWidth()) { }
SimpleDistance create_simple_distance(const kernel::Particles &ps) { IMP_USAGE_CHECK(ps.size() == 2, "Two particles should be given"); /****** Set the restraint ******/ IMP_NEW(core::HarmonicUpperBound, h, (0, 1)); IMP_NEW(core::DistanceRestraint, dr, (h, ps[0], ps[1])); /****** Add restraint to the model ******/ //Model *mdl = (*ps)[0]->get_model(); //mdl->add_restraint(dr); /****** Return a SimpleDistance object ******/ return SimpleDistance(dr, h); }