Example #1
0
int main()
{
    point
	l1={1,2},
	r1={2,1},
	l2={1,2},
	r2={4,1};

    printf("%d\n",doOverlap(l1,r1,l2,r2));

    return 0;
}
Example #2
0
boost::shared_ptr<hier::BoxOverlap>
OuterfaceGeometry::calculateOverlap(
   const hier::BoxGeometry& dst_geometry,
   const hier::BoxGeometry& src_geometry,
   const hier::Box& src_mask,
   const hier::Box& fill_box,
   const bool overwrite_interior,
   const hier::Transformation& transformation,
   const bool retry,
   const hier::BoxContainer& dst_restrict_boxes) const
{

   TBOX_ASSERT_OBJDIM_EQUALITY2(d_box, src_mask);

   const FaceGeometry* t_dst_face =
      dynamic_cast<const FaceGeometry *>(&dst_geometry);
   const OuterfaceGeometry* t_dst_oface =
      dynamic_cast<const OuterfaceGeometry *>(&dst_geometry);
   const OuterfaceGeometry* t_src =
      dynamic_cast<const OuterfaceGeometry *>(&src_geometry);

   boost::shared_ptr<hier::BoxOverlap> over;

   if ((t_src != 0) && (t_dst_face != 0)) {
      over = doOverlap(*t_dst_face, *t_src, src_mask, fill_box,
            overwrite_interior,
            transformation, dst_restrict_boxes);
   } else if ((t_src != 0) && (t_dst_oface != 0)) {
      over = doOverlap(*t_dst_oface, *t_src, src_mask, fill_box,
            overwrite_interior,
            transformation, dst_restrict_boxes);
   } else if (retry) {
      over = src_geometry.calculateOverlap(dst_geometry, src_geometry,
            src_mask, fill_box, overwrite_interior,
            transformation, false,
            dst_restrict_boxes);
   }
   return over;

}