adding rectfrompoint
This commit is contained in:
parent
84c959f0df
commit
b350b001da
@ -71,6 +71,12 @@ func PointInRect(p Point2d, r Rect2d) bool {
|
|||||||
return (p.X > r.A.X) && (p.X < r.B.X) && (p.Y > r.A.Y) && (p.Y < r.B.Y)
|
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) Rect2d {
|
||||||
|
return Rect2d{
|
||||||
|
A: Point2d{X: p.X - size, Y: p.Y - size},
|
||||||
|
B: Point2d{X: p.X + size, Y: p.Y + size}}
|
||||||
|
}
|
||||||
|
|
||||||
func RectIntersection(r Rect2d, p Point2d, v Vector2d) (bool, bool, Point2d) {
|
func RectIntersection(r Rect2d, p Point2d, v Vector2d) (bool, bool, Point2d) {
|
||||||
collision := false
|
collision := false
|
||||||
inside := false
|
inside := false
|
||||||
|
Loading…
Reference in New Issue
Block a user