From d3f6331240c49ca3701505c6d86314f5b8fc3412 Mon Sep 17 00:00:00 2001 From: Stephen Michaelis Date: Sun, 20 Jan 2019 09:56:30 -0500 Subject: [PATCH] Adding a pixel.Vec Floor method to geometry.go --- geometry.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/geometry.go b/geometry.go index 5f16ba4..6642b66 100644 --- a/geometry.go +++ b/geometry.go @@ -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{