draw triangle implementation