XYToTernary function

Cartesian coordinates to ternary point