From 2258e9eec4b12062832f817e84c0d97bb5ebcd78 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 30 Jun 2009 07:51:49 +0000
Subject: [PATCH] call setVolumePositive() in all ::writeXXX() functions

---
 Geo/Geo.cpp      | 7 ++++---
 Geo/MElement.cpp | 3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index 009431674d..23feb25a31 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -3058,11 +3058,12 @@ bool SplitCurve(int line_id, List_T *vertices_id, List_T *shapes)
       if(surface_curve->Num == c->Num){
         List_Remove(s->Generatrices, j);
         List_Insert_In_List(shapes, j, s->Generatrices);
-        j+=List_Nbr(shapes)-1;
-      }else if(surface_curve->Num == -c->Num){
+        j += List_Nbr(shapes) - 1;
+      }
+      else if(surface_curve->Num == -c->Num){
         List_Remove(s->Generatrices, j);
         List_Insert_In_List(rshapes, j, s->Generatrices);
-        j+=List_Nbr(shapes)-1;
+        j += List_Nbr(shapes) - 1;
       }
     }
   }
diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index eac5db8f18..58b6464317 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -415,6 +415,7 @@ void MElement::writePOS(FILE *fp, bool printElementary, bool printElementNumber,
   const char *str = getStringForPOS();
   if(!str) return;
 
+  setVolumePositive();
   int n = getNumVertices();
   fprintf(fp, "%s(", str);
   for(int i = 0; i < n; i++){
@@ -520,6 +521,7 @@ void MElement::writeSTL(FILE *fp, bool binary, double scalingFactor)
 
 void MElement::writeVRML(FILE *fp)
 {
+  setVolumePositive();
   for(int i = 0; i < getNumVertices(); i++)
     fprintf(fp, "%d,", getVertex(i)->getIndex() - 1);
   fprintf(fp, "-1,\n");
@@ -579,6 +581,7 @@ void MElement::writeUNV(FILE *fp, int num, int elementary, int physical)
 
 void MElement::writeMESH(FILE *fp, int elementary)
 {
+  setVolumePositive();
   for(int i = 0; i < getNumVertices(); i++)
     fprintf(fp, " %d", getVertex(i)->getIndex());
   fprintf(fp, " %d\n", elementary);
-- 
GitLab