00001 #ifndef __CURVE_BUNDLE_H__ 00002 #define __CURVE_BUNDLE_H__ 00003 00004 #include "PKFmanip.h" 00005 #include "Curve.h" 00006 #include <vector> 00007 00008 template<class Vector> 00009 class CurveBundle : public PKFmanip { 00010 00011 void init(); 00012 vector< Curve<Vector> > bundle; 00013 00014 public: 00015 00016 int curves() const ; 00017 int nodes() const; 00018 void link(); 00019 void unlink(); 00020 00021 void newCurve(Curve<Vector>& c); 00022 void newCurve(istream& in); 00023 void newCurve(Curve<Vector>* c); 00024 Curve<Vector>& operator[](int c); 00025 00026 CurveBundle(); 00027 CurveBundle(const char* filename); 00028 CurveBundle(const CurveBundle &cb); 00029 CurveBundle &operator= (const CurveBundle &cb); 00030 ~CurveBundle(); 00031 00032 void make(float f); 00033 void makeMidpointRule(); 00034 void resample(int NewNoNodes); 00035 00036 void changeDirection(); 00037 void normalize(); 00038 float length(); 00039 float thickness(); 00040 float thickness_fast(); 00041 CurveBundle& operator+=(const Vector &vec); 00042 CurveBundle& operator-=(const Vector &vec); 00043 void center(); 00044 00045 Vector getCenter() ; 00046 CurveBundle& scale(float s); 00047 CurveBundle& rotate(Matrix3 &m); 00048 00049 int readPKF(const char* infile); 00050 int readPKF(istream& in); 00051 int writePKF(const char *outfile); 00052 int writePKF(ostream& out); 00053 int readXYZ(const char* infile); 00054 int readData(const char* infile, const char* delimiter = " "); 00055 int writeData(const char* outfile, const char* delimiter = " ", 00056 int tangents_flag = 0); 00057 int readVECT(const char* infile); 00058 int writeVECT(const char* outfile); 00059 00060 void computeTangents(); 00061 void polygonalToArcs(); 00062 void arcsToPolygonal(); 00063 00064 // friend ostream & operator<<(ostream &out, CurveBundle<Vector> &cb); 00065 00066 }; 00067 00068 template<class Vector> 00069 inline ostream &operator<<(ostream &out, CurveBundle<Vector> &c) { 00070 00071 if (c.curves()==0) { 00072 out << "No curves!\n"; 00073 return out; 00074 } 00075 00076 for (int i=0;i<c.curves();i++) { 00077 out << "Curve "<< i << endl; 00078 out << c.bundle[i] << endl; 00079 } 00080 return out; 00081 } 00082 00083 // Template thing 00084 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00085 #include "../lib/CurveBundle.cpp" 00086 #endif 00087 00088 #endif // __CURVE_BUNDLE_H__