added triangle function
added some documentation
added a change of orientation in the triangle function