compilable TriangleDistCheck Fcn