spatial/r2: implement Vec.Dot

This commit is contained in:
Sebastien Binet
2020-03-25 16:31:48 +01:00
parent 2bf4f914ae
commit 20922778c8
2 changed files with 40 additions and 0 deletions

View File

@@ -30,6 +30,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
}
// Box is a 2D bounding box.
type Box struct {
Min, Max Vec