From 7d4a2485aa7be00b242f9fb2d061b2551dfcb35c Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Tue, 7 Jan 2014 21:21:43 -0800 Subject: [PATCH] minor docs, and namechange --- vectorpoint.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vectorpoint.go b/vectorpoint.go index 92b54e0..fbe2cee 100644 --- a/vectorpoint.go +++ b/vectorpoint.go @@ -4,6 +4,7 @@ import ( "math" ) +// A and B represent two opposite corners of axis-aligned boundin box type AABB2d struct { A Point2d `json:A` B Point2d `json:B` @@ -93,7 +94,8 @@ func PointInRect(p Point2d, r AABB2d) bool { return (p.X > r.A.X) && (p.X < r.B.X) && (p.Y > r.A.Y) && (p.Y < r.B.Y) } -func RectFromPoint(p Point2d, size float32) AABB2d { +func AASquareAtPoint(p Point2d, edgeLength float32) AABB2d { + size := edgeLength / 2.0 return AABB2d{ A: Point2d{X: p.X - size, Y: p.Y - size}, B: Point2d{X: p.X + size, Y: p.Y + size}}