Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1051 | chris | 1 | package com.gebauz.bauzoid.math.collision; |
| 2 | |||
| 3 | /** Axis-aligned bounding box. */ |
||
| 4 | public class AABoundingBox |
||
| 5 | { |
||
| 6 | |||
| 7 | // Constants======================================================================================== |
||
| 8 | |||
| 9 | // Embedded Types=================================================================================== |
||
| 10 | |||
| 11 | // Fields=========================================================================================== |
||
| 12 | |||
| 13 | public float left = 0; |
||
| 14 | public float top = 0; |
||
| 15 | public float bottom = 0; |
||
| 16 | public float right = 0; |
||
| 17 | |||
| 18 | // Methods========================================================================================== |
||
| 19 | |||
| 20 | public AABoundingBox(float l, float t, float r, float b) |
||
| 21 | { |
||
| 22 | left = l; top = t; bottom = b; right = r; |
||
| 23 | } |
||
| 24 | |||
| 25 | public boolean intersetcs(AABoundingBox other) |
||
| 26 | { |
||
| 27 | return !((other.left > right) || |
||
| 28 | (other.right < left) || |
||
| 29 | (other.top > bottom) || |
||
| 30 | (other.bottom < top)); |
||
| 31 | } |
||
| 32 | |||
| 33 | // Getters/Setters================================================================================== |
||
| 34 | |||
| 35 | } |