Files Classes Functions Hierarchy
#include <circleD2.h>
Public Member Functions | |
| circleD2 (PT const ¢er_, PD const radius_) | |
| Construct a circle. | |
| boolc | intersects (boxOBBhalfspaceD2< PT, PD > &B) |
| Do the circle and box intersect? | |
Public Attributes | |
| PT | center |
| The circles center. | |
| PD | radius |
| Circles radius. | |
Definition at line 12 of file circleD2.h.
| circleD2< PT, PD >::circleD2 | ( | PT const & | center_, | |
| PD const | radius_ | |||
| ) | [inline] |
| boolc circleD2< PT, PD >::intersects | ( | boxOBBhalfspaceD2< PT, PD > & | B | ) | [inline] |
Do the circle and box intersect?
Definition at line 37 of file circleD2.h.
References circleD2< PT, PD >::center, boxOBBhalfspaceD2< PT, PD >::cornerpoints(), line< PT, PD >::nearestpointcapped(), line< PT, PD >::nml, line< PT, PD >::pos, and circleD2< PT, PD >::radius.
Referenced by circleD2test::update01().
00038 { 00039 PT pi[4]; 00040 B.cornerpoints(pi[0],pi[1],pi[2],pi[3]); 00041 00042 PD t; 00043 00044 bool inside=true; 00045 for (uint i=0; i<4; ++i) 00046 { 00047 line<PT,PD> L(pi[(i+1)%4],pi[i],true); 00048 PT normal(-L.nml.y,L.nml.x); 00049 if (normal.dot(center-L.pos)>=0.0) 00050 { 00051 inside=false; 00052 00053 L.nearestpointcapped(t,center); 00054 if ((L(t)-center).dot()<=radius*radius) 00055 return true; 00056 } 00057 } 00058 00059 return inside; 00060 }
The circles center.
Definition at line 17 of file circleD2.h.
Referenced by circleD2< PT, PD >::intersects(), circleD2test::keyboard01(), and circleD2test::update01().
Circles radius.
Definition at line 19 of file circleD2.h.
Referenced by circleD2< PT, PD >::intersects(), and circleD2test::update01().
1.5.8