iOS port of Splitting triangle