adding basic functions to polygon.c and a couple of fixes to polyline