Adding a pixel.Vec Floor method to geometry.go

This commit is contained in:
Stephen Michaelis 2019-01-20 09:56:30 -05:00
parent ee54171247
commit d3f6331240
1 changed files with 8 additions and 0 deletions

View File

@ -84,6 +84,14 @@ func (u Vec) Sub(v Vec) Vec {
}
}
// Floor returns converts x and y to their integer equivalents.
func (u Vec) Floor(v Vec) Vec {
return Vec{
math.Floor(u.X),
math.Floor(u.Y),
}
}
// To returns the vector from u to v. Equivalent to v.Sub(u).
func (u Vec) To(v Vec) Vec {
return Vec{