I just tried the c program and wrote below.
#include<stdio.h> int check(int i,int j,int i1,int j1, int a, int b,int a1,int b1){ return (\ (((i>a) && (i<a1)) && ((j>b)&&(j<b1))) ||\ (((a>i) && (a<i1)) && ((b>j)&&(b<j1))) ||\ (((i1>a) && (i1<a1)) && ((j1>b)&&(j1<b1))) ||\ (((a1>i) && (a1<i1)) && ((b1>j)&&(b1<j1)))\ ); } int main(){ printf("intersection test:(0,0,100,100),(10,0,1000,1000) :is %s\n",check(0,0,100,100,10,0,1000,1000)?"intersecting":"Not intersecting"); printf("intersection test:(0,0,100,100),(101,101,1000,1000) :is %s\n",check(0,0,100,100,101,101,1000,1000)?"intersecting":"Not intersecting"); return 0; }
Balamurugan A Sept. 15 '13 at 14:57 2013-09-15 14:57
source share