add vec_functs.tcc and use it in LogicalSegment.cpp/h