41static bool s_Run_Test_Cases = 
true;
 
   45    if( s_Run_Test_Cases == 
false )
 
   48    s_Run_Test_Cases = 
true;
 
   58    wxASSERT( bbox2d_A.
Area() == 4.0f );
 
   62    wxASSERT( bbox2d_A.
Max() == 
SFVEC2F( 1.0f, 1.0f ) );
 
   63    wxASSERT( bbox2d_A.
Min() == 
SFVEC2F(-1.0f,-1.0f ) );
 
   64    wxASSERT( bbox2d_A.
Intersects( bbox2d_A ) == 
true );
 
   68    bbox2d_A.
Scale( 2.0f );
 
   71    wxASSERT( bbox2d_A.
Area() == 16.0f );
 
   75    wxASSERT( bbox2d_A.
Max() == 
SFVEC2F( 2.0f, 2.0f ) );
 
   76    wxASSERT( bbox2d_A.
Min() == 
SFVEC2F(-2.0f,-2.0f ) );
 
   77    wxASSERT( bbox2d_A.
Intersects( bbox2d_A ) == 
true );
 
   79    wxASSERT( bbox2d_A.
Perimeter() == 16.0f );
 
   82    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
false );
 
   84    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
false );
 
   86    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
false );
 
   89    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
true );
 
   91    bbox2d_A.
Union( bbox2d_B );
 
   94    wxASSERT( bbox2d_A.
Area() == 25.0f );
 
  100    wxASSERT( bbox2d_A.
Max() == 
SFVEC2F( 3.0f, 3.0f ) );
 
  101    wxASSERT( bbox2d_A.
Min() == 
SFVEC2F(-2.0f,-2.0f ) );
 
  102    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
true );
 
  103    wxASSERT( bbox2d_A.
Intersects( bbox2d_A ) == 
true );
 
  105    wxASSERT( bbox2d_A.
Perimeter() == 20.0f );
 
  109    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
true );
 
  110    wxASSERT( bbox2d_B.
Intersects( bbox2d_A ) == 
true );
 
  113    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
true );
 
  116    wxASSERT(  bbox2d_A.
Intersects( bbox2d_B ) == 
false );
 
  119    wxASSERT( bbox2d_A.
Intersects( bbox2d_B ) == 
true );
 
  124    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 2.0f, 2.0f ) ) == 
true );
 
  126    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 2.0f, 3.0f ) ) == 
true );
 
  127    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 3.0f, 2.0f ) ) == 
true );
 
  128    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 1.0f, 2.0f ) ) == 
true );
 
  129    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 2.0f, 1.0f ) ) == 
true );
 
  131    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 2.8f, 2.8f ) ) == 
false );
 
  132    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 2.6f, 2.6f ) ) == 
true );
 
  133    wxASSERT( filledCircle2d.IsPointInside( 
SFVEC2F( 1.2f, 1.2f ) ) == 
false );
 
  136    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
true );
 
  139    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
true );
 
  143    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
false );
 
  146    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
false );
 
  149    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
true );
 
  152    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
true );
 
  155    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
true );
 
  158    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
true );
 
  161    wxASSERT( filledCircle2d.Intersects( bbox2d_B ) == 
true );
 
  167    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 0.0f, 0.0f ) ) == 
true );
 
  168    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 1.0f, 0.0f ) ) == 
true );
 
  169    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F(-1.0f, 0.0f ) ) == 
true );
 
  170    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F(-2.0f, 0.0f ) ) == 
true );
 
  171    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 2.0f, 0.0f ) ) == 
true );
 
  172    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 0.0f, 1.0f ) ) == 
true );
 
  173    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 0.0f,-1.0f ) ) == 
true );
 
  174    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 0.0f, 1.1f ) ) == 
false );
 
  175    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 0.0f,-1.1f ) ) == 
false );
 
  176    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 2.1f, 0.0f ) ) == 
false );
 
  177    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 2.1f, 0.0f ) ) == 
false );
 
  179    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 1.8f, 0.8f ) ) == 
false );
 
  180    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 1.8f,-0.8f ) ) == 
false );
 
  182    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( -1.8f, 0.8f ) ) == 
false );
 
  183    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( -1.8f,-0.8f ) ) == 
false );
 
  185    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 1.6f, 0.6f ) ) == 
true );
 
  186    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( 1.6f,-0.6f ) ) == 
true );
 
  188    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( -1.6f, 0.6f ) ) == 
true );
 
  189    wxASSERT( roundSegment2d.IsPointInside( 
SFVEC2F( -1.6f,-0.6f ) ) == 
true );
 
  192    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
true );
 
  195    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
true );
 
  198    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
true );
 
  201    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
true );
 
  204    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
true );
 
  207    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
false );
 
  210    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
false );
 
  213    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
false );
 
  216    wxASSERT( roundSegment2d.Intersects( bbox2d_A ) == 
false );
 
  219    Polygon2d_TestModule();
 
  229    const RAY topLeft(     ori, glm::normalize( ori - 
SFVEC3F(+1.0,+1.0, z) ) );
 
  230    const RAY topRight(    ori, glm::normalize( ori - 
SFVEC3F(-1.0,+1.0, z) ) );
 
  231    const RAY bottomLeft(  ori, glm::normalize( ori - 
SFVEC3F(+1.0,-1.0, z) ) );
 
  232    const RAY bottomRight( ori, glm::normalize( ori - 
SFVEC3F(-1.0,-1.0, z) ) );
 
  239    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  241    bbox3d.
Set( 
SFVEC3F( -1.0f, -1.0f,  z + z ), 
SFVEC3F( +1.0f, +1.0f, z + z + 1.0f ) );
 
  242    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  245    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  248    wxASSERT( frustum.
Intersect( bbox3d ) == 
false );
 
  250    bbox3d.
Set( 
SFVEC3F( z - 1.0f, z - 1.0f, 0.0 ), 
SFVEC3F( z + 1.0f, z + 1.0f, 1.0 ) );
 
  251    wxASSERT( frustum.
Intersect( bbox3d ) == 
false );
 
  254    wxASSERT( frustum.
Intersect( bbox3d ) == 
false );
 
  257    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  260    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  263    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  266    wxASSERT( frustum.
Intersect( bbox3d ) == 
false );
 
  275    const RAY topLeft( ori, glm::normalize( 
SFVEC3F( -1.0, 1.0, 0.0 ) - ori ) );
 
  276    const RAY topRight( ori, glm::normalize( 
SFVEC3F( +1.0, 1.0, 0.0 ) - ori ) );
 
  277    const RAY bottomLeft( ori, glm::normalize( 
SFVEC3F( -1.0, -1.0, 0.0 ) - ori ) );
 
  278    const RAY bottomRight( ori, glm::normalize( 
SFVEC3F( +1.0, -1.0, 0.0 ) - ori ) );
 
  285    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  287    bbox3d.
Set( 
SFVEC3F( -1.0f, -1.0f, -( z + z ) ), 
SFVEC3F( +1.0f, +1.0f, -( z + z + 1.0f ) ) );
 
  288    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  291    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  297    bbox3d.
Set( 
SFVEC3F( z - 1.0f, z - 1.0f, 0.0), 
SFVEC3F( z + 1.0f, z + 1.0f, 1.0 ) );
 
  298    wxASSERT( frustum.
Intersect( bbox3d ) == 
false );
 
  301    wxASSERT( frustum.
Intersect( bbox3d ) == 
false );
 
  304    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  307    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  310    wxASSERT( frustum.
Intersect( bbox3d ) == 
true );
 
  313    wxASSERT( frustum.
Intersect( bbox3d ) == 
false );
 
2D bounding box class definition.
 
Bounding Box class definition.
 
Implement a frustum that is used for ray packet tests.
 
Manage a bounding box defined by two SFVEC2F min max points.
 
SFVEC2F GetCenter() const
 
bool Intersects(const BBOX_2D &aBBox) const
Test if a bounding box intersects this box.
 
unsigned int MaxDimension() const
 
SFVEC2F GetExtent() const
 
void Union(const SFVEC2F &aPoint)
Recalculate the bounding box adding a point.
 
void Scale(float aScale)
Scale a bounding box by its center.
 
bool IsInitialized() const
Check if this bounding box is already initialized.
 
const SFVEC2F & Min() const
 
float Area() const
Calculate the area of a bounding box.
 
bool Inside(const SFVEC2F &aPoint) const
Check is a point is inside this bounding box.
 
const SFVEC2F & Max() const
 
void Set(const SFVEC2F &aPbMin, const SFVEC2F &aPbMax)
Set bounding box with new parameters.
 
Manage a bounding box defined by two SFVEC3F min max points.
 
void Set(const SFVEC3F &aPbMin, const SFVEC3F &aPbMax)
Set bounding box with new parameters.
 
bool Intersect(const BBOX_3D &aBBox) const
Intersect aBBox with this frustum.
 
void GenerateFrustum(const RAY &topLeft, const RAY &topRight, const RAY &bottomLeft, const RAY &bottomRight)
 
void Run_3d_viewer_test_cases()