diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp
index da58e7fafd367dc3d5f7bf48cf902f82e7ba91d3..21801e39788b424ff30ae7ae6cd6f15d9d1ec3ba 100644
--- a/Fltk/GUI_Projection.cpp
+++ b/Fltk/GUI_Projection.cpp
@@ -9,8 +9,6 @@ extern Context_T CTX;
 
 #if defined(HAVE_FOURIER_MODEL)
 
-static double currentParams[9];
-
 void uvPlot::draw()
 {
   // draw background
@@ -38,13 +36,11 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
   group = new Fl_Scroll(x, y, w, h);
   SBoundingBox3d bounds = GMODEL->bounds();
   ProjectionSurface *ps = f->GetProjectionSurface();
+  currentParams = new double[ps->GetNumParameters() + 9];
   for(int i = 0; i < ps->GetNumParameters() + 9; i++){
     Fl_Value_Input *v = new Fl_Value_Input(x, y + i * BH, BB, BH);
-
-    ps->GetScale(currentParams[0],currentParams[1],currentParams[2]);
-    ps->GetOrigin(currentParams[6],currentParams[7],currentParams[8]);
-
     if(i < 3){ // scaling
+      currentParams[i] = 1.;
       v->maximum(CTX.lc * 10.);
       v->minimum(CTX.lc / 100.);
       v->step(CTX.lc / 100.);
@@ -61,21 +57,23 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
       v->value(currentParams[i]);
     }
     else if(i < 9){ // translation
+      currentParams[i] = bounds.center()[i - 6];
       v->maximum(bounds.max()[i] + 10. * CTX.lc);
       v->minimum(bounds.min()[i] - 10. * CTX.lc);
       v->step(CTX.lc / 100.);
       v->label((i == 6) ? "X translation" : (i == 7) ? "Y translation" : 
 	       "Z translation");
-      v->value(bounds.center()[i - 6]);
+      v->value(currentParams[i]);
     }
     else{ // other parameters
+      currentParams[i] = ps->GetParameter(i - 9);
       v->maximum(10. * CTX.lc);
       v->minimum(-10. * CTX.lc);
       v->step(CTX.lc / 100.);
       v->label(strdup(ps->GetLabel(i - 9).c_str()));
-      v->value(ps->GetParameter(i - 9));
       v->value(currentParams[i]);
     }
+    ps->SetOrigin(currentParams[6], currentParams[7], currentParams[8]);
     v->align(FL_ALIGN_RIGHT);
     v->callback(update_cb, e);
     parameters.push_back(v);
@@ -190,21 +188,20 @@ void update_cb(Fl_Widget *w, void *data)
   projection *p = e->getCurrentProjection();
   if(p){
     ProjectionSurface *ps = p->face->GetProjectionSurface();
-    ps->Rescale(p->parameters[0]->value() / currentParams[0],
-		p->parameters[1]->value() / currentParams[1],
-		p->parameters[2]->value() / currentParams[2]);
-    ps->Rotate(p->parameters[3]->value() - currentParams[3],
-	       p->parameters[4]->value() - currentParams[4],
-	       p->parameters[5]->value() - currentParams[5]);
-    ps->Translate(p->parameters[6]->value() - currentParams[6],
-		  p->parameters[7]->value() - currentParams[7],
-		  p->parameters[8]->value() - currentParams[8]);
+    ps->Rescale(p->parameters[0]->value() / p->currentParams[0],
+		p->parameters[1]->value() / p->currentParams[1],
+		p->parameters[2]->value() / p->currentParams[2]);
+    ps->Rotate(p->parameters[3]->value() - p->currentParams[3],
+	       p->parameters[4]->value() - p->currentParams[4],
+	       p->parameters[5]->value() - p->currentParams[5]);
+    ps->Translate(p->parameters[6]->value() - p->currentParams[6],
+		  p->parameters[7]->value() - p->currentParams[7],
+		  p->parameters[8]->value() - p->currentParams[8]);
+    for (int i = 0; i < 9; i++)
+      p->currentParams[i] = p->parameters[i]->value();
     for (int i = 9; i < 9 + ps->GetNumParameters(); i++)
-      ps->SetParameter(i - 9, p->parameters[i]->value() - currentParams[i]);
-
+      ps->SetParameter(i - 9, p->parameters[i]->value());
     Draw();
-    for (int i = 0; i < 9; i++)
-      currentParams[i] = p->parameters[i]->value();
     
     // project all selected points and update u,v display
     std::vector<double> u, v, f;
@@ -484,10 +481,11 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data)
   // create one instance of each available projection surface
   std::vector<FProjectionFace*> faces;
   if(faces.empty()){
-    faces.push_back(new FProjectionFace(GMODEL, GMODEL->numFace() + 1, 
-					new CylindricalProjectionSurface(0)));
-    faces.push_back(new FProjectionFace(GMODEL, GMODEL->numFace() + 1,
-					new RevolvedParabolaProjectionSurface(1)));
+    int tag = GMODEL->numFace();
+    faces.push_back(new FProjectionFace(GMODEL, ++tag, 
+					new CylindricalProjectionSurface(tag)));
+    faces.push_back(new FProjectionFace(GMODEL, ++tag,
+					new RevolvedParabolaProjectionSurface(tag)));
   }
 
   // make each projection surface invisible and 
diff --git a/Fltk/GUI_Projection.h b/Fltk/GUI_Projection.h
index b461d68173202384498af601efe1cd960fa31047..0c0a36745b8aff58775dcf4390d00d574c2d0835 100644
--- a/Fltk/GUI_Projection.h
+++ b/Fltk/GUI_Projection.h
@@ -49,6 +49,7 @@ class projection {
  public:
   FProjectionFace *face;
   Fl_Group *group;
+  double *currentParams;
   std::vector<Fl_Value_Input*> parameters;
   projection(FProjectionFace *f, int x, int y, int w, int h, int BB, int BH,
 	     projectionEditor *e);
diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp
index 1bbf5ce4746a2c172655835e2cc2e6df349a679e..815b9ccecc2f9f53ca1ad739828360eeb2cd8cea 100644
--- a/Graphics/Geom.cpp
+++ b/Graphics/Geom.cpp
@@ -1,4 +1,4 @@
-// $Id: Geom.cpp,v 1.132 2007-08-02 20:55:46 anand Exp $
+// $Id: Geom.cpp,v 1.133 2007-08-02 22:28:06 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -452,7 +452,7 @@ public :
       _drawPlaneGFace(f);
     else if(f->geomType() == GEntity::ProjectionFace)
       _drawProjectionGFace(f);
-    if(f->geomType() == GEntity::ParametricSurface)
+    else if(f->geomType() == GEntity::ParametricSurface)
       _drawParametricGFace(f);
     else
       _drawNonPlaneGFace(f);
diff --git a/configure b/configure
index 602b72727364286fb616d69bd7a8b6ec8c10095f..44c62cf6b357a3f52225b2012e1e70cb27124134 100755
--- a/configure
+++ b/configure
@@ -4328,10 +4328,78 @@ else
 fi
 
     if test "x${FOURIER}" = "xyes"; then
-            if test "x${FFTW3_PREFIX}" != "x"; then
-        LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
-      fi
-      echo "$as_me:$LINENO: checking for main in -lfftw3" >&5
+            echo "$as_me:$LINENO: checking for main in -llapack" >&5
+echo $ECHO_N "checking for main in -llapack... $ECHO_C" >&6
+if test "${ac_cv_lib_lapack_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-llapack  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_lapack_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_lapack_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_lapack_main" >&5
+echo "${ECHO_T}$ac_cv_lib_lapack_main" >&6
+if test $ac_cv_lib_lapack_main = yes; then
+  LAPACK="yes"
+else
+  LAPACK="no"
+fi
+
+      if test "x${LAPACK}" != "xyes"; then
+        { echo "$as_me:$LINENO: WARNING: Could not find lapack: disabling FourierModel." >&5
+echo "$as_me: WARNING: Could not find lapack: disabling FourierModel." >&2;}
+      else
+                if test "x${FFTW3_PREFIX}" != "x"; then
+          LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
+        fi
+        echo "$as_me:$LINENO: checking for main in -lfftw3" >&5
 echo $ECHO_N "checking for main in -lfftw3... $ECHO_C" >&6
 if test "${ac_cv_lib_fftw3_main+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -4395,17 +4463,19 @@ else
   FFTW3="no"
 fi
 
-      if test "x${FFTW3}" != "xyes"; then
-        { echo "$as_me:$LINENO: WARNING: Could not find FFTW3: disabling FourierModel." >&5
+        if test "x${FFTW3}" != "xyes"; then
+          { echo "$as_me:$LINENO: WARNING: Could not find FFTW3: disabling FourierModel." >&5
 echo "$as_me: WARNING: Could not find FFTW3: disabling FourierModel." >&2;}
-      else
-        GMSH_DIRS="${GMSH_DIRS} contrib/FourierModel"
-        if test "x${FFTW3_PREFIX}" = "x"; then
-          GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -lfftw3"
-          FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
         else
-          GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -L${FFTW3_PREFIX}/lib -lfftw3"
-          FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS} -I${FFTW3_PREFIX}/include"
+          GMSH_DIRS="${GMSH_DIRS} contrib/FourierModel"
+          if test "x${FFTW3_PREFIX}" = "x"; then
+            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -lfftw3"
+            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
+          else
+            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -L${FFTW3_PREFIX}/lib -lfftw3"
+            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS} -I${FFTW3_PREFIX}/include"
+          fi
+          GMSH_LIBS="${GMSH_LIBS} -llapack"
         fi
       fi
     fi
@@ -4989,8 +5059,7 @@ case "$UNAME" in
     if test "x$enable_gui" = "xno"; then
       GMSH_LIBS="${GMSH_LIBS} -framework ApplicationServices"
     fi
-    POSTBUILD="/Developer/Tools/Rez -t APPL -o bin/gmsh Fltk/MacRes.r"
-    ;;
+        ;;
 
   AIX*)
     FLAGS="-D_BSD -DHAVE_NO_DLL ${FLAGS}"
diff --git a/configure.in b/configure.in
index 08ee9262ec95770f67de57ff9a35302b60b6144c..9ca36c559e12f7fa277a7a7e8ce70390cb0ddf12 100644
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl $Id: configure.in,v 1.128 2007-07-26 18:19:13 geuzaine Exp $
+dnl $Id: configure.in,v 1.129 2007-08-02 22:28:05 geuzaine Exp $
 dnl
 dnl Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 dnl
@@ -499,21 +499,28 @@ if test "x$enable_contrib" != "xno"; then
   if test "x$enable_fm" != "xno"; then
     AC_CHECK_FILE(./contrib/FourierModel/FM_Face.cpp, FOURIER="yes", FOURIER="no")
     if test "x${FOURIER}" = "xyes"; then
-      dnl Check for FFTW3
-      if test "x${FFTW3_PREFIX}" != "x"; then
-        LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
-      fi
-      AC_CHECK_LIB(fftw3,main,FFTW3="yes",FFTW3="no")
-      if test "x${FFTW3}" != "xyes"; then
-        AC_MSG_WARN([Could not find FFTW3: disabling FourierModel.])
+      dnl Check for lapack
+      AC_CHECK_LIB(lapack,main,LAPACK="yes",LAPACK="no")
+      if test "x${LAPACK}" != "xyes"; then
+        AC_MSG_WARN([Could not find lapack: disabling FourierModel.])
       else
-        GMSH_DIRS="${GMSH_DIRS} contrib/FourierModel"
-        if test "x${FFTW3_PREFIX}" = "x"; then
-          GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -lfftw3"
-          FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
+        dnl Check for FFTW3
+        if test "x${FFTW3_PREFIX}" != "x"; then
+          LDFLAGS="-L${FFTW3_PREFIX}/lib ${LDFLAGS}"
+        fi
+        AC_CHECK_LIB(fftw3,main,FFTW3="yes",FFTW3="no")
+        if test "x${FFTW3}" != "xyes"; then
+          AC_MSG_WARN([Could not find FFTW3: disabling FourierModel.])
         else
-          GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -L${FFTW3_PREFIX}/lib -lfftw3"
-          FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS} -I${FFTW3_PREFIX}/include"
+          GMSH_DIRS="${GMSH_DIRS} contrib/FourierModel"
+          if test "x${FFTW3_PREFIX}" = "x"; then
+            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -lfftw3"
+            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS}"
+          else
+            GMSH_LIBS="${GMSH_LIBS} -lGmshFourierModel -L${FFTW3_PREFIX}/lib -lfftw3"
+            FLAGS="-DHAVE_FOURIER_MODEL ${FLAGS} -I${FFTW3_PREFIX}/include"
+          fi
+          GMSH_LIBS="${GMSH_LIBS} -llapack"
         fi
       fi
     fi
@@ -704,7 +711,7 @@ case "$UNAME" in
     if test "x$enable_gui" = "xno"; then
       GMSH_LIBS="${GMSH_LIBS} -framework ApplicationServices"
     fi
-    POSTBUILD="/Developer/Tools/Rez -t APPL -o bin/gmsh Fltk/MacRes.r"
+    dnl POSTBUILD="/Developer/Tools/Rez -t APPL -o bin/gmsh Fltk/MacRes.r"
     ;;
 
   AIX*)
diff --git a/contrib/FourierModel/Makefile b/contrib/FourierModel/Makefile
index 917b74c370ea44ce3e99e24ebe3c5ae618c196b3..64cf1d0215e93c0997c9f4cd64666a820a495e1c 100644
--- a/contrib/FourierModel/Makefile
+++ b/contrib/FourierModel/Makefile
@@ -7,14 +7,13 @@ CFLAGS = ${OPTIM} ${FLAGS}
 SRC = ProjectionSurface.cpp \
 	CylindricalProjectionSurface.cpp \
 	RevolvedParabolaProjectionSurface.cpp \
-      Patch.h \
+      Patch.cpp \
 	FPatch.cpp \
 	ContinuationPatch.cpp \
 	ExactPatch.cpp\
       Curve.cpp \
 	FCurve.cpp\
 	IntersectionCurve.cpp \
-      Point.cpp \
       BlendedPatch.cpp \
       BlendOperator.cpp \
       FM_Edge.cpp\
diff --git a/contrib/FourierModel/ProjectionSurface.h b/contrib/FourierModel/ProjectionSurface.h
index 0bd3c149aca693f8e6a5bf08ba04a8a0d014c40a..b6cebd29e5ac18d390aadc4bc9739d842e781777 100755
--- a/contrib/FourierModel/ProjectionSurface.h
+++ b/contrib/FourierModel/ProjectionSurface.h
@@ -36,6 +36,11 @@ class ProjectionSurface {
     {
       x = O_[0]; y = O_[1]; z = O_[2];
     }
+  inline void SetOrigin
+  (double x, double y, double z)
+    {
+      O_[0] = x; O_[1] = y; O_[2] = z;
+    }
   inline void GetE0
     (double &x, double &y, double &z)
     {