00001
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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #ifndef _LocalSpaceRectangular3D_h
00077 #define _LocalSpaceRectangular3D_h
00078
00079 #include "BaseSRF.h"
00080 #include "Coord.h"
00081 #include "Exception.h"
00082
00083 namespace srm
00084 {
00091 class EXPORT_SRM_CPP_DLL SRF_LocalSpaceRectangular3D: public BaseSRF_3D
00092 {
00093 public:
00097 static SRF_LocalSpaceRectangular3D* create( SRM_ORM_Code orm,
00098 SRM_RT_Code rt,
00099 const SRM_LSR_3D_Parameters ¶ms );
00100
00104 static SRF_LocalSpaceRectangular3D* create(
00105 SRM_ORM_Code orm,
00106 SRM_RT_Code rt,
00107 SRM_Axis_Direction forward_direction,
00108 SRM_Axis_Direction up_direction
00109 );
00110
00114 static SRF_LocalSpaceRectangular3D* create( SRM_SRF_Parameters_Info srf_params )
00115 {
00116 return create(srf_params.value.srf_template.orm_code,
00117 srf_params.rt_code,
00118 srf_params.value.srf_template.parameters.lsr_3d_srf_parameters );
00119 }
00120
00123 Coord3D* createCoordinate3D(SRM_Long_Float coord_comp1,
00124 SRM_Long_Float coord_comp2,
00125 SRM_Long_Float coord_comp3 );
00126
00130 const SRM_LSR_3D_Parameters &getSRFParameters() const;
00131
00135 SRM_Axis_Direction get_forward_direction() const;
00136
00140 SRM_Axis_Direction get_up_direction() const;
00141
00144 virtual bool isA( SRF_ClassType type ) const;
00145
00148 virtual SRF_ClassType getClassType() const
00149 {
00150 return BaseSRF::SRF_TYP_LSR_3D;
00151 }
00152
00156 bool isEqual( const SRF_LocalSpaceRectangular3D &srf ) const;
00157
00161 bool operator==( const SRF_LocalSpaceRectangular3D &rhs ) const;
00162
00166 SRF_LocalSpaceRectangular3D* makeCopy() const;
00167
00171 const char* toString();
00172
00173 protected:
00174 SRF_LocalSpaceRectangular3D( void *impl ) : BaseSRF_3D(impl) {}
00175 SRF_LocalSpaceRectangular3D &operator =( const SRF_LocalSpaceRectangular3D & ) { return *this; }
00176 virtual ~SRF_LocalSpaceRectangular3D() {}
00177 };
00178
00179
00180 inline bool SRF_LocalSpaceRectangular3D::isA( SRF_ClassType type ) const
00181 {
00182 if (type == BaseSRF::SRF_TYP_LSR_3D)
00183 return true;
00184 else
00185 return BaseSRF_3D::isA(type);
00186 };
00187
00188
00190 typedef SRF_LocalSpaceRectangular3D SRF_LSR_3D;
00191
00192
00197 class EXPORT_SRM_CPP_DLL Coord3D_LocalSpaceRectangular3D: public Coord3D
00198 {
00199 public:
00202 Coord3D_LocalSpaceRectangular3D(SRF_LocalSpaceRectangular3D *srf,
00203 SRM_Long_Float u = 0.0,
00204 SRM_Long_Float v = 0.0,
00205 SRM_Long_Float w = 0.0 )
00206 : Coord3D(srf)
00207 {
00208 setComponentValues(u, v, w);
00209 }
00210
00213 Coord3D_LocalSpaceRectangular3D( const Coord3D_LocalSpaceRectangular3D &coord )
00214 : Coord3D(coord._srf)
00215 {
00216 setComponentValues( coord._values[0], coord._values[1], coord._values[2] );
00217 }
00218
00224 void copyTo( Coord3D_LocalSpaceRectangular3D &coord ) const
00225 {
00226 if (coord._srf != _srf)
00227 throw Exception( SRM_STATCOD_INVALID_SOURCE_COORDINATE, "copyTo: Coordinate associated with a difference SRF" );
00228
00229 coord._values[0] = _values[0];
00230 coord._values[1] = _values[1];
00231 coord._values[2] = _values[2];
00232 }
00233
00237 bool isEqual( const Coord3D_LocalSpaceRectangular3D &coord ) const
00238 {
00239 return (_srf == coord._srf &&
00240 _values[0] == coord._values[0] &&
00241 _values[1] == coord._values[1] &&
00242 _values[2] == coord._values[2] );
00243 }
00244
00247 void setComponentValues( SRM_Long_Float u, SRM_Long_Float v, SRM_Long_Float w )
00248 {
00249 _values[0] = u;
00250 _values[1] = v;
00251 _values[2] = w;
00252 }
00253
00256 SRM_Long_Float get_u() const
00257 {
00258 return _values[0];
00259 }
00260
00263 SRM_Long_Float get_v() const
00264 {
00265 return _values[1];
00266 }
00267
00270 SRM_Long_Float get_w() const
00271 {
00272 return _values[2];
00273 }
00274
00277 void set_u( SRM_Long_Float value )
00278 {
00279 _values[0] = value;
00280 }
00281
00284 void set_v( SRM_Long_Float value )
00285 {
00286 _values[1] = value;
00287 }
00288
00291 void set_w( SRM_Long_Float value )
00292 {
00293 _values[2] = value;
00294 }
00295
00298 virtual bool isA( Coord_ClassType type ) const;
00299
00300
00303 virtual Coord_ClassType getClassType() const
00304 {
00305 return Coord::COORD_TYP_LSR_3D;
00306 }
00307
00310 bool operator==( const Coord3D_LocalSpaceRectangular3D &rhs ) const;
00311
00317 bool isCompatibleWith( const Coord3D_LocalSpaceRectangular3D &rhs ) const
00318 {
00319 return ((*(SRF_LocalSpaceRectangular3D*)(this->_srf)) == (*(SRF_LocalSpaceRectangular3D*)(rhs._srf)));
00320 }
00321
00326 Coord3D_LocalSpaceRectangular3D &operator= ( const Coord3D_LocalSpaceRectangular3D &rhs )
00327 {
00328 if((*(SRF_LocalSpaceRectangular3D*)(this->_srf)) == (*(SRF_LocalSpaceRectangular3D*)(rhs._srf)))
00329 {
00330 _values[0] = rhs._values[0];
00331 _values[1] = rhs._values[1];
00332 _values[2] = rhs._values[2];
00333 }
00334 else
00335 throw Exception(SRM_STATCOD_INVALID_TARGET_COORDINATE,
00336 "Coord3D_LocalSpaceRectangular3D op=: incompatible rhs coordinate");
00337
00338 return *this;
00339 }
00340 };
00341
00342
00343 inline bool Coord3D_LocalSpaceRectangular3D::isA( Coord_ClassType type ) const
00344 {
00345 if (type == Coord::COORD_TYP_LSR_3D)
00346 return true;
00347 else
00348 return Coord3D::isA(type);
00349 };
00350
00351
00353 typedef Coord3D_LocalSpaceRectangular3D Coord3D_LSR_3D;
00354
00355 }
00356
00357 #endif // _LocalSpaceRectangular3D_h