reimplementing Triangle