finish basic SegMain.m

Dist.m run time is too long.Maybe I should store the public variance to
save time
and need to see the intersect part more carefully