#include "NormalizedUnstructuredMesh.hxx"
+#include <deque>
#include <map>
#include <cmath>
#include <string>
return determinant(AB,AC,n)>0;
}
+
+ /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
+ /* calcul l'intersection de deux polygones COPLANAIRES */
+ /* en dimension DIM (2 ou 3). Si DIM=3 l'algorithme ne considère*/
+ /* que les deux premières coordonnées de chaque point */
+ /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*/
+ template<int DIM> inline void intersec_de_polygone(const double * Coords_A, const double * Coords_B,
+ int nb_NodesA, int nb_NodesB,
+ std::vector<double>& inter, double dim_caracteristic, double precision)
+ {
+ for(int i_A = 1; i_A<nb_NodesA-1; i_A++)
+ {
+ for(int i_B = 1; i_B<nb_NodesB-1; i_B++)
+ {
+ INTERP_KERNEL::intersec_de_triangle(&Coords_A[0],&Coords_A[DIM*i_A],&Coords_A[DIM*(i_A+1)],
+ &Coords_B[0],&Coords_B[DIM*i_B],&Coords_B[DIM*(i_B+1)],
+ inter, dim_caracteristic, precision);
+ }
+ }
+ int nb_inter=((int)inter.size())/DIM;
+ if(nb_inter >3) inter=INTERP_KERNEL::reconstruct_polygon(inter);
+ }
+
+ /*_ _ _ _ _ _ _ _ _
+ /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
+ /* fonctions qui calcule l'aire d'un polygone en dimension 2 ou 3 */
+ /*_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */
+ template<int DIM> inline double polygon_area(std::vector<double>& inter)
+ {
+ double result=0.;
+ double area[DIM];
+
+ for(int i = 1; i<(int)inter.size()/DIM-1; i++)
+ {
+ INTERP_KERNEL::crossprod<DIM>(&inter[0],&inter[DIM*i],&inter[DIM*(i+1)],area);
+ result +=0.5*norm<DIM>(area);
+ }
+ return result;
+ }
+
+ template<int DIM> inline double polygon_area(std::deque<double>& inter)
+ {
+ double result=0.;
+ double area[DIM];
+
+ for(int i = 1; i<(int)inter.size()/DIM-1; i++)
+ {
+ INTERP_KERNEL::crossprod<DIM>(&inter[0],&inter[DIM*i],&inter[DIM*(i+1)],area);
+ result +=0.5*norm<DIM>(area);
+ }
+ return result;
+ }
}
#endif