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 #include <MbError.h>
00035
00036 #include <Inventor/STL/vector>
00037 #include <Inventor/STL/algorithm>
00038
00048 template <typename _T=double>
00049 class MbSurfaceGeometryRectilinear : public MiSurfaceGeometryRectilinear, public MbGeometry
00050 {
00051 public:
00053 template <typename _NodeIdIter>
00054 MbSurfaceGeometryRectilinear(_NodeIdIter xBegin,_NodeIdIter xEnd,
00055 _NodeIdIter yBegin,_NodeIdIter yEnd)
00056 {
00057 m_x.assign(xBegin,xEnd);
00058 m_y.assign(yBegin,yEnd);
00059 if (!m_x.empty() && !m_y.empty())
00060 {
00061 m_min.setValue(*std::min_element(m_x.begin(), m_x.end()),
00062 *std::min_element(m_y.begin(), m_y.end()),
00063 (_T)0);
00064 m_max.setValue(*std::max_element(xBegin, xEnd),
00065 *std::max_element(yBegin, yEnd),
00066 (_T)0);
00067 }
00068 }
00069
00073 virtual double getX(size_t i) const
00074 {
00075 #ifndef MBMESH_DONT_USE_ASSERT
00076 if (m_x.size() <= i)
00077 throw MbError("accessing coordinate out of range");
00078 #endif
00079 return m_x[i];
00080 }
00084 virtual double getY(size_t j) const
00085 {
00086 #ifndef MBMESH_DONT_USE_ASSERT
00087 if (m_y.size() <= j)
00088 throw MbError("accessing coordinate out of range");
00089 #endif
00090 return m_y[j];
00091 }
00092
00096 MbVec3d getMin() const { return (MbVec3d) m_min;}
00100 MbVec3d getMax() const { return (MbVec3d) m_max;}
00101
00102 private:
00103 std::vector<_T> m_x;
00104 std::vector<_T> m_y;
00105 MbVec3<_T> m_min;
00106 MbVec3<_T> m_max;
00107
00108 };
00109
00110 #ifdef _WIN32
00111 #pragma warning(pop)
00112 #endif
00113
00114 #endif
00115
00116
00117