#include <GeometricalObjects.h>
Inheritance diagram for Line:


Public Member Functions | |
| Line () | |
| Line (const Vector2D &sp, const Vector2D &d, const double len, const double th) | |
| Line (const Vector2D &sp, const Vector2D &d, const double len, const double th, const double b_c, const double hardn) | |
| virtual | ~Line () |
| double | get_distance (const Vector2D &pos, const Vector2D &vel, const double size) |
| bool | within_distance (const Vector2D &pos, const double size) |
| Vector2D | get_normal (const Vector2D &pos) |
| void | draw_shape (bool erase) |
| Vector2D | get_start_point () |
| Vector2D | get_direction () |
| double | get_length () |
| double | get_thickness () |
Protected Attributes | |
| Vector2D | start_point |
| Vector2D | direction |
| double | length |
| double | thickness |
| Vector2D | last_drawn_start_point |
| Vector2D | last_drawn_direction |
| double | last_drawn_length |
| double | last_drawn_thickness |
|
|
Definition at line 35 of file GeometricalObjects.cc. References direction, infinity, last_drawn_direction, last_drawn_length, last_drawn_start_point, last_drawn_thickness, length, start_point, and thickness. 00036 {
00037 start_point = Vector2D(0.0, 0.0);
00038 direction = Vector2D(0.0, 0.0);
00039 length = 0.0;
00040 thickness = 0.0;
00041 last_drawn_start_point = Vector2D(-infinity,-infinity);
00042 last_drawn_direction = Vector2D(-infinity,-infinity);
00043 last_drawn_length = 0.0;
00044 last_drawn_thickness = 0.0;
00045 }
|
|
||||||||||||||||||||
|
Definition at line 47 of file GeometricalObjects.cc. References direction, last_drawn_direction, last_drawn_length, last_drawn_start_point, last_drawn_thickness, length, start_point, and thickness. 00048 {
00049 last_drawn_start_point = start_point = sp;
00050 last_drawn_direction = direction = d;
00051 last_drawn_length = length = len;
00052 last_drawn_thickness = thickness = th;
00053 }
|
|
||||||||||||||||||||||||||||
|
|
|
|
Definition at line 35 of file GeometricalObjects.h. 00035 {}
|
|
|
Implements Shape. Definition at line 115 of file GeometricalObjects.cc. References direction, ArenaWindow::draw_line(), Gui::get_arenawindow_p(), Gui::get_bg_gdk_colour_p(), last_drawn_direction, last_drawn_length, last_drawn_start_point, last_drawn_thickness, length, start_point, the_gui, and thickness. 00116 {
00117 if( erase )
00118 the_gui.get_arenawindow_p()->draw_line( last_drawn_start_point,
00119 last_drawn_direction,
00120 last_drawn_length,
00121 last_drawn_thickness,
00122 *(the_gui.get_bg_gdk_colour_p()) );
00123 last_drawn_start_point = start_point;
00124 last_drawn_direction = direction;
00125 last_drawn_length = length;
00126 last_drawn_thickness = thickness;
00127 the_gui.get_arenawindow_p()->draw_line( start_point, direction,
00128 length, thickness,
00129 gdk_colour );
00130 }
|
Here is the call graph for this function:

|
|
Definition at line 46 of file GeometricalObjects.h. 00046 { return direction; }
|
|
||||||||||||||||
|
Implements Shape. Definition at line 67 of file GeometricalObjects.cc. References direction, dot(), max, start_point, and vedge(). 00068 {
00069 double det, s, t, d, t_middle;
00070
00071 Vector2D y = start_point - pos;
00072
00073 det = 1.0 / vedge(direction, vel);
00074 t_middle = vedge(direction, y) * det;
00075
00076 if( t_middle < 0 ) return infinity;
00077
00078 d = size + thickness;
00079 if( det > 0 )
00080 {
00081 t = (vedge(direction, y) - d) * det;
00082 s = (vedge(vel,y) - d * dot(vel, direction)) * det;
00083 }
00084 else
00085 {
00086 t = (vedge(direction, y) + d) * det;
00087 s = (vedge(vel,y) + d * dot(vel, direction)) * det;
00088 }
00089 if( s < 0 || s > length ) return infinity;
00090 if( t < 0 && ((d=-dot(y, direction)) < 0.0 || d > length ) ) return infinity;
00091
00092 return max(t, 0);
00093 }
|
Here is the call graph for this function:

|
|
Definition at line 47 of file GeometricalObjects.h. 00047 { return length; }
|
|
|
Implements Shape. Definition at line 96 of file GeometricalObjects.cc. References direction, rotate90(), start_point, and vedge(). 00097 {
00098 if( vedge( direction , pos-start_point ) > 0.0 )
00099 return rotate90(direction);
00100 else
00101 return -rotate90(direction);
00102 }
|
Here is the call graph for this function:

|
|
Definition at line 45 of file GeometricalObjects.h. 00045 { return start_point; }
|
|
|
Definition at line 48 of file GeometricalObjects.h. 00048 { return thickness; }
|
|
||||||||||||
|
Implements Shape. Definition at line 105 of file GeometricalObjects.cc. References direction, dot(), start_point, and vedge(). 00106 {
00107 Vector2D y = start_point - pos;
00108
00109 return ((fabs(vedge(y, direction)) <= (size+thickness)) &&
00110 (-dot(y,direction) >= 0 && -dot(y,direction) <= length));
00111 }
|
Here is the call graph for this function:

|
|
Definition at line 52 of file GeometricalObjects.h. Referenced by draw_shape(), get_distance(), get_normal(), Line(), and within_distance(). |
|
|
Definition at line 57 of file GeometricalObjects.h. Referenced by draw_shape(), and Line(). |
|
|
Definition at line 58 of file GeometricalObjects.h. Referenced by draw_shape(), and Line(). |
|
|
Definition at line 56 of file GeometricalObjects.h. Referenced by draw_shape(), and Line(). |
|
|
Definition at line 59 of file GeometricalObjects.h. Referenced by draw_shape(), and Line(). |
|
|
Definition at line 53 of file GeometricalObjects.h. Referenced by draw_shape(), and Line(). |
|
|
Definition at line 51 of file GeometricalObjects.h. Referenced by draw_shape(), get_distance(), get_normal(), Line(), and within_distance(). |
|
|
Definition at line 54 of file GeometricalObjects.h. Referenced by draw_shape(), and Line(). |
1.3.9.1