InnerCircle Class Reference

#include <GeometricalObjects.h>

Inheritance diagram for InnerCircle:

Inheritance graph
[legend]
Collaboration diagram for InnerCircle:

Collaboration graph
[legend]

Public Member Functions

 InnerCircle ()
 InnerCircle (const Vector2D &c, const double r)
 ~InnerCircle ()
double get_distance (const Vector2D &pos, const Vector2D &dir, const double size)
bool within_distance (const Vector2D &pos, const double size)
Vector2D get_normal (const Vector2D &pos)
void draw_shape (bool erase)
double get_radius ()
Vector2D get_center ()

Protected Attributes

Vector2D center
double radius
Vector2D last_drawn_center
double last_drawn_radius

Constructor & Destructor Documentation

InnerCircle::InnerCircle  ) 
 

Definition at line 204 of file GeometricalObjects.cc.

References center, infinity, last_drawn_center, last_drawn_radius, and radius.

00205 {
00206   center = Vector2D(0.0, 0.0);
00207   radius = 0.0;
00208   last_drawn_center = Vector2D(-infinity,-infinity);
00209   last_drawn_radius = 0.0;
00210 }

InnerCircle::InnerCircle const Vector2D c,
const double  r
 

Definition at line 212 of file GeometricalObjects.cc.

References center, last_drawn_center, last_drawn_radius, and radius.

00213 {
00214   last_drawn_center = center = c;
00215   last_drawn_radius = radius = r;
00216 }

InnerCircle::~InnerCircle  )  [inline]
 

Definition at line 101 of file GeometricalObjects.h.

00101 {}


Member Function Documentation

void InnerCircle::draw_shape bool  erase  )  [virtual]
 

Implements Shape.

Definition at line 252 of file GeometricalObjects.cc.

References center, Gui::get_arenawindow_p(), Gui::get_bg_gdk_colour_p(), last_drawn_center, last_drawn_radius, radius, and the_gui.

00253 {
00254   if( erase )
00255     the_gui.get_arenawindow_p()->
00256       draw_arc( last_drawn_center,
00257                 last_drawn_radius, last_drawn_radius*1.5,
00258                 0.0, 2*M_PI,
00259                 *(the_gui.get_bg_gdk_colour_p()) );
00260 
00261   last_drawn_center = center;
00262   last_drawn_radius = radius;
00263 
00264     the_gui.get_arenawindow_p()->
00265       draw_arc( center, radius, radius*1.5,
00266                 0.0, 2*M_PI, gdk_colour );
00267 
00268 }

Here is the call graph for this function:

Vector2D InnerCircle::get_center  )  [inline]
 

Definition at line 112 of file GeometricalObjects.h.

00112 { return center; }

double InnerCircle::get_distance const Vector2D pos,
const Vector2D dir,
const double  size
[inline, virtual]
 

Implements Shape.

Definition at line 227 of file GeometricalObjects.cc.

References center, dot(), lengthsqr(), and max.

00228 {
00229   Vector2D y = center - pos;
00230   double speedsqr = lengthsqr(vel);
00231   if( speedsqr == 0.0 ) return infinity;
00232   double dt = dot(vel, y);
00233   double c = dt*dt + speedsqr*((size-radius)*(size-radius) - lengthsqr(y));
00234   return max( (dt + sqrt(c))/speedsqr, 0 );
00235 }

Here is the call graph for this function:

Vector2D InnerCircle::get_normal const Vector2D pos  )  [virtual]
 

Implements Shape.

Definition at line 244 of file GeometricalObjects.cc.

References center, and unit().

00245 {
00246   return unit(center - pos);
00247 }

Here is the call graph for this function:

double InnerCircle::get_radius  )  [inline]
 

Definition at line 111 of file GeometricalObjects.h.

00111 { return radius; }

bool InnerCircle::within_distance const Vector2D pos,
const double  size
[virtual]
 

Implements Shape.

Definition at line 238 of file GeometricalObjects.cc.

References center, and lengthsqr().

00239 {
00240   return (lengthsqr(center-pos) >= (size-radius)*(size-radius));
00241 }

Here is the call graph for this function:


Field Documentation

Vector2D InnerCircle::center [protected]
 

Definition at line 115 of file GeometricalObjects.h.

Referenced by draw_shape(), get_distance(), get_normal(), InnerCircle(), and within_distance().

Vector2D InnerCircle::last_drawn_center [protected]
 

Definition at line 118 of file GeometricalObjects.h.

Referenced by draw_shape(), and InnerCircle().

double InnerCircle::last_drawn_radius [protected]
 

Definition at line 119 of file GeometricalObjects.h.

Referenced by draw_shape(), and InnerCircle().

double InnerCircle::radius [protected]
 

Definition at line 116 of file GeometricalObjects.h.

Referenced by draw_shape(), and InnerCircle().


The documentation for this class was generated from the following files:
Generated on Fri Oct 15 15:49:59 2004 for Real Time Battle by  doxygen 1.3.9.1