00001
00002
00008 #if !defined(__geom_mesh_simplicial_geometry_h__)
00009 #define __geom_mesh_simplicial_geometry_h__
00010
00011 #include "SimpMeshRed.h"
00012 #include "topology.h"
00013
00014 #include "../simplex/geometry.h"
00015
00016 #include "../../../numerical/constants.h"
00017
00018 BEGIN_NAMESPACE_GEOM
00019
00021
00026 template<class SMR>
00027 typename SMR::Number
00028 computeIncidentCellsAngle(typename SMR::NodeConstIterator node);
00029
00030
00031
00033
00036 template<class SMR>
00037 typename SMR::Number
00038 computeDihedralAngle(typename SMR::ConstEdge edge);
00039
00040
00041
00043
00046 template<class SMR>
00047 typename SMR::Number
00048 computeCosineAngle(typename SMR::FaceConstIterator face);
00049
00050
00051
00053 template<class SMR>
00054 class IsNotSharpAngle :
00055 public std::unary_function<const typename SMR::NodeConstIterator&, bool> {
00056
00057 private:
00058 typedef std::unary_function<const typename SMR::NodeConstIterator&, bool>
00059 Base;
00060
00061 public:
00063 typedef typename SMR::Number Number;
00065 typedef typename Base::argument_type argument_type;
00067 typedef typename Base::result_type result_type;
00068
00069 private:
00070
00071 Number _minAngle;
00072
00073
00074 IsNotSharpAngle();
00075 IsNotSharpAngle& operator=(const IsNotSharpAngle&);
00076
00077 public:
00078
00080 IsNotSharpAngle(const IsNotSharpAngle& x) :
00081 _minAngle(x._minAngle)
00082 {}
00083
00085 IsNotSharpAngle(const Number minAngle) :
00086 _minAngle(minAngle)
00087 {}
00088
00090
00093 result_type
00094 operator()(argument_type x) const
00095 {
00096 Number a = computeIncidentCellsAngle<SMR>(x);
00097 return _minAngle <= a &&
00098 a <= 2.0 * numerical::Constants<Number>::Pi() - _minAngle;
00099 }
00100 };
00101
00102
00103
00105
00109 template<class SMR>
00110 void
00111 computeNodeNormal(typename SMR::NodeConstIterator node,
00112 typename SMR::Vertex* normal);
00113
00114
00116
00119 template<class SMR>
00120 inline
00121 typename SMR::Vertex
00122 computeNodeNormal(typename SMR::NodeConstIterator node) {
00123 typename SMR::Vertex normal;
00124 computeNodeNormal<SMR>(node, &normal);
00125 return normal;
00126 }
00127
00128
00130
00134 template<class SMR>
00135 void
00136 computeCellNormal(typename SMR::CellConstIterator cell,
00137 typename SMR::Vertex* normal);
00138
00139
00141
00145 template<class SMR>
00146 inline
00147 typename SMR::Vertex
00148 computeCellNormal(typename SMR::CellConstIterator cell) {
00149 typename SMR::Vertex normal;
00150 computeCellNormal<SMR>(cell, &normal);
00151 return normal;
00152 }
00153
00154
00156
00160 template<class SMR>
00161 void
00162 computeFaceNormal(typename SMR::CellConstIterator cell, int i,
00163 typename SMR::Vertex* x);
00164
00165
00166
00167
00169 template<typename T,
00170 template<class> class Node,
00171 template<class> class Cell,
00172 template<class,class> class Cont,
00173 typename OutputIterator>
00174 void
00175 projectAndGetSimplices(const SimpMeshRed<2,1,T,Node,Cell,Cont>& mesh,
00176 OutputIterator simplices);
00177
00178
00180 template<typename T,
00181 template<class> class Node,
00182 template<class> class Cell,
00183 template<class,class> class Cont,
00184 typename OutputIterator>
00185 void
00186 projectAndGetSimplices(const SimpMeshRed<3,2,T,Node,Cell,Cont>& mesh,
00187 OutputIterator simplices);
00188
00189
00190 END_NAMESPACE_GEOM
00191
00192 #define __geom_mesh_simplicial_geometry_ipp__
00193 #include "geometry.ipp"
00194 #undef __geom_mesh_simplicial_geometry_ipp__
00195
00196 #endif