spatial/r3: implement Vec.Dot

This commit is contained in:
Sebastien Binet
2020-03-25 15:22:51 +01:00
parent c5a3c90294
commit 2321f504d0
2 changed files with 40 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ func (p Vec) Scale(f float64) Vec {
return p
}
// Dot returns the dot product p·q.
func (p Vec) Dot(q Vec) float64 {
return p.X*q.X + p.Y*q.Y + p.Z*q.Z
}
// Box is a 3D bounding box.
type Box struct {
Min, Max Vec