func (t *Triangle) ToPlane() *Plane { v1 := gnr.VectorDifference(t.Points[1], t.Points[0]) v2 := gnr.VectorDifference(t.Points[2], t.Points[0]) normal := gnr.VectorCross(v1, v2) return &Plane{ Normal: normal, Distance: -gnr.VectorProduct(normal, t.Points[0]), } }
func (t *Triangle) Area() float64 { v1 := gnr.VectorDifference(t.Points[1], t.Points[0]) v2 := gnr.VectorDifference(t.Points[2], t.Points[0]) return gnr.VectorCross(v1, v2).Magnitude() / 2 }