[equals][index/examples] Optimize equals(Seg,Seg) and fix index/examples

Use less comparisions in equals(Seg,Seg) - suggested by Menelaos Karavelas
Add missing include to examples - caused by the recent change of the distance/rtree