00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00037 #ifndef __GRASP_COORDINATES_H__
00038 #define __GRASP_COORDINATES_H__
00039
00040 #include "matvec3D.h"
00041 class coordinates;
00042 class cartesian_coordinates;
00043 class cylindrical_coordinates;
00044 class spherical_coordinates;
00045
00047
00050 class coordinates :
00051 public vec3
00052 {
00053 private:
00054 public:
00056 enum coord_system_type{
00057 cartesian,
00058 cylindrical,
00059 spherical
00060 };
00061
00063 coord_system_type coord_type;
00064
00065 coordinates(double a, double b, double c);
00066 coordinates(coordinates* c);
00067 coordinates(vec3 v);
00068 coordinates();
00069
00070 virtual coord_system_type get_coord_system_type();
00071 virtual void set_coord_system_type(coord_system_type);
00072
00073
00074 virtual cartesian_coordinates get_pos_cartesian() const;
00075 virtual cylindrical_coordinates get_pos_cylindrical() const;
00076 virtual spherical_coordinates get_pos_spherical() const;
00077
00078
00079 virtual cartesian_coordinates get_vec_cartesian(coordinates from) const;
00080 virtual cylindrical_coordinates get_vec_cylindrical(coordinates from) const;
00081 virtual spherical_coordinates get_vec_spherical(coordinates from) const;
00082
00083
00084 virtual double distanceTo(coordinates) const;
00085
00086 bool operator==(coordinates);
00087 };
00088
00089
00091
00094 class cartesian_coordinates :
00095 public coordinates
00096 {
00097 public:
00098
00099 cartesian_coordinates(double x, double y, double z);
00100 cartesian_coordinates(cartesian_coordinates *cc);
00101 cartesian_coordinates(const cartesian_coordinates& cc);
00102 cartesian_coordinates(vec3 v);
00103 cartesian_coordinates();
00104
00105
00106 cartesian_coordinates get_pos_cartesian() const;
00107 cylindrical_coordinates get_pos_cylindrical() const;
00108 spherical_coordinates get_pos_spherical() const;
00109
00110 cartesian_coordinates get_vec_cartesian(cartesian_coordinates from) const;
00111 cylindrical_coordinates get_vec_cylindrical(cartesian_coordinates from) const;
00112 spherical_coordinates get_vec_spherical(cartesian_coordinates from) const;
00113
00114 inline cartesian_coordinates operator+(cartesian_coordinates);
00115 inline cartesian_coordinates operator-(cartesian_coordinates);
00116
00117
00118 virtual double distanceTo(coordinates) const;
00119 };
00120
00122
00125 class cylindrical_coordinates :
00126 public coordinates
00127 {
00128 public:
00129
00130 cylindrical_coordinates(double R, double phi, double z);
00131 cylindrical_coordinates(cylindrical_coordinates *cc);
00132 cylindrical_coordinates(const cylindrical_coordinates& cc);
00133 cylindrical_coordinates(vec3 v);
00134 cylindrical_coordinates();
00135
00136
00137 cartesian_coordinates get_pos_cartesian() const;
00138 cylindrical_coordinates get_pos_cylindrical() const;
00139 spherical_coordinates get_pos_spherical() const;
00140
00141 cartesian_coordinates get_vec_cartesian(cylindrical_coordinates from) const;
00142 cylindrical_coordinates get_vec_cylindrical(cylindrical_coordinates from) const;
00143 spherical_coordinates get_vec_spherical(cylindrical_coordinates from) const;
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 double distanceTo(cylindrical_coordinates) const;
00154 };
00155
00157
00160 class spherical_coordinates :
00161 public coordinates
00162 {
00163 public:
00164
00165 spherical_coordinates(double r, double teta, double phi);
00166 spherical_coordinates(spherical_coordinates *cc);
00167 spherical_coordinates(const spherical_coordinates& cc);
00168 spherical_coordinates(vec3 v);
00169 spherical_coordinates();
00170
00171
00172 cartesian_coordinates get_pos_cartesian() const;
00173 cylindrical_coordinates get_pos_cylindrical() const;
00174 spherical_coordinates get_pos_spherical() const;
00175
00176 cartesian_coordinates get_vec_cartesian(spherical_coordinates from) const;
00177 cylindrical_coordinates get_vec_cylindrical(spherical_coordinates from) const;
00178 spherical_coordinates get_vec_spherical(spherical_coordinates from) const;
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 double distanceTo(spherical_coordinates) const;
00189 };
00190
00191 #endif // __GRASP_COORDINATES_H__
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208