intersection and centroid calculation working