00001
00034 #ifndef SPHERE_H
00035 #define SPHERE_H
00036
00037 #include <iostream>
00038 #include <stdio.h>
00039 #include <stdlib.h>
00040 #include <string.h>
00041 #include "my_types.h"
00042 #include "array.cpp"
00043
00044 #ifdef GRAPHICS
00045 #include <FL/Fl.h>
00046 #include <FL/Fl_Window.h>
00047 #include <FL/Fl_Double_Window.h>
00048 #include <FL/Fl_Gl_Window.h>
00049 #include <FL/Fl_Input.h>
00050 #include <FL/Fl_Box.h>
00051 #include <FL/Fl_Choice.h>
00052 #include <FL/fl_ask.h>
00053 #include <FL/fl_draw.h>
00054 #include <FL/fl_file_chooser.h>
00055 #include <FL/Fl_Color_Chooser.H>
00056 #include <FL/Fl_Menu_Bar.h>
00057 #include <FL/Fl_Button.h>
00058 #include <FL/Fl_Menu_Button.h>
00059 #include <FL/Fl_Counter.h>
00060 #endif
00061
00062 template <class T, class S>
00063 class sphere
00064 {
00065 public:
00066 T x;
00067 T y;
00068 T z;
00069 S size;
00070
00076 unsigned char color;
00077
00087 sphere ( double x, double y, double z, double size, int color );
00088
00094 sphere ();
00095 };
00096
00097
00105 template <class T, class S>
00106 class gl_sphere: public sphere<T,S>
00107 {
00108 public:
00109 double distance;
00110
00117 static void convert ( ap_array<sphere<T,S> > *spheres,
00118 ap_array<gl_sphere<T,S> > *gl_spheres );
00119
00131 static void compute_distances ( gl_sphere<T,S> *spheres, int n, double eye[3]);
00132 };
00133
00137 template <class T, class S>
00138 ostream & operator << ( ostream & out, sphere<T,S> & s );
00139
00143 template <class T, class S>
00144 istream & operator >> ( istream & in, sphere<T,S> & s );
00145
00155 typedef sphere<short,byte> sphere_s;
00156
00164 typedef sphere<float,float> sphere_f;
00165
00169 typedef gl_sphere<short,byte> gl_sphere_s;
00170
00174 typedef gl_sphere<float,float> gl_sphere_f;
00175 #endif