<commit_before><commit_msg>Added Triangle functionality to to floatgeom's points.<commit_after>package floatgeom

//Tri3 is a triangle of Point3s
type Tri3 [3]Point3

//Centroid finds the centroid of a triangle
// Credit goes to github.com/yellingintothefan for their work in gel
func (t Tri3) Centroid(x, y float64) Point3 {
	p := Point3{x, y, 0.0}
	v0 := t[1].Sub(t[0])
	v1 := t[2].Sub(t[0])
	v2 := p.Sub(t[0])
	d00 := v0.Dot(v0)
	d01 := v0.Dot(v1)
	d11 := v1.Dot(v1)
	d20 := v2.Dot(v0)
	d21 := v2.Dot(v1)
	v := (d11*d20 - d01*d21) / (d00*d11 - d01*d01)
	w := (d00*d21 - d01*d20) / (d00*d11 - d01*d01)
	u := 1.0 - v - w
	return Point3{v, w, u}
}
{'fraction_non_alphanumeric': 0.18083462132921174, 'fraction_numerical': 0.11591962905718702, 'mean_word_length': 3.5314685314685317, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2233478', 'n_tokens_mistral': 337, 'n_tokens_neox': 310, 'n_words': 78}