inside triangle routine. not verified