h o m e | d o c u m e n t a t i o n | c l a s s h i e r a r c h y |
00001 // 00002 // Filename : Functions1D.h 00003 // Author(s) : Stephane Grabli, Emmanuel Turquin 00004 // Purpose : Functions taking 1D input 00005 // Date of creation : 01/07/2003 00006 // 00008 00009 00010 // 00011 // Copyright (C) : Please refer to the COPYRIGHT file distributed 00012 // with this source distribution. 00013 // 00014 // This program is free software; you can redistribute it and/or 00015 // modify it under the terms of the GNU General Public License 00016 // as published by the Free Software Foundation; either version 2 00017 // of the License, or (at your option) any later version. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00027 // 00029 00030 #ifndef FUNCTIONS1D_HPP 00031 # define FUNCTIONS1D_HPP 00032 00033 # include "../system/Precision.h" 00034 # include "../system/TimeStamp.h" 00035 # include "ViewMap.h" 00036 # include "Functions0D.h" 00037 # include "Interface1D.h" 00038 # include "../system/FreestyleConfig.h" 00039 // 00040 // UnaryFunction1D (base class for functions in 1D) 00041 // 00043 00061 template <class T> 00062 class /*LIB_VIEW_MAP_EXPORT*/ UnaryFunction1D 00063 { 00064 public: 00068 typedef T ReturnedValueType; 00069 00071 UnaryFunction1D(){_integration = MEAN;} 00080 UnaryFunction1D(IntegrationType iType){_integration = iType;} 00082 virtual ~UnaryFunction1D() {} 00083 00085 virtual string getName() const { 00086 return "UnaryFunction1D"; 00087 } 00094 virtual T operator()(Interface1D& inter) { 00095 cerr << "Warning: operator() not implemented" << endl; 00096 return T(0); 00097 } 00099 void setIntegrationType(IntegrationType integration) { 00100 _integration = integration; 00101 } 00103 IntegrationType getIntegrationType() const { 00104 return _integration; 00105 } 00106 00107 protected: 00108 00109 IntegrationType _integration; 00110 }; 00111 00112 # ifdef SWIG 00113 %feature("director") UnaryFunction1D<void>; 00114 %feature("director") UnaryFunction1D<unsigned>; 00115 %feature("director") UnaryFunction1D<float>; 00116 %feature("director") UnaryFunction1D<double>; 00117 %feature("director") UnaryFunction1D<Vec2f>; 00118 %feature("director") UnaryFunction1D<Vec3f>; 00119 00120 %template(UnaryFunction1DVoid) UnaryFunction1D<void>; 00121 %template(UnaryFunction1DUnsigned) UnaryFunction1D<unsigned>; 00122 %template(UnaryFunction1DFloat) UnaryFunction1D<float>; 00123 %template(UnaryFunction1DDouble) UnaryFunction1D<double>; 00124 %template(UnaryFunction1DVec2f) UnaryFunction1D<Vec2f>; 00125 %template(UnaryFunction1DVec3f) UnaryFunction1D<Vec3f>; 00126 %template(UnaryFunction1DVectorViewShape) UnaryFunction1D<std::vector<ViewShape*> >; 00127 # endif // SWIG 00128 00129 00130 // 00131 // Functions definitions 00132 // 00134 00135 namespace Functions1D { 00136 00137 // GetXF1D 00139 class LIB_VIEW_MAP_EXPORT GetXF1D : public UnaryFunction1D<real> 00140 { 00141 private: 00142 Functions0D::GetXF0D _func; 00143 public: 00149 GetXF1D(IntegrationType iType) : UnaryFunction1D<real>(iType){} 00151 string getName() const { 00152 return "GetXF1D"; 00153 } 00155 real operator()(Interface1D& inter) ; 00156 }; 00157 00158 // GetYF1D 00160 class LIB_VIEW_MAP_EXPORT GetYF1D : public UnaryFunction1D<real> 00161 { 00162 private: 00163 Functions0D::GetYF0D _func; 00164 public: 00170 GetYF1D(IntegrationType iType = MEAN) : UnaryFunction1D<real>(iType){} 00172 string getName() const { 00173 return "GetYF1D"; 00174 } 00176 real operator()(Interface1D& inter) ; 00177 }; 00178 00179 // GetZF1D 00181 class LIB_VIEW_MAP_EXPORT GetZF1D : public UnaryFunction1D<real> 00182 { 00183 private: 00184 Functions0D::GetZF0D _func; 00185 public: 00191 GetZF1D(IntegrationType iType = MEAN) : UnaryFunction1D<real>(iType){} 00193 string getName() const { 00194 return "GetZF1D"; 00195 } 00197 real operator()(Interface1D& inter) ; 00198 }; 00199 00200 // GetProjectedXF1D 00202 class LIB_VIEW_MAP_EXPORT GetProjectedXF1D : public UnaryFunction1D<real> 00203 { 00204 private: 00205 Functions0D::GetProjectedXF0D _func; 00206 public: 00212 GetProjectedXF1D(IntegrationType iType = MEAN) : UnaryFunction1D<real>(iType){} 00213 public: 00215 string getName() const { 00216 return "GetProjectedXF1D"; 00217 } 00219 real operator()(Interface1D& inter); 00220 }; 00221 00222 // GetProjectedYF1D 00224 class LIB_VIEW_MAP_EXPORT GetProjectedYF1D : public UnaryFunction1D<real> 00225 { 00226 private: 00227 Functions0D::GetProjectedYF0D _func; 00228 public: 00234 GetProjectedYF1D(IntegrationType iType = MEAN) : UnaryFunction1D<real>(iType){} 00235 public: 00237 string getName() const { 00238 return "GetProjectedYF1D"; 00239 } 00241 real operator()(Interface1D& inter); 00242 }; 00243 00244 // GetProjectedZF1D 00246 class LIB_VIEW_MAP_EXPORT GetProjectedZF1D : public UnaryFunction1D<real> 00247 { 00248 private: 00249 Functions0D::GetProjectedZF0D _func; 00250 public: 00256 GetProjectedZF1D(IntegrationType iType = MEAN) : UnaryFunction1D<real>(iType){} 00257 public: 00259 string getName() const { 00260 return "GetProjectedZF1D"; 00261 } 00263 real operator()(Interface1D& inter); 00264 }; 00265 00266 // Orientation2DF1D 00268 class LIB_VIEW_MAP_EXPORT Orientation2DF1D : public UnaryFunction1D<Vec2f> 00269 { 00270 private: 00271 Functions0D::VertexOrientation2DF0D _func; 00272 public: 00278 Orientation2DF1D(IntegrationType iType = MEAN) : UnaryFunction1D<Vec2f>(iType){} 00280 string getName() const { 00281 return "Orientation2DF1D"; 00282 } 00284 Vec2f operator()(Interface1D& inter); 00285 }; 00286 00287 // Orientation3DF1D 00289 class LIB_VIEW_MAP_EXPORT Orientation3DF1D : public UnaryFunction1D<Vec3f> 00290 { 00291 private: 00292 Functions0D::VertexOrientation3DF0D _func; 00293 public: 00299 Orientation3DF1D(IntegrationType iType = MEAN) : UnaryFunction1D<Vec3f>(iType){} 00301 string getName() const { 00302 return "Orientation3DF1D"; 00303 } 00305 Vec3f operator()(Interface1D& inter); 00306 }; 00307 00308 // ZDiscontinuityF1D 00315 class LIB_VIEW_MAP_EXPORT ZDiscontinuityF1D : public UnaryFunction1D<real> 00316 { 00317 private: 00318 Functions0D::ZDiscontinuityF0D _func; 00319 public: 00325 ZDiscontinuityF1D(IntegrationType iType = MEAN) : UnaryFunction1D<real>(iType){} 00327 string getName() const { 00328 return "ZDiscontinuityF1D"; 00329 } 00331 real operator()(Interface1D& inter); 00332 }; 00333 00334 // QuantitativeInvisibilityF1D 00341 class LIB_VIEW_MAP_EXPORT QuantitativeInvisibilityF1D : public UnaryFunction1D<unsigned> 00342 { 00343 private: 00344 Functions0D::QuantitativeInvisibilityF0D _func; 00345 public: 00351 QuantitativeInvisibilityF1D(IntegrationType iType = MEAN) : UnaryFunction1D<unsigned int>(iType) {} 00353 string getName() const { 00354 return "QuantitativeInvisibilityF1D"; 00355 } 00357 unsigned operator()(Interface1D& inter); 00358 }; 00359 00360 // CurveNatureF1D 00367 class LIB_VIEW_MAP_EXPORT CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> 00368 { 00369 private: 00370 Functions0D::CurveNatureF0D _func; 00371 public: 00377 CurveNatureF1D(IntegrationType iType = MEAN) : UnaryFunction1D<Nature::EdgeNature>(iType) {} 00379 string getName() const { 00380 return "CurveNatureF1D"; 00381 } 00383 Nature::EdgeNature operator()(Interface1D& inter); 00384 }; 00385 00386 // TimeStampF1D 00388 class LIB_VIEW_MAP_EXPORT TimeStampF1D : public UnaryFunction1D<void> 00389 { 00390 public: 00392 string getName() const { 00393 return "TimeStampF1D"; 00394 } 00396 void operator()(Interface1D& inter); 00397 }; 00398 00399 // IncrementChainingTimeStampF1D 00401 class LIB_VIEW_MAP_EXPORT IncrementChainingTimeStampF1D : public UnaryFunction1D<void> 00402 { 00403 public: 00405 string getName() const { 00406 return "IncrementChainingTimeStampF1D"; 00407 } 00409 void operator()(Interface1D& inter); 00410 }; 00411 00412 // ChainingTimeStampF1D 00414 class LIB_VIEW_MAP_EXPORT ChainingTimeStampF1D : public UnaryFunction1D<void> 00415 { 00416 public: 00418 string getName() const { 00419 return "ChainingTimeStampF1D"; 00420 } 00422 void operator()(Interface1D& inter); 00423 }; 00424 00425 00426 // Curvature2DAngleF1D 00428 class LIB_VIEW_MAP_EXPORT Curvature2DAngleF1D : public UnaryFunction1D<real> 00429 { 00430 public: 00436 Curvature2DAngleF1D(IntegrationType iType = MEAN) : UnaryFunction1D<real>(iType) {} 00438 string getName() const { 00439 return "Curvature2DAngleF1D"; 00440 } 00442 real operator()(Interface1D& inter) { 00443 return integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration); 00444 } 00445 private: 00446 Functions0D::Curvature2DAngleF0D _fun; 00447 }; 00448 00449 // Normal2DF1D 00451 class LIB_VIEW_MAP_EXPORT Normal2DF1D : public UnaryFunction1D<Vec2f> 00452 { 00453 public: 00459 Normal2DF1D(IntegrationType iType = MEAN) : UnaryFunction1D<Vec2f>(iType) {} 00461 string getName() const { 00462 return "Normal2DF1D"; 00463 } 00465 Vec2f operator()(Interface1D& inter) { 00466 return integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration); 00467 } 00468 private: 00469 Functions0D::Normal2DF0D _fun; 00470 }; 00471 00472 // GetShapeF1D 00474 class LIB_VIEW_MAP_EXPORT GetShapeF1D : public UnaryFunction1D<std::vector<ViewShape*> > 00475 { 00476 public: 00479 GetShapeF1D() : UnaryFunction1D<std::vector<ViewShape*> >() {} 00481 string getName() const { 00482 return "GetShapeF1D"; 00483 } 00485 std::vector<ViewShape*> operator()(Interface1D& inter); 00486 }; 00487 00488 // GetOccludersF1D 00490 class LIB_VIEW_MAP_EXPORT GetOccludersF1D : public UnaryFunction1D<std::vector<ViewShape*> > 00491 { 00492 public: 00495 GetOccludersF1D() : UnaryFunction1D<std::vector<ViewShape*> >() {} 00497 string getName() const { 00498 return "GetOccludersF1D"; 00499 } 00501 std::vector<ViewShape*> operator()(Interface1D& inter); 00502 }; 00503 00504 // GetOccludeeF1D 00506 class LIB_VIEW_MAP_EXPORT GetOccludeeF1D : public UnaryFunction1D<std::vector<ViewShape*> > 00507 { 00508 public: 00511 GetOccludeeF1D() : UnaryFunction1D<std::vector<ViewShape*> >() {} 00513 string getName() const { 00514 return "GetOccludeeF1D"; 00515 } 00517 std::vector<ViewShape*> operator()(Interface1D& inter); 00518 }; 00519 00520 // internal 00522 00523 // getOccludeeF1D 00524 LIB_VIEW_MAP_EXPORT 00525 void getOccludeeF1D(Interface1D& inter, set<ViewShape*>& oShapes); 00526 00527 // getOccludersF1D 00528 LIB_VIEW_MAP_EXPORT 00529 void getOccludersF1D(Interface1D& inter, set<ViewShape*>& oShapes); 00530 00531 // getShapeF1D 00532 LIB_VIEW_MAP_EXPORT 00533 void getShapeF1D(Interface1D& inter, set<ViewShape*>& oShapes); 00534 00535 } // end of namespace Functions1D 00536 00537 #endif // FUNCTIONS1D_HPP