// ==========================================================================
// $Id: virtual.cpp,v 1.1 2011/10/19 03:24:41 jlang Exp $
// CSI2372 example Code for lecture 7
// ==========================================================================
// (C)opyright:
//
//   Jochen Lang
//   EECS, University of Ottawa
//   800 King Edward Ave.
//   Ottawa, On., K1N 6N5
//   Canada. 
//   http://www.eecs.uottawa.ca
// 
// Creator: jlang (Jochen Lang)
// Email:   jlang@eecs.uottawa.ca
// ==========================================================================
// $Log: virtual.cpp,v $
// Revision 1.1  2011/10/19 03:24:41  jlang
// Added code for lecture 7
//
// ==========================================================================
#include <iostream>

#include "point2d.h"
#include "bounds.h"
#include "circle.h"
#include "aa_box.h"

using std::cout;
using std::endl;


// use a reference to base class (could change for pointer)
int isInside( const Bounds& _bounds,
	      const Point2D& pt ) {
  int res = _bounds.isInside( pt );
  return res;
}


int main() {
  AABox aab;
  Circle circ;
  Point2D pts[4];
  cout << "Extrema: ";
  for (int i=0; i<4; ++i ) {
    pts[i] = Point2D( (i+3)%4, (i+1)%4 );
    pts[i].print(); cout << " ";
  }
  aab.enclose( pts, 4 );
  circ.enclose( pts, 4 );
  Point2D pt( 2.0, 3.0 );
  cout << "Query point: "; pt.print(); cout << endl;
  cout << "Inside AA_Box? " << isInside( aab, pt ); cout  << endl;
  cout << "Inside Circle? " << isInside( circ, pt ); cout << endl;
}
