Added triangle function