Circle.h

00001 // ----------------------------------------------------------------------------
00002 //
00003 // tagGame - Example code from the book:
00004 //
00005 //           Artficial Intelligence for Computer Games: An Introduction
00006 //           by John David Funge
00007 //
00008 //           www.ai4games.org
00009 //
00010 // Source code distributed under the Copyright (c) 2003-2007, John David Funge
00011 // Original author: John David Funge (www.jfunge.com)
00012 //
00013 // Licensed under the Academic Free License version 3.0 
00014 // (for details see LICENSE.txt in this directory).
00015 //
00016 // ----------------------------------------------------------------------------
00017 
00018 #ifndef TG_CIRCLE_H
00019 #define TG_CIRCLE_H
00020 
00021 #include "Shape.h"
00022 
00023 namespace tagGame
00024 {
00026    class Circle : public Shape
00027    {
00028    public:
00029       Circle();
00030 
00031       virtual std::ostream& output(std::ostream& out) const;
00032 
00033       inline Real getRadius() const;
00034       inline void setRadius(Real const radius);
00035 
00036       virtual RealVec nearestIntersection(RealVec const& p, RealVec const& v) const;
00037 
00038       virtual RealVec normalTo(Shape const& o) const;
00039       virtual RealVec normalTo(Circle const& c) const;
00040 
00041       virtual Real distanceTo(Shape const& o) const;
00042       virtual Real distanceTo(Circle const& c) const;
00043       virtual Real distanceTo(Side const& s) const;
00044 
00045    protected:
00046    private:
00047       Real radius;
00048    };
00049 
00050    Real Circle::getRadius() const
00051    {
00052       return radius;
00053    }
00054    
00055    void Circle::setRadius(Real const radius)
00056    {
00057       this->radius = radius;
00058    }
00059 }
00060 
00061 #endif

Generated on Sat Mar 31 22:30:54 2007 for tagGame by  doxygen 1.5.1