minor docs, and namechange

This commit is contained in:
Stephen McQuay 2014-01-07 21:21:43 -08:00
parent 4a1b471742
commit 7d4a2485aa
1 changed files with 3 additions and 1 deletions

View File

@ -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}}