MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLCSO/CSOBase/CSOPathPoints.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00006 
00011 //----------------------------------------------------------------------------------
00012 
00013 #ifndef __CSOPathPoints_H
00014 #define __CSOPathPoints_H
00015 
00016 #include "MLCSOIncludes.h"
00017 #include "CSOBoundingBox.h"
00018 
00019 
00020 ML_START_NAMESPACE
00021 
00022 
00023 // Forward declaration
00024 class CSOSeedPoint;
00025 
00027 
00031 class MLCSO_EXPORT CSOPathPoints
00032 { 
00033 
00034 public:
00035 
00037   CSOPathPoints();
00039   CSOPathPoints(const CSOPathPoints &pathPoints);
00041   virtual ~CSOPathPoints();
00042 
00044   inline void appendPosition(const Vector3& pos) { Vector4 entry(pos[0], pos[1], pos[2], 0); _wPositions.push_back(entry); }
00045 
00047   inline unsigned int numPathPoints() const           { return static_cast<unsigned int>(_wPositions.size()); }
00050   inline float getValueAt(unsigned int index) const   { return static_cast<float>(_wPositions[index][3]); }
00053   inline const Vector4& getPosValueAt(unsigned int index) const { return _wPositions[index]; }
00056   inline Vector3 getPosAt(unsigned int index) const      { const Vector4& atIndex = _wPositions[index];
00057                                                            const Vector3 retPos(atIndex[0], 
00058                                                                                 atIndex[1], 
00059                                                                                 atIndex[2]); 
00060                                                            return retPos; }  
00061 
00063   void setAllValuesTo(float value);
00064 
00066   void setAllValuesTo(float startVal, float endVal);
00067 
00069   void setValueAt(const float value, unsigned int index);
00071   void setPosValueAt(const Vector4& posVal, unsigned int index);
00073   void setPosAt(const Vector3& pos, unsigned int index);
00074 
00076   inline void clearPositions() { _wPositions.clear(); }
00077 
00079   float getLength() const;
00080 
00082   void movePathPoints(double x, double y, double z);
00083 
00086   void removePositions();
00088   void removePositions(unsigned int startIndex, unsigned int endIndex);
00089 
00091   void getPositionValues(std::vector<Vector4>& posValues) const;
00093   void getWorldPositions(std::vector<Vector3>& positions) const;
00095   void setPositionValues(const std::vector<Vector4>& newPosValues);
00097   void setWorldPositions(const std::vector<Vector3>& newPositions);
00098 
00100   const CSOBoundingBox& getWorldBoundingBox();
00102   const CSOBoundingBox& getVoxelBoundingBox(const Matrix4& worldToVoxelMatrix);
00103 
00106   inline void invalidateBoundingBoxes() { _hasValidVoxelBoundingBox = _hasValidWorldBoundingBox = false; }
00107 
00109   CSOSeedPoint* headSeedPoint;
00111   CSOSeedPoint* tailSeedPoint;
00112 
00113 private:
00114 
00115 
00116   /* STATE VARIABLES */
00117 
00119   std::vector<Vector4>_wPositions;
00120 
00122   Matrix4 _lastRecentWorldToVoxelMatrix;
00123 
00125   bool _hasValidWorldBoundingBox;
00127   bool _hasValidVoxelBoundingBox;
00128 
00130   CSOBoundingBox _worldBoundingBox;
00132   CSOBoundingBox _voxelBoundingBox;
00133 
00134 
00135   /* METHODS */
00136 
00138   void _pathChanged();
00139 };
00140 
00142 
00143 
00144 
00145 ML_END_NAMESPACE
00146 
00147 #endif // __CSOPathPoints_H
00148 
00149 
00150