00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MBSURFACEGEOMETRYRECTILINEAR_H
00024 #define _MBSURFACEGEOMETRYRECTILINEAR_H
00025
00026 #ifdef _WIN32
00027 #pragma warning(push)
00028 #pragma warning(disable:4250)
00029 #pragma warning(disable:4251)
00030 #endif
00031
00032 #include <MeshVizXLM/mesh/geometry/MiSurfaceGeometryRectilinear.h>
00033 #include <geometry/MbGeometry.h>
00034
00035 #include <Inventor/STL/vector>
00036 #include <Inventor/STL/algorithm>
00037
00047 template <typename _T=double>
00048 class MbSurfaceGeometryRectilinear : public MiSurfaceGeometryRectilinear, public MbGeometry
00049 {
00050 public:
00052 template <typename _NodeIdIter>
00053 MbSurfaceGeometryRectilinear(_NodeIdIter xBegin,_NodeIdIter xEnd,
00054 _NodeIdIter yBegin,_NodeIdIter yEnd)
00055 {
00056 m_x.assign(xBegin,xEnd);
00057 m_y.assign(yBegin,yEnd);
00058 if (!m_x.empty() && !m_y.empty())
00059 {
00060 m_min.setValue(*std::min_element(m_x.begin(), m_x.end()),
00061 *std::min_element(m_y.begin(), m_y.end()),
00062 (_T)0);
00063 m_max.setValue(*std::max_element(xBegin, xEnd),
00064 *std::max_element(yBegin, yEnd),
00065 (_T)0);
00066 }
00067 }
00068
00072 virtual double getX(size_t i) const
00073 {
00074 #ifndef MBMESH_DONT_USE_ASSERT
00075 if (m_x.size() <= i)
00076 throw MbError("accessing coordinate out of range");
00077 #endif
00078 return m_x[i];
00079 }
00083 virtual double getY(size_t j) const
00084 {
00085 #ifndef MBMESH_DONT_USE_ASSERT
00086 if (m_y.size() <= j)
00087 throw MbError("accessing coordinate out of range");
00088 #endif
00089 return m_y[j];
00090 }
00091
00095 MbVec3d getMin() const { return (MbVec3d) m_min;}
00099 MbVec3d getMax() const { return (MbVec3d) m_max;}
00100
00101 private:
00102 std::vector<_T> m_x;
00103 std::vector<_T> m_y;
00104 MbVec3<_T> m_min;
00105 MbVec3<_T> m_max;
00106
00107 };
00108
00109 #ifdef _WIN32
00110 #pragma warning(pop)
00111 #endif
00112
00113 #endif
00114
00115
00116