#include <uflr/Geometry.h>
#include <iostream>

/* 
Test script to check that the Python implementation is correct (provided the
C++ one is correct to start with)

On my dev system, compile with:

C:\dev\svnips\pianos\v4\scripts>cl cintersect2d_test.cpp /I c:\dev\svnips\tswg2\UNILFingerprintLR\include /I c:\dev\libs\include /link /LIBPATH:c:\dev\svnips\tswg2\UNILFingerprintLR\lib uflr.lib

and run from within C:\dev\svnips\tswg2\UNILFingerprintLR\bin

(This assumes the OpenSceneGraph is installed in c:\dev\libs\[include|lib] and that c:\dev\libs\bin is in the PATH. YMMV)
*/


int main(int argc, char* argv[])
{
	uflr::Point A(0,0), B(10, 0), C(5,-5), D(5,5);
	uflr::Point I0, I1;
	uflr::Segment S1(A,B), S2(C,D);
	
	std::cout << "Calculating the intersection of two segments" << std::endl
		<< "  S1: " << S1 << std::endl
		<< "  S2: " << S2 << std::endl;

	int ret = uflr::intersect2D_Segments(S1, S2, &I0, &I1);
	
	std::cout << "uflr::intersect2D_Segments() returned " << ret << std::endl;
	if (ret == 0)
		std::cout << " no intersections found" << std::endl;
	else if (ret == 1)
		std::cout << " found a unique intersection: " << I0 << std::endl;
	else
		std::cout << " segments are collinear, and overlap from " << I0 << " to " << I1 << std::endl;
	
	return 0;
}
