minor docs, and namechange
This commit is contained in:
parent
4a1b471742
commit
7d4a2485aa
@ -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}}
|
||||
|
Loading…
Reference in New Issue
Block a user