[Bf-blender-cvs] [3cae116704f] uv_unwrapping_slim_algorithm: SLIM: In live Unwrap mode unpinned vertices can now be moved. Also, a single pin also invokes SLIM. That also avoids crashing minimize_stre

2017-04-13 Thread Aurel Gruber
Commit: 3cae116704f35dc7b73480057761538a6a612ea6
Author: Aurel Gruber
Date:   Thu Apr 13 16:22:49 2017 +0200
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB3cae116704f35dc7b73480057761538a6a612ea6

SLIM: In live Unwrap mode unpinned vertices can now be moved. Also, a single 
pin also invokes SLIM. That also avoids crashing minimize_stretch when invoked 
on chart with one pin.

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 66bc0e8f8c3..8d599a3a1e4 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4821,7 +4821,7 @@ static void slim_get_pinned_vertex_data(ParamHandle 
*liveHandle,
selected_pins[*n_selected_pins] = 
be->vert->slim_id;
++(*n_selected_pins);
}
-   
+
pinned_vertex_indices[i] = be->vert->slim_id;
pinned_vertex_positions_2D[2*i] = be->vert->uv[0];
pinned_vertex_positions_2D[2*i+1] = be->vert->uv[1];
@@ -4851,6 +4851,21 @@ static void slim_get_pinned_vertex_data(ParamHandle 
*liveHandle,
phandle->slim_mt->n_pinned_vertices[chartNr] = i;
 }
 
+void slim_reload_all_uvs(ParamHandle *liveHandle)
+{
+
+   PHandle *phandle = (PHandle *) liveHandle;
+
+   PVert *v;
+   for (int i = 0; i < phandle->ncharts; i++) {
+   PChart *chart = phandle->charts[i];
+
+   for (v = chart->verts; v; v = v->nextlink) {
+   p_vert_load_pin_select_uvs(liveHandle, v);  /* reload v 
*/
+   }
+   }
+}
+
 void param_slim_solve(ParamHandle *handle, SLIMMatrixTransfer *mt)
 {
PHandle *phandle = (PHandle *) handle;
@@ -4896,7 +4911,7 @@ void param_slim_begin(ParamHandle *handle, 
SLIMMatrixTransfer *mt)
deselect = P_TRUE;
}
 
-   if ((!mt->is_minimize_stretch && (!select || !deselect)) || 
(npins == 1)) {
+   if ((!mt->is_minimize_stretch && (!select || !deselect)) || 
(npins == 0)) {
/* nothing to unwrap */
chart->u.slim.ptr = NULL;
chart->flag |= PCHART_NOFLUSH;
@@ -4936,25 +4951,25 @@ void param_slim_solve_iteration(ParamHandle *handle)
continue;
 
int *pinned_vertex_indices =
-   MEM_callocN(sizeof(*pinned_vertex_indices) * 
mt->n_verts[i],
-   "indices of pinned verts");
+   MEM_callocN(sizeof(*pinned_vertex_indices) * mt->n_verts[i],
+   "indices of pinned verts");
double *pinned_vertex_positions_2D =
-   MEM_callocN(sizeof(*pinned_vertex_positions_2D) * 2 * 
mt->n_verts[i],
-   "positions of pinned verts: 
[u1, v1, u2, v2, ..., un, vn]");
+   MEM_callocN(sizeof(*pinned_vertex_positions_2D) * 2 * 
mt->n_verts[i],
+   "positions of pinned verts: [u1, v1, 
u2, v2, ..., un, vn]");
int *selected_pins =
-   MEM_callocN(sizeof(*pinned_vertex_indices) * 
mt->n_verts[i],
-   "indices of pinned & selected verts");
+   MEM_callocN(sizeof(*pinned_vertex_indices) * mt->n_verts[i],
+   "indices of pinned & selected verts");
 
int n_pins = 0;
int n_selected_pins = 0;
 
slim_get_pinned_vertex_data(handle,
-   i,
-   _pins,
-   pinned_vertex_indices,
-   pinned_vertex_positions_2D,
-   _selected_pins,
-   selected_pins);
+   i,
+   _pins,
+   
pinned_vertex_indices,
+   
pinned_vertex_positions_2D,
+   

[Bf-blender-cvs] [ae7b6790219] uv_unwrapping_slim_algorithm: SLIM: disallowing pins to move to places that the SLIM algorithm can't handle. Also, this simplifiey the way we transfer uv coords back to

2017-04-13 Thread Aurel Gruber
Commit: ae7b67902191abb7e5aefbdcc20b84f050ec2b08
Author: Aurel Gruber
Date:   Thu Apr 13 16:33:11 2017 +0200
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBae7b67902191abb7e5aefbdcc20b84f050ec2b08

SLIM: disallowing pins to move to places that the SLIM algorithm can't handle. 
Also, this simplifiey the way we transfer uv coords back to native part.

===

M   intern/slim/intern/slim_capi.cpp
M   intern/slim/intern/slim_parametrizer.cpp
M   intern/slim/intern/slim_parametrizer.h
M   intern/slim/slim_capi.h
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/tools

===

diff --git a/intern/slim/intern/slim_capi.cpp b/intern/slim/intern/slim_capi.cpp
index 59bf7ecfe1a..9baa9bfe199 100644
--- a/intern/slim/intern/slim_capi.cpp
+++ b/intern/slim/intern/slim_capi.cpp
@@ -40,22 +40,12 @@ using namespace igl;
 
 void SLIM_transfer_uvs_blended_live(SLIMMatrixTransfer *mt,
void* 
slim_data_ptr,
-   int 
n_pins,
-   int 
n_selected_pins,
-   int 
*selected_pins,
-   int 
*pinned_vertex_indices,
-   double 
*pinned_vertex_positions,
int 
uv_chart_index){
 
SLIMData* slim_data = (SLIMData*) slim_data_ptr;
areacomp::correctMapSurfaceAreaIfNecessary(slim_data);
transferUvsBackToNativePartLive(mt,

slim_data->V_o,
-   n_pins,
-   
n_selected_pins,
-   
selected_pins,
-   
pinned_vertex_indices,
-   
pinned_vertex_positions,

uv_chart_index);
 }
 
diff --git a/intern/slim/intern/slim_parametrizer.cpp 
b/intern/slim/intern/slim_parametrizer.cpp
index cb9693f0772..db848ecb744 100644
--- a/intern/slim/intern/slim_parametrizer.cpp
+++ b/intern/slim/intern/slim_parametrizer.cpp
@@ -54,40 +54,13 @@ using namespace Eigen;
 
 void transferUvsBackToNativePartLive(SLIMMatrixTransfer *mt,
 
Eigen::MatrixXd ,
-int 
n_pins,
-int 
n_selected_pins,
-int 
*selected_pins_indices,
-int 
*pin_indices,
-double 
*pin_positions,
 int 
uvChartIndex){
-
double *uvCoordinateArray = mt->uv_matrices[uvChartIndex];
int numberOfVertices = mt->n_verts[uvChartIndex];
 
-   double u, v;
-
for (int i = 0; i < numberOfVertices; i++) {
-
-   while (*selected_pins_indices < i) {
-   ++selected_pins_indices;
-   }
-
-   while (*pin_indices < i) {
-   ++pin_indices;
-   pin_positions += 2;
-   }
-
-   if (*selected_pins_indices == i && *pin_indices == i) {
-   u = *(pin_positions++);
-   v = *(pin_positions++);
-   ++pin_indices;
-   } else {
-   u = UV(i,0);
-   v = UV(i,1);
-   }
-
-   *(uvCoordinateArray++) = u;
-   *(uvCoordinateArray++) = v;
+   *(uvCoordinateArray++) = UV(i,0);
+   *(uvCoordinateArray++) = UV(i,1);
}
 }
 
diff --git a/intern/slim/intern/slim_parametrizer.h 
b/intern/slim/intern/slim_parametrizer.h
index 440f55aae07..885fb7143ee 100644
--- a/intern/slim/intern/slim_parametrizer.h
+++ b/intern/slim/intern/slim_parametrizer.h
@@ -47,11 +47,6 @@ SLIMData* setup_slim(SLIMMatrixTransfer *transferredData,
 bool skipInitialization);
 void transferUvsBackToNativePartL

[Bf-blender-cvs] [9fdc5345cd] uv_unwrapping_slim_algorithm: merging master into release

2017-03-23 Thread Aurel Gruber
Commit: 9fdc5345cde7381747c465e09bb404a749a34b06
Author: Aurel Gruber
Date:   Thu Mar 23 16:44:22 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB9fdc5345cde7381747c465e09bb404a749a34b06

merging master into release

===

M   intern/slim/area_compensation.h
M   intern/slim/geometry_data_retrieval.h
M   intern/slim/intern/area_compensation.cpp
M   intern/slim/intern/geometry_data_retrieval.cpp
M   intern/slim/intern/least_squares_relocator.cpp
M   intern/slim/intern/slim.cpp
M   intern/slim/intern/slim_capi.cpp
M   intern/slim/intern/slim_parametrizer.cpp
M   intern/slim/intern/uv_initializer.cpp
M   intern/slim/slim.h
M   intern/slim/slim_capi.h
M   intern/slim/slim_parametrizer.h
M   intern/slim/uv_initializer.h
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/slim/area_compensation.h b/intern/slim/area_compensation.h
index d44bdc1961..9469fcca20 100644
--- a/intern/slim/area_compensation.h
+++ b/intern/slim/area_compensation.h
@@ -35,5 +35,5 @@ using namespace igl;
 
 namespace areacomp {
void correctMapSurfaceAreaIfNecessary(SLIMData *slimData);
-   void correctMeshSurfaceAreaIfNecessary(SLIMData *slimData, double 
relative_scale = 1.0);
+   void correctMeshSurfaceAreaIfNecessary(SLIMData *slimData);
 }
diff --git a/intern/slim/geometry_data_retrieval.h 
b/intern/slim/geometry_data_retrieval.h
index 21c7658233..2af4fce8e4 100644
--- a/intern/slim/geometry_data_retrieval.h
+++ b/intern/slim/geometry_data_retrieval.h
@@ -67,7 +67,7 @@ namespace retrieval {
double weightInfluence;
};
 
-   void constructSlimData(GeometryData , SLIMData *slimData, bool 
skipInitialization, int slim_reflection_mode);
+   void constructSlimData(GeometryData , SLIMData *slimData, bool 
skipInitialization, int slim_reflection_mode, double relativeScale);
 
void retrievePinnedVertices(GeometryData , bool 
borderVerticesArePinned);
 
diff --git a/intern/slim/intern/area_compensation.cpp 
b/intern/slim/intern/area_compensation.cpp
index f755e48c61..040cfae950 100644
--- a/intern/slim/intern/area_compensation.cpp
+++ b/intern/slim/intern/area_compensation.cpp
@@ -70,7 +70,7 @@ namespace areacomp {
correctGeometrySize(resultingAreaToExpectedAreaRatio, 
slimData->V_o, desiredRatio);
}
 
-   void correctMeshSurfaceAreaIfNecessary(SLIMData *slimData, double 
relative_scale){
+   void correctMeshSurfaceAreaIfNecessary(SLIMData *slimData){
int numberOfPinnedVertices = slimData->b.rows();
bool pinnedVerticesExist = numberOfPinnedVertices > 0;
bool needsAreaCorrection =  slimData->skipInitialization || 
pinnedVerticesExist;
@@ -78,7 +78,7 @@ namespace areacomp {
if(!needsAreaCorrection){
return;
}
-   //TODO: should instead compare area of convex hull / size of 
convex hull of both major and minor axis
+
double areaOfPreinitializedMap = 
computeSurfaceArea(slimData->V_o, slimData->F);
if (!areaOfPreinitializedMap){
return;
@@ -92,7 +92,7 @@ namespace areacomp {
double surfaceAreaOf3DMesh = computeSurfaceArea(slimData->V, 
slimData->F);
double surfaceAreaToMapAreaRatio = surfaceAreaOf3DMesh / 
areaOfPreinitializedMap;
 
-   double desiredRatio = relative_scale;
+   double desiredRatio = 1.0;
correctGeometrySize(surfaceAreaToMapAreaRatio, slimData->V, 
desiredRatio);
}
 }
diff --git a/intern/slim/intern/geometry_data_retrieval.cpp 
b/intern/slim/intern/geometry_data_retrieval.cpp
index 6a8fac223b..5cc418be15 100644
--- a/intern/slim/intern/geometry_data_retrieval.cpp
+++ b/intern/slim/intern/geometry_data_retrieval.cpp
@@ -97,9 +97,10 @@ namespace retrieval {
return (skipInitialization && hasValidPreinitializedMap(gd));
}
 
-   void constructSlimData(GeometryData , SLIMData *slimData, bool 
skipInitialization, int slim_reflection_mode){
+   void constructSlimData(GeometryData , SLIMData *slimData, bool 
skipInitialization, int slim_reflection_mode, double relativeScale){
slimData->skipInitialization = canInitializationBeSkipped(gd, 
skipInitialization);
slimData->weightInfluence = gd.weightInfluence;
+   slimData->relativeScale = relativeScale;
slimData->slim_reflection_mode = slim_reflection_mode;
slimData->withWeightedParameterization = 
gd.withWeightedParameteriztion;
   

[Bf-blender-cvs] [0475c0c41e] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM reducing SLIM iterations per live-unwrap-step to 3, taking care of memory leaks, removing packing when minimizi-stretch w

2017-03-23 Thread Aurel Gruber
Commit: 0475c0c41e492cfbf6d2c5efb3601cbc19a0cc9c
Author: Aurel Gruber
Date:   Thu Mar 16 11:08:02 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB0475c0c41e492cfbf6d2c5efb3601cbc19a0cc9c

UV Unwrapping SLIM reducing SLIM iterations per live-unwrap-step to 3, taking 
care of memory leaks, removing packing when minimizi-stretch with non-fix border

===

M   intern/slim/intern/slim_parametrizer.cpp
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/slim/intern/slim_parametrizer.cpp 
b/intern/slim/intern/slim_parametrizer.cpp
index e799dd70a6..225674149a 100644
--- a/intern/slim/intern/slim_parametrizer.cpp
+++ b/intern/slim/intern/slim_parametrizer.cpp
@@ -93,7 +93,7 @@ static void adjustPins(SLIMData *slimData, int n_pins, int* 
selectedPinnedVertex
Executes several iterations of SLIM when used with LiveUnwrap
  */
 void param_slim_live_unwrap(SLIMData *slimData, int n_pins, int* 
selectedPinnedVertexIndices, double *selectedPinnedVertexPositions2D) {
-   int numberOfIterations = 5;
+   int numberOfIterations = 3;
adjustPins(slimData, n_pins, selectedPinnedVertexIndices, 
selectedPinnedVertexPositions2D);
// recompute current energy
recompute_energy(*slimData);
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index b530e554fd..27b9e55a4f 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -662,11 +662,7 @@ static void minimize_stretch_iteration(bContext *C, 
wmOperator *op, bool interac
 
//  Assign new UVs back to each vertex
set_uv_param_slim(mss->handle, rs->mt);
-   if (!(mss->fixBorder)) {
-   if (mss->noPins){
-   param_pack(mss->handle, 0, false);
-   }
-   }
+
param_flush(mss->handle);
 
 
@@ -702,12 +698,6 @@ static void minimize_stretch_exit(bContext *C, wmOperator 
*op, bool cancel)
 
set_uv_param_slim(mss->handle, rs->mt);
 
-   if (!(mss->fixBorder)) {
-   if (mss->noPins){
-   param_pack(mss->handle, 0, false);
-   }
-   }
-
param_flush(mss->handle);
param_delete(mss->handle);
 
@@ -999,6 +989,9 @@ void ED_uvedit_live_unwrap_re_solve(void)
  
pinned_vertex_indices,
  
pinned_vertex_positions_2D);
SLIM_transfer_uvs_blended(rs->mt, slimPtr, 
chartNr, 0);
+
+   MEM_freeN(pinned_vertex_indices);
+   MEM_freeN(pinned_vertex_positions_2D);
}
 
//  Assign new UVs back to each vertex

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [be22fc6720] uv_unwrapping_slim_algorithm: Merge branch 'live_unwrap'

2017-03-15 Thread Aurel Gruber
Commit: be22fc6720992837ccceaf4260bf116d941fc6fb
Author: Aurel Gruber
Date:   Wed Mar 15 16:44:39 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBbe22fc6720992837ccceaf4260bf116d941fc6fb

Merge branch 'live_unwrap'

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [92d7b4b1c2] uv_unwrapping_slim_algorithm: merging in master

2017-03-15 Thread Aurel Gruber
Commit: 92d7b4b1c2b4e5bd62aec48339a218cae330faf7
Author: Aurel Gruber
Date:   Wed Mar 15 16:39:37 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB92d7b4b1c2b4e5bd62aec48339a218cae330faf7

merging in master

===



===

diff --cc source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 3fab2a3110,3c00c0da56..b530e554fd
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@@ -822,12 -814,6 +822,8 @@@ void UV_OT_minimize_stretch(wmOperatorT
ot->modal = minimize_stretch_modal;
ot->cancel = minimize_stretch_cancel;
ot->poll = ED_operator_uvedit;
 +
-   /* properties */
-   RNA_def_boolean(ot->srna, "fill_holes_slim", 1, "Fill Holes", "Virtual 
fill holes in mesh before unwrapping, to better avoid overlaps and preserve 
symmetry");
-   RNA_def_float_factor(ot->srna, "blend_slim", 0.0f, 0.0f, 1.0f, "Blend", 
"Blend factor between stretch minimized and original", 0.0f, 1.0f);
 +  RNA_def_boolean(ot->srna, "fix_boundary", 1, "Fix Boundary", "Wether 
the vertices on the border may move or not.");
- 
  }
  
  /*  Pack Islands operator  */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [47e71e8746] uv_unwrapping_slim_algorithm: taking care of compiler warnings

2017-03-15 Thread Aurel Gruber
Commit: 47e71e8746c6d9eff88b58d44520fcb891e3d15f
Author: Aurel Gruber
Date:   Wed Mar 15 16:33:38 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB47e71e8746c6d9eff88b58d44520fcb891e3d15f

taking care of compiler warnings

===

D   intern/slim/ext/libigl_extract/igl/harmonic.cpp
D   intern/slim/ext/libigl_extract/igl/harmonic.h
D   intern/slim/ext/libigl_extract/min_quad_with_fixed.cpp
D   intern/slim/ext/libigl_extract/min_quad_with_fixed.h
D   intern/slim/ext/libigl_extract/slice.cpp
D   intern/slim/ext/libigl_extract/slice.h
M   intern/slim/intern/slim.cpp
M   intern/slim/intern/slim_parametrizer.cpp
M   intern/slim/intern/uv_initializer.cpp
M   source/blender/editors/uvedit/uvedit_parametrizer.c

===

diff --git a/intern/slim/ext/libigl_extract/igl/harmonic.cpp 
b/intern/slim/ext/libigl_extract/igl/harmonic.cpp
deleted file mode 100644
index 7a787b457e..00
--- a/intern/slim/ext/libigl_extract/igl/harmonic.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// This file is part of libigl, a simple c++ geometry processing library.
-//
-// Copyright (C) 2014 Alec Jacobson <alecjacob...@gmail.com>
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can
-// obtain one at http://mozilla.org/MPL/2.0/.
-#include "harmonic.h"
-#include "massmatrix.h"
-#include "isdiag.h"
-#include "min_quad_with_fixed.h"
-#include "cotmatrix.h"
-#include "invert_diag.h"
-
-
-/*
-#include "adjacency_matrix.h"
-#include "diag.h"
-#include "invert_diag.h"
-#include "isdiag.h"
-#include "massmatrix.h"
-#include "min_quad_with_fixed.h"
-#include "speye.h"
-#include "sum.h"
-#include */
-
-#include 
-
-template <
-  typename DerivedV,
-  typename DerivedF,
-  typename Derivedb,
-  typename Derivedbc,
-  typename DerivedW>
-IGL_INLINE bool igl::harmonic(
-  const Eigen::PlainObjectBase & V,
-  const Eigen::PlainObjectBase & F,
-  const Eigen::PlainObjectBase & b,
-  const Eigen::PlainObjectBase & bc,
-  const int k,
-  Eigen::PlainObjectBase & W)
-{
-  using namespace Eigen;
-  typedef typename DerivedV::Scalar Scalar;
-  SparseMatrix L,M;
-  cotmatrix(V,F,L);
-  massmatrix(V,F,MASSMATRIX_TYPE_DEFAULT,M);
-  return harmonic(L,M,b,bc,k,W);
-}
-
-template <
-  typename DerivedF,
-  typename Derivedb,
-  typename Derivedbc,
-  typename DerivedW>
-IGL_INLINE bool igl::harmonic(
-  const Eigen::PlainObjectBase & F,
-  const Eigen::PlainObjectBase & b,
-  const Eigen::PlainObjectBase & bc,
-  const int k,
-  Eigen::PlainObjectBase & W)
-{
-  using namespace Eigen;
-  typedef typename Derivedbc::Scalar Scalar;
-  SparseMatrix A;
-  adjacency_matrix(F,A);
-  // sum each row
-  SparseVector Asum;
-  sum(A,1,Asum);
-  // Convert row sums into diagonal of sparse matrix
-  SparseMatrix Adiag;
-  diag(Asum,Adiag);
-  SparseMatrix L = A-Adiag;
-  SparseMatrix M;
-  speye(L.rows(),M);
-  return harmonic(L,M,b,bc,k,W);
-}
-
-template <
-  typename DerivedL,
-  typename DerivedM,
-  typename Derivedb,
-  typename Derivedbc,
-  typename DerivedW>
-IGL_INLINE bool igl::harmonic(
-  const Eigen::SparseMatrix & L,
-  const Eigen::SparseMatrix & M,
-  const Eigen::PlainObjectBase & b,
-  const Eigen::PlainObjectBase & bc,
-  const int k,
-  Eigen::PlainObjectBase & W)
-{
-  const int n = L.rows();
-  assert(n == L.cols() && "L must be square");
-  assert(n == M.cols() && "M must be same size as L");
-  assert(n == M.rows() && "M must be square");
-  assert(igl::isdiag(M) && "Mass matrix should be diagonal");
-
-  Eigen::SparseMatrix Q;
-  igl::harmonic(L,M,k,Q);
-
-  typedef DerivedL Scalar;
-  min_quad_with_fixed_data data;
-  min_quad_with_fixed_precompute(Q,b,Eigen::SparseMatrix(),true,data);
-  W.resize(n,bc.cols());
-  typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1> VectorXS;
-  const VectorXS B = VectorXS::Zero(n,1);
-  for(int w = 0;w<bc.cols();w++)
-  {
-const VectorXS bcw = bc.col(w);
-VectorXS Ww;
-if(!min_quad_with_fixed_solve(data,B,bcw,VectorXS(),Ww))
-{
-  return false;
-}
-W.col(w) = Ww;
-  }
-  return true;
-}
-
-template <
-  typename DerivedL,
-  typename DerivedM,
-  typename DerivedQ>
-IGL_INLINE void igl::harmonic(
-  const Eigen::SparseMatrix & L,
-  const Eigen::SparseMatrix & M,
-  const int k,
-  Eigen::SparseMatrix & Q)
-{
-  assert(L.rows() == L.cols()&&"L should be square");
-  assert(M.rows() == M.cols()&&"M should be square");
-  assert(L.rows() == M.rows()&

[Bf-blender-cvs] [7b59b53938] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM adding liveUnwrap with slim

2017-03-15 Thread Aurel Gruber
Commit: 7b59b53938a3c11e62c990a6f319b0db9f323c69
Author: Aurel Gruber
Date:   Wed Mar 15 14:16:13 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB7b59b53938a3c11e62c990a6f319b0db9f323c69

UV Unwrapping SLIM adding liveUnwrap with slim

===

M   intern/slim/intern/slim.cpp
M   intern/slim/intern/slim_capi.cpp
M   intern/slim/intern/slim_parametrizer.cpp
M   intern/slim/slim.h
M   intern/slim/slim_capi.h
M   intern/slim/slim_parametrizer.h
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/slim/intern/slim.cpp b/intern/slim/intern/slim.cpp
index 5d2a56760a..f900a157e1 100644
--- a/intern/slim/intern/slim.cpp
+++ b/intern/slim/intern/slim.cpp
@@ -904,6 +904,10 @@ void igl::slim_precompute(Eigen::MatrixXd , 
Eigen::MatrixXi , Eigen::MatrixX
   data.energy = igl::slim::compute_energy(data,data.V_o) / data.mesh_area;
 }
 
+void igl::recompute_energy(SLIMData ){
+   data.energy = igl::slim::compute_energy(data, data.V_o);
+}
+
 Eigen::MatrixXd igl::slim_solve(SLIMData , int iter_num)
 {
   for (int i = 0; i < iter_num; i++)
@@ -924,5 +928,6 @@ Eigen::MatrixXd igl::slim_solve(SLIMData , int 
iter_num)
  data.energy * data.mesh_area) 
/ data.mesh_area;
 
   }
+
   return data.V_o;
 }
diff --git a/intern/slim/intern/slim_capi.cpp b/intern/slim/intern/slim_capi.cpp
index 7f42879b9b..096a3dfe85 100644
--- a/intern/slim/intern/slim_capi.cpp
+++ b/intern/slim/intern/slim_capi.cpp
@@ -65,6 +65,20 @@ void SLIM_parametrize_single_iteration(void* slim_data_ptr){
param_slim_single_iteration(slim_data);
 }
 
+/* Executes slim iterations during live unwrap. needs to provide new 
selected-pin positions
+ */
+void SLIM_parametrize_live(void* slim_data_ptr,
+  int n_pins,
+  int* pinned_vertex_indices,
+  double 
*pinned_vertex_positions_2D){
+
+   SLIMData* slim_data = (SLIMData*) slim_data_ptr;
+   param_slim_live_unwrap(slim_data,
+  n_pins,
+  pinned_vertex_indices,
+  pinned_vertex_positions_2D);
+}
+
 void SLIM_parametrize(SLIMMatrixTransfer *mt, int n_iterations, bool 
are_border_vertices_pinned, bool skip_initialization){
param_slim(mt, n_iterations, are_border_vertices_pinned, 
skip_initialization);
 }
diff --git a/intern/slim/intern/slim_parametrizer.cpp 
b/intern/slim/intern/slim_parametrizer.cpp
index 5182b7850e..ecb671e6d9 100644
--- a/intern/slim/intern/slim_parametrizer.cpp
+++ b/intern/slim/intern/slim_parametrizer.cpp
@@ -76,10 +76,32 @@ Eigen::MatrixXd 
getInteractiveResultBlendedWithOriginal(float blend, SLIMData *s
Executes a single iteration of SLIM, must follow a proper setup & 
initialisation.
  */
 void param_slim_single_iteration(SLIMData *slimData){
-   int numberOfIterations = 1;
+   int numberOfIterations = 5;
slim_solve(*slimData, numberOfIterations);
 }
 
+static void adjustPins(SLIMData *slimData, int n_pins, int* 
selectedPinnedVertexIndices, double *selectedPinnedVertexPositions2D){
+   slimData->b.resize(n_pins);
+   slimData->bc.resize(n_pins, 2);
+   for (int i = 0; i < n_pins; i++){
+   slimData->b(i) = selectedPinnedVertexIndices[i];
+   slimData->bc(i, 0) = selectedPinnedVertexPositions2D[2*i];
+   slimData->bc(i, 1) = selectedPinnedVertexPositions2D[2*i+1];
+   }
+}
+
+/*
+   Executes several iterations of SLIM when used with LiveUnwrap
+ */
+void param_slim_live_unwrap(SLIMData *slimData, int n_pins, int* 
selectedPinnedVertexIndices, double *selectedPinnedVertexPositions2D) {
+   int numberOfIterations = 5;
+   adjustPins(slimData, n_pins, selectedPinnedVertexIndices, 
selectedPinnedVertexPositions2D);
+   // recompute current energy
+   recompute_energy(*slimData);
+   slim_solve(*slimData, numberOfIterations);
+}
+
+
 void param_slim(SLIMMatrixTransfer *mt, int nIterations, bool 
borderVerticesArePinned, bool skipInitialization){
 
igl::Timer timer;
diff --git a/intern/slim/slim.h b/intern/slim/slim.h
index 019e292a74..91c3a5a180 100644
--- a/intern/slim/slim.h
+++ b/intern/slim/slim.h
@@ -99,6 +99,9 @@ struct SLIMData
 Eigen::MatrixXd& bc,
 double soft_p);
 
+// Recompute the current energy if using liveunwrap
+   void recompute_energy(SLIMData );
+
 // Run iter_num iterations of

[Bf-blender-cvs] [e4e202cb1c] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM Changing ui parameter names and showing parameters based on method

2017-03-15 Thread Aurel Gruber
Commit: e4e202cb1c342d95d24aa341f1473b9cbf1c4c63
Author: Aurel Gruber
Date:   Wed Mar 15 16:06:40 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBe4e202cb1c342d95d24aa341f1473b9cbf1c4c63

UV Unwrapping SLIM Changing ui parameter names and showing parameters based on 
method

===

M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 3160ffdab3..3c00c0da56 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -814,10 +814,6 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
ot->modal = minimize_stretch_modal;
ot->cancel = minimize_stretch_cancel;
ot->poll = ED_operator_uvedit;
-
-   /* properties */
-   RNA_def_boolean(ot->srna, "fill_holes_slim", 1, "Fill Holes", "Virtual 
fill holes in mesh before unwrapping, to better avoid overlaps and preserve 
symmetry");
-   RNA_def_float_factor(ot->srna, "blend_slim", 0.0f, 0.0f, 1.0f, "Blend", 
"Blend factor between stretch minimized and original", 0.0f, 1.0f);
 }
 
 /*  Pack Islands operator  */
@@ -1296,13 +1292,13 @@ static int unwrap_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BKE_editmesh_from_object(obedit);
 
int method = RNA_enum_get(op->ptr, "method");
-   int n_slim_iterations = RNA_int_get(op->ptr, "slim_iterations");
-   double slim_weight_influence = RNA_float_get(op->ptr, 
"slim_weight_influence");
-   double slim_relative_scale = RNA_float_get(op->ptr, 
"slim_relative_scale");
-   int slim_reflection_mode = RNA_enum_get(op->ptr, 
"slim_reflection_mode");
+   int n_slim_iterations = RNA_int_get(op->ptr, "iterations");
+   double slim_weight_influence = RNA_float_get(op->ptr, 
"vertex_group_factor");
+   double slim_relative_scale = RNA_float_get(op->ptr, "relative_scale");
+   int slim_reflection_mode = RNA_enum_get(op->ptr, "reflection_mode");
 
char slim_vertex_group[64];
-   RNA_string_get(op->ptr, "slim_vertex_group", slim_vertex_group);
+   RNA_string_get(op->ptr, "vertex_group", slim_vertex_group);
 
const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
@@ -1371,6 +1367,40 @@ static int unwrap_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
 }
 
+static bool unwrap_draw_check_prop_slim(PointerRNA *UNUSED(ptr), PropertyRNA 
*prop)
+{
+   const char *prop_id = RNA_property_identifier(prop);
+
+   return !(STREQ(prop_id, "fill_holes"));
+}
+
+static bool unwrap_draw_check_prop_abf(PointerRNA *UNUSED(ptr), PropertyRNA 
*prop)
+{
+   const char *prop_id = RNA_property_identifier(prop);
+
+   return !(STREQ(prop_id, "reflection_mode") ||
+STREQ(prop_id, "iterations") ||
+STREQ(prop_id, "relative_scale") ||
+STREQ(prop_id, "vertex_group") ||
+STREQ(prop_id, "vertex_group_factor")
+);
+}
+
+static void unwrap_draw(bContext *UNUSED(C), wmOperator *op)
+{
+   uiLayout *layout = op->layout;
+   PointerRNA ptr;
+
+   /* main draw call */
+   RNA_pointer_create(NULL, op->type->srna, op->properties, );
+
+   if(RNA_enum_get(op->ptr, "method") == 2) {
+   uiDefAutoButsRNA(layout, , unwrap_draw_check_prop_slim, 
'\0');
+   } else {
+   uiDefAutoButsRNA(layout, , unwrap_draw_check_prop_abf, 
'\0');
+   }
+}
+
 void UV_OT_unwrap(wmOperatorType *ot)
 {
static EnumPropertyItem method_items[] = {
@@ -1396,28 +1426,34 @@ void UV_OT_unwrap(wmOperatorType *ot)
ot->exec = unwrap_exec;
ot->poll = ED_operator_uvmap;
 
+   /* only draw relevant ui elements*/
+   ot->ui = unwrap_draw;
+
+
/* properties */
-   RNA_def_enum(ot->srna, "method", method_items, 0, "Method",
+   RNA_def_enum(ot->srna, "method", method_items, 2, "Method",
 "Unwrapping method (Angle Based usually gives better 
results than Conformal, while being somewhat slower)");
-   RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes",
-   "Virtual fill holes in mesh before unwrapping, to 
better avoi

[Bf-blender-cvs] [dbe69d982f1] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: small bugfixes and putting char array and not just pointer into toolsettings for vertexgroupname

2017-03-14 Thread Aurel Gruber
Commit: dbe69d982f161199d156fcb42c712361c1231c07
Author: Aurel Gruber
Date:   Sun Mar 12 23:49:43 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBdbe69d982f161199d156fcb42c712361c1231c07

UV Unwrapping SLIM: small bugfixes and putting char array and not just pointer 
into toolsettings for vertexgroupname

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 550f7589a6f..6b5fddff5ef 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4456,7 +4456,9 @@ static void convert_blender_slim(ParamHandle *handle)
}
}
 
-   MEM_freeN(phandle->weight_array);
+   if (phandle->weight_array) {
+   MEM_freeN(phandle->weight_array);
+   }
 };
 
 static void transfer_data_to_slim(ParamHandle *handle)
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index b90183e8ae5..3160ffdab36 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -621,8 +621,6 @@ static bool minimize_stretch_init(bContext *C, wmOperator 
*op)
scene->toolsettings->slim_pack_islands = false;
scene->toolsettings->slim_fixed_boundary = true;
 
-   scene->toolsettings->slim_relative_scale = 1.0;
-
enrich_handle_slim(scene, obedit, em, handle, mss->mt, true);
param_slim_begin(handle);
 
@@ -1254,14 +1252,15 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const 
short sel)
BMEditMesh *em = BKE_editmesh_from_object(obedit);
ParamHandle *handle;
 
-   const bool fill_holes = (scene->toolsettings->uvcalc_flag & 
UVCALC_FILLHOLES) != 0;
+   bool use_slim_method = (scene->toolsettings->unwrapper == 2);
+
+   const bool fill_holes = use_slim_method ? true : 
(scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES) != 0;
const bool correct_aspect = (scene->toolsettings->uvcalc_flag & 
UVCALC_NO_ASPECT_CORRECT) == 0;
scene->toolsettings->slim_skip_initialization = false;
scene->toolsettings->slim_pack_islands = true;
scene->toolsettings->slim_fixed_boundary = false;
bool use_subsurf;
 
-   bool use_slim_method = (scene->toolsettings->unwrapper == 2);
 
modifier_unwrap_state(obedit, scene, _subsurf);
 
@@ -1295,8 +1294,8 @@ static int unwrap_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
-   int method = RNA_enum_get(op->ptr, "method");
 
+   int method = RNA_enum_get(op->ptr, "method");
int n_slim_iterations = RNA_int_get(op->ptr, "slim_iterations");
double slim_weight_influence = RNA_float_get(op->ptr, 
"slim_weight_influence");
double slim_relative_scale = RNA_float_get(op->ptr, 
"slim_relative_scale");
@@ -1340,7 +1339,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
scene->toolsettings->slim_weight_influence = slim_weight_influence;
scene->toolsettings->slim_reflection_mode = slim_reflection_mode;
scene->toolsettings->slim_relative_scale = slim_relative_scale;
-   scene->toolsettings->slim_vertex_group = slim_vertex_group;
+   strcpy(scene->toolsettings->slim_vertex_group, slim_vertex_group);
 
/* remember packing marging */
if (RNA_struct_property_is_set(op->ptr, "margin"))
@@ -1401,7 +1400,7 @@ void UV_OT_unwrap(wmOperatorType *ot)
RNA_def_enum(ot->srna, "method", method_items, 0, "Method",
 "Unwrapping method (Angle Based usually gives better 
results than Conformal, while being somewhat slower)");
RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes",
-   "Virtual fill holes in mesh before unwrapping, to 
better avoid overlaps and preserve symmetry");
+   "Virtual fill holes in mesh before unwrapping, to 
better avoid overlaps and preserve symmetry. Disabling this option has no 
effect on SLIM.");
RNA_def_boolean(ot->srna, "correct_aspect", 1, "Correct Aspect",
"Map UVs taking image aspect ratio into account");
RNA_def_boolean(ot->srna, &

[Bf-blender-cvs] [968f1c0de3c] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: reordering functino definitions to remove prototypes and cleaning header files

2017-03-14 Thread Aurel Gruber
Commit: 968f1c0de3c698046e9d964ffcb9be7923f9945e
Author: Aurel Gruber
Date:   Fri Mar 10 10:40:49 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB968f1c0de3c698046e9d964ffcb9be7923f9945e

UV Unwrapping SLIM: reordering functino definitions to remove prototypes and 
cleaning header files

===

M   source/blender/bmesh/bmesh_class.h
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index 82f97b873e0..104df625ee6 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -99,8 +99,6 @@ typedef struct BMVert {
 *   which is a bit of an abuse of internal bmesh data but also 
works OK for now (use with care!).
 */
struct BMEdge *e;
-
-   int id;
 } BMVert;
 
 typedef struct BMVert_OFlag {
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 17799ae6e07..550f7589a6f 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -35,9 +35,6 @@
 #include "BLI_boxpack2d.h"
 #include "BLI_convexhull2d.h"
 
-#include "BKE_editmesh.h"
-#include "bmesh.h"
-
 #include "uvedit_parametrizer.h"
 
 #include 
@@ -245,16 +242,9 @@ typedef struct PHandle {
// SLIM uv unwrapping
SLIMMatrixTransfer *mt;
int n_iterations;
-   int slim_global_method;
bool skip_initialization;
-   bool pack_islands;
-   bool with_weighted_parameterization;
-   MDeformVert *weight_map_data;
-   int weight_map_index;
-   double weight_influence;
-   double relative_scale;
-   BMesh *bm;
-
+   float *weight_array;
+   bool is_interactive;
 } PHandle;
 
 /* PHash
@@ -4200,23 +4190,12 @@ void param_construct_end(ParamHandle *handle, ParamBool 
fill, ParamBool impl)
phandle->state = PHANDLE_STATE_CONSTRUCTED;
 }
 
-int retrieve_weightmap_index(Object *obedit, char *vertex_group)
-{
-   return defgroup_name_index(obedit, vertex_group);
-}
-
-void param_slim_enrich_handle(Object *obedit,
- BMEditMesh *em,
- ParamHandle *handle,
+void param_slim_enrich_handle(ParamHandle *handle,
  SLIMMatrixTransfer 
*mt,
- MDeformVert *dvert,
- int weight_map_index,
- double 
weight_influence,
- double relative_scale,
+ float *weight_array,
  int n_iterations,
  bool 
skip_initialization,
- bool pack_islands,
- bool 
with_weighted_parameterization)
+ bool is_interactive)
 {
 
PHandle *phandle = (PHandle *)handle;
@@ -4224,421 +4203,223 @@ void param_slim_enrich_handle(Object *obedit,
phandle->mt = mt;
phandle->n_iterations = n_iterations;
phandle->skip_initialization = skip_initialization;
-   phandle->pack_islands = pack_islands;
-   phandle->with_weighted_parameterization = 
with_weighted_parameterization;
-   phandle->weight_map_data = dvert;
-   phandle->weight_map_index = weight_map_index;
-   phandle->weight_influence = weight_influence;
-   phandle->relative_scale = relative_scale;
-   phandle->bm = em->bm;
+   phandle->weight_array = weight_array;
+   phandle->is_interactive = is_interactive;
 }
 
-void param_begin(ParamHandle *handle, ParamBool abf, bool use_slim)
-{
-   if (use_slim) {
-   param_slim_begin(handle);
-   } else {
-   param_lscm_begin(handle, PARAM_FALSE, abf);
-   }
-}
 
-void param_solve(ParamHandle *handle, bool use_slim)
-{
-   if (use_slim) {
-   param_slim_solve(handle);
-   } else {
-   param_lscm_solve(handle);
-   }
-}
+/* In the following are all functions necessary to transfer data from the 
native part to SLIM.
+ */
 
-void param_end(ParamHandle *handle, bool use_slim)
+/* Allocate pointer arrays for e

[Bf-blender-cvs] [5681b886a02] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: refactoring UVInitializer

2017-03-14 Thread Aurel Gruber
Commit: 5681b886a02586404a8919314ad99875608c600b
Author: Aurel Gruber
Date:   Thu Mar 9 13:31:19 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB5681b886a02586404a8919314ad99875608c600b

UV Unwrapping SLIM: refactoring UVInitializer

===

M   intern/SLIM/src/UVInitializer.cpp
M   intern/SLIM/src/UVInitializer.h
M   intern/SLIM/src/slim_parametrizer.cpp
M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/tools

===

diff --git a/intern/SLIM/src/UVInitializer.cpp 
b/intern/SLIM/src/UVInitializer.cpp
index 339dcc6c3d5..34513f31957 100644
--- a/intern/SLIM/src/UVInitializer.cpp
+++ b/intern/SLIM/src/UVInitializer.cpp
@@ -17,9 +17,7 @@
 using namespace std;
 
 double computeAngle(const Eigen::Vector3d ,const Eigen::Vector3d ){
-   cout << "points for angle " << a << "   and" << b << endl;
-   double angle = acos(a.dot(b) / (a.norm() * b.norm()));
-   return angle;
+   return acos(a.dot(b) / (a.norm() * b.norm()));
 }
 
 void findVertexToOppositeAnglesCorrespondence(const Eigen::MatrixXi ,const 
Eigen::MatrixXd , Eigen::SparseMatrix ){
@@ -37,10 +35,6 @@ void findVertexToOppositeAnglesCorrespondence(const 
Eigen::MatrixXi ,const Eig
double angle2 = computeAngle(V.row(vertexIndex3) - 
V.row(vertexIndex2), V.row(vertexIndex1) - V.row(vertexIndex2));
double angle3 = computeAngle(V.row(vertexIndex1) - 
V.row(vertexIndex3), V.row(vertexIndex2) - V.row(vertexIndex3));
 
-   cout << "vertex " << V.row(vertexIndex1) << " has angle " << 
angle1 << "for neighbors " << V.row(vertexIndex2) << " and" << 
V.row(vertexIndex3) << endl << endl;
-   cout << "vertex " << V.row(vertexIndex2) << " has angle " << 
angle2 << "for neighbors " << V.row(vertexIndex3) << " and" << 
V.row(vertexIndex1) << endl << endl;
-   cout << "vertex " << V.row(vertexIndex3) << " has angle " << 
angle3 << "for neighbors " << V.row(vertexIndex1) << " and" << 
V.row(vertexIndex2) << endl << endl;
-
coefficients.push_back(T(vertexIndex1, 2*vertexIndex2, angle3));
coefficients.push_back(T(vertexIndex1, 2*vertexIndex3 + 1, 
angle2));
 
@@ -84,14 +78,17 @@ void findVertexToItsAnglesCorrespondence(const 
Eigen::MatrixXi ,const Eigen::M
vertexToFaceIndices.setFromTriplets(coefficients.begin(), 
coefficients.end());
 }
 
-/* AUREL THESIS
-   My own implementation of unfirom laplacian parameterization, for speed 
comparison and curiosity. Mine is faster then the libigl implementation.
-   Unfortunatly it is a very bad initialisation for our use.
+/*
+   Implementation of different fixed-border parameterizations, Mean Value 
Coordinates, Harmonic, Tutte.
  */
-void UVInitializer::uniform_laplacian(const Eigen::MatrixXi , const 
Eigen::MatrixXd , const Eigen::MatrixXi , const Eigen::VectorXd , const 
Eigen::VectorXi , Eigen::MatrixXd _uv, Eigen::MatrixXd , 
Eigen::MatrixXd ){
-
-   enum Method{TUTTE, HARMONIC, MVC};
-   Method method = HARMONIC;
+void UVInitializer::convex_border_parameterization(const Eigen::MatrixXi ,
+   
   const Eigen::MatrixXd ,
+   
   const Eigen::MatrixXi ,
+   
   const Eigen::VectorXd ,
+   
   const Eigen::VectorXi ,
+   
   const Eigen::MatrixXd _uv,
+   
   Eigen::MatrixXd ,
+   
   Method method){
 
int nVerts = UV.rows();
int nEdges = E.rows();
@@ -152,8 +149,6 @@ void UVInitializer::uniform_laplacian(const Eigen::MatrixXi 
, const Eigen::Mat
break;
}
 
-   cout << "edgeWeight " << edgeWeight << "r.norm: "<< 
edgeLength << endl;
-

intTripletVector.push_back(Eigen::Triplet(rowindex, rowin

[Bf-blender-cvs] [c9b3e34b9a8] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: minimize_stretch now only affects selected vertices. RESPECTS user defined pins!

2017-03-14 Thread Aurel Gruber
Commit: c9b3e34b9a8a519f4b924ff173902d8c5e018e35
Author: Aurel Gruber
Date:   Thu Mar 9 21:55:35 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBc9b3e34b9a8a519f4b924ff173902d8c5e018e35

UV Unwrapping SLIM: minimize_stretch now only affects selected vertices. 
RESPECTS user defined pins!

===

M   intern/slim/intern/slim_parametrizer.cpp
M   source/blender/editors/uvedit/uvedit_parametrizer.c

===

diff --git a/intern/slim/intern/slim_parametrizer.cpp 
b/intern/slim/intern/slim_parametrizer.cpp
index 7e9fe12edb2..5182b7850ef 100644
--- a/intern/slim/intern/slim_parametrizer.cpp
+++ b/intern/slim/intern/slim_parametrizer.cpp
@@ -78,7 +78,6 @@ Eigen::MatrixXd getInteractiveResultBlendedWithOriginal(float 
blend, SLIMData *s
 void param_slim_single_iteration(SLIMData *slimData){
int numberOfIterations = 1;
slim_solve(*slimData, numberOfIterations);
-   
 }
 
 void param_slim(SLIMMatrixTransfer *mt, int nIterations, bool 
borderVerticesArePinned, bool skipInitialization){
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 4133788aa2b..b4a891e9011 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -5039,7 +5039,7 @@ void transfer_vertices(const int chartNr, const PHandle 
*phandle, SLIMMatrixTran
UV[v->slimId] = v->uv[0];
UV[r + v->slimId] = v->uv[1];
 
-   if (v->flag & PVERT_PIN){
+   if (v->flag & PVERT_PIN || !(v->flag & PVERT_SELECT)){
mt->pinned_vertices = true;
mt->n_pinned_vertices[chartNr] += 1;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [901f02b8ec0] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: removing remainder of old minimize stretch

2017-03-14 Thread Aurel Gruber
Commit: 901f02b8ec0bf991fa02b3f0a76e78b81063c032
Author: Aurel Gruber
Date:   Fri Mar 10 08:55:29 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB901f02b8ec0bf991fa02b3f0a76e78b81063c032

UV Unwrapping SLIM: removing remainder of old minimize stretch

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 87a87797f21..17799ae6e07 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -3245,152 +3245,6 @@ static void p_chart_lscm_end(PChart *chart)
chart->u.lscm.pin2 = NULL;
 }
 
-/* Stretch */
-
-#define P_STRETCH_ITER 20
-
-static void p_stretch_pin_boundary(PChart *chart)
-{
-   PVert *v;
-
-   for (v = chart->verts; v; v = v->nextlink)
-   if (v->edge->pair == NULL)
-   v->flag |= PVERT_PIN;
-   else
-   v->flag &= ~PVERT_PIN;
-}
-
-static float p_face_stretch(PFace *f)
-{
-   float T, w, tmp[3];
-   float Ps[3], Pt[3];
-   float a, c, area;
-   PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
-   PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
-
-   area = p_face_uv_area_signed(f);
-
-   if (area <= 0.0f) /* flipped face -> infinite stretch */
-   return 1e10f;
-   
-   w = 1.0f / (2.0f * area);
-
-   /* compute derivatives */
-   copy_v3_v3(Ps, v1->co);
-   mul_v3_fl(Ps, (v2->uv[1] - v3->uv[1]));
-
-   copy_v3_v3(tmp, v2->co);
-   mul_v3_fl(tmp, (v3->uv[1] - v1->uv[1]));
-   add_v3_v3(Ps, tmp);
-
-   copy_v3_v3(tmp, v3->co);
-   mul_v3_fl(tmp, (v1->uv[1] - v2->uv[1]));
-   add_v3_v3(Ps, tmp);
-
-   mul_v3_fl(Ps, w);
-
-   copy_v3_v3(Pt, v1->co);
-   mul_v3_fl(Pt, (v3->uv[0] - v2->uv[0]));
-
-   copy_v3_v3(tmp, v2->co);
-   mul_v3_fl(tmp, (v1->uv[0] - v3->uv[0]));
-   add_v3_v3(Pt, tmp);
-
-   copy_v3_v3(tmp, v3->co);
-   mul_v3_fl(tmp, (v2->uv[0] - v1->uv[0]));
-   add_v3_v3(Pt, tmp);
-
-   mul_v3_fl(Pt, w);
-
-   /* Sander Tensor */
-   a = dot_v3v3(Ps, Ps);
-   c = dot_v3v3(Pt, Pt);
-
-   T =  sqrtf(0.5f * (a + c));
-   if (f->flag & PFACE_FILLED)
-   T *= 0.2f;
-
-   return T;
-}
-
-static float p_stretch_compute_vertex(PVert *v)
-{
-   PEdge *e = v->edge;
-   float sum = 0.0f;
-
-   do {
-   sum += p_face_stretch(e->face);
-   e = p_wheel_edge_next(e);
-   } while (e && e != (v->edge));
-
-   return sum;
-}
-
-static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
-{
-   PVert *v;
-   PEdge *e;
-   int j, nedges;
-   float orig_stretch, low, stretch_low, high, stretch_high, mid, stretch;
-   float orig_uv[2], dir[2], random_angle, trusted_radius;
-
-   for (v = chart->verts; v; v = v->nextlink) {
-   if ((v->flag & PVERT_PIN) || !(v->flag & PVERT_SELECT))
-   continue;
-
-   orig_stretch = p_stretch_compute_vertex(v);
-   orig_uv[0] = v->uv[0];
-   orig_uv[1] = v->uv[1];
-
-   /* move vertex in a random direction */
-   trusted_radius = 0.0f;
-   nedges = 0;
-   e = v->edge;
-
-   do {
-   trusted_radius += p_edge_uv_length(e);
-   nedges++;
-
-   e = p_wheel_edge_next(e);
-   } while (e && e != (v->edge));
-
-   trusted_radius /= 2 * nedges;
-
-   random_angle = BLI_rng_get_float(rng) * 2.0f * (float)M_PI;
-   dir[0] = trusted_radius * cosf(random_angle);
-   dir[1] = trusted_radius * sinf(random_angle);
-
-   /* calculate old and new stretch */
-   low = 0;
-   stretch_low = orig_stretch;
-
-   add_v2_v2v2(v->uv, orig_uv, dir);
-   high = 1;
-   stretch = stretch_high = p_stretch_compute_vertex(v);
-
-   /* binary search for lowest stretch position */
-   for (j = 0; j < P_STRETCH_ITER; j++) {
-   mid = 0.5f * (low + high);
-   v->uv[0] = orig_uv[0] + mid * dir[0];
-   v->uv[1] = orig_uv[1] + mid * dir[1];
-   stretch = p_stretch_compute_vertex(v);
-
-   if (stret

[Bf-blender-cvs] [eef1392c476] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: renaming src to intern

2017-03-14 Thread Aurel Gruber
Commit: eef1392c4768b8fec5aeb8985547f8161541182c
Author: Aurel Gruber
Date:   Thu Mar 9 16:52:52 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBeef1392c4768b8fec5aeb8985547f8161541182c

UV Unwrapping SLIM: renaming src to intern

===

M   intern/slim/CMakeLists.txt
R100intern/slim/src/area_compensation.cpp   
intern/slim/intern/area_compensation.cpp
R100intern/slim/src/geometry_data_retrieval.cpp 
intern/slim/intern/geometry_data_retrieval.cpp
R100intern/slim/src/least_squares_relocator.cpp 
intern/slim/intern/least_squares_relocator.cpp
R100intern/slim/src/slim.cppintern/slim/intern/slim.cpp
R100intern/slim/src/slim_c_interface.cpp
intern/slim/intern/slim_c_interface.cpp
R100intern/slim/src/slim_parametrizer.cpp   
intern/slim/intern/slim_parametrizer.cpp
R100intern/slim/src/uv_initializer.cpp  
intern/slim/intern/uv_initializer.cpp

===

diff --git a/intern/slim/CMakeLists.txt b/intern/slim/CMakeLists.txt
index 301df00ee76..0b25182b145 100644
--- a/intern/slim/CMakeLists.txt
+++ b/intern/slim/CMakeLists.txt
@@ -22,13 +22,13 @@ set(SRC
   least_squares_relocator.h
   geometry_data_retrieval.h
 
-  src/slim.cpp
-  src/slim_parametrizer.cpp
-  src/uv_initializer.cpp
-  src/slim_c_interface.cpp
-  src/area_compensation.cpp
-  src/least_squares_relocator.cpp
-  src/geometry_data_retrieval.cpp
+  intern/slim.cpp
+  intern/slim_parametrizer.cpp
+  intern/uv_initializer.cpp
+  intern/slim_c_interface.cpp
+  intern/area_compensation.cpp
+  intern/least_squares_relocator.cpp
+  intern/geometry_data_retrieval.cpp
 
 
   ${ADDITIONAL_SOURCES}
diff --git a/intern/slim/src/area_compensation.cpp 
b/intern/slim/intern/area_compensation.cpp
similarity index 100%
rename from intern/slim/src/area_compensation.cpp
rename to intern/slim/intern/area_compensation.cpp
diff --git a/intern/slim/src/geometry_data_retrieval.cpp 
b/intern/slim/intern/geometry_data_retrieval.cpp
similarity index 100%
rename from intern/slim/src/geometry_data_retrieval.cpp
rename to intern/slim/intern/geometry_data_retrieval.cpp
diff --git a/intern/slim/src/least_squares_relocator.cpp 
b/intern/slim/intern/least_squares_relocator.cpp
similarity index 100%
rename from intern/slim/src/least_squares_relocator.cpp
rename to intern/slim/intern/least_squares_relocator.cpp
diff --git a/intern/slim/src/slim.cpp b/intern/slim/intern/slim.cpp
similarity index 100%
rename from intern/slim/src/slim.cpp
rename to intern/slim/intern/slim.cpp
diff --git a/intern/slim/src/slim_c_interface.cpp 
b/intern/slim/intern/slim_c_interface.cpp
similarity index 100%
rename from intern/slim/src/slim_c_interface.cpp
rename to intern/slim/intern/slim_c_interface.cpp
diff --git a/intern/slim/src/slim_parametrizer.cpp 
b/intern/slim/intern/slim_parametrizer.cpp
similarity index 100%
rename from intern/slim/src/slim_parametrizer.cpp
rename to intern/slim/intern/slim_parametrizer.cpp
diff --git a/intern/slim/src/uv_initializer.cpp 
b/intern/slim/intern/uv_initializer.cpp
similarity index 100%
rename from intern/slim/src/uv_initializer.cpp
rename to intern/slim/intern/uv_initializer.cpp

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [732159dcf8c] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: further refactoring according to discussion on D2530

2017-03-14 Thread Aurel Gruber
Commit: 732159dcf8c8d9f1d91a113919608b80eae7d766
Author: Aurel Gruber
Date:   Thu Mar 9 16:44:38 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB732159dcf8c8d9f1d91a113919608b80eae7d766

UV Unwrapping SLIM: further refactoring according to discussion on D2530

===

M   intern/slim/CMakeLists.txt
M   intern/slim/geometry_data_retrieval.h
D   intern/slim/matrix_transfer.h
M   intern/slim/slim_c_interface.h
M   intern/slim/slim_parametrizer.h
M   intern/slim/src/geometry_data_retrieval.cpp
M   intern/slim/src/slim_c_interface.cpp
M   intern/slim/src/slim_parametrizer.cpp
M   source/blender/editors/uvedit/CMakeLists.txt
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/slim/CMakeLists.txt b/intern/slim/CMakeLists.txt
index ae133525a97..301df00ee76 100644
--- a/intern/slim/CMakeLists.txt
+++ b/intern/slim/CMakeLists.txt
@@ -13,7 +13,7 @@ set(INC_SYS
 )
 
 set(SRC
-  matrix_transfer.h
+  slim_matrix_transfer.h
   slim.h
   slim_parametrizer.h
   uv_initializer.h
diff --git a/intern/slim/geometry_data_retrieval.h 
b/intern/slim/geometry_data_retrieval.h
index 1ab96f9d77b..21c76582331 100644
--- a/intern/slim/geometry_data_retrieval.h
+++ b/intern/slim/geometry_data_retrieval.h
@@ -31,7 +31,7 @@
 #include 
 #include 
 
-#include "matrix_transfer.h"
+#include "slim_matrix_transfer.h"
 #include "slim.h"
 #include "uv_initializer.h"
 
@@ -71,7 +71,7 @@ namespace retrieval {
 
void retrievePinnedVertices(GeometryData , bool 
borderVerticesArePinned);
 
-   void retrieveGeometryDataMatrices(const matrix_transfer 
*transferredData,
+   void retrieveGeometryDataMatrices(const SLIMMatrixTransfer 
*transferredData,
  const 
int uvChartIndex,
  
GeometryData );
 }
diff --git a/intern/slim/matrix_transfer.h b/intern/slim/matrix_transfer.h
deleted file mode 100644
index 4584981f93e..000
--- a/intern/slim/matrix_transfer.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * * BEGIN GPL LICENSE BLOCK *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Aurel Gruber
- *
- * * END GPL LICENSE BLOCK *
- */
-
-#ifndef matrix_transfer_h
-#define matrix_transfer_h
-
-#include 
-
-/* Struct that holds all the information and data matrices to be 
transfered from the native Blender part to SLIM, named as follows:
-
-   Matrix/Vector   |   contains pointers to arrays of:
-   |_
-   Vmatrices   |   vertex positions
-   UVmatrices  |   UV positions of vertices
-   PPmatrice   |   positions of pinned vertices
-   ELvectors   |   Edge lengths
-   Wvectors|   weights pre vertex
-   Fmatrices   |   vertexindex-triplets making up the faces
-   Pmatrices   |   indices of pinned vertices
-   Ematrix |   vertexindex-tuples making up edges
-   Bvector |   vertexindices of boundary vertices
-   ---
-*/
-typedef struct {
-   int nCharts;
-   int *nVerts, *nFaces, *nPinnedVertices, *nBoundaryVertices, *nEdges;
-
-   double **Vmatrices, **UVmatrices, **PPmatrices;
-   double **ELvectors;
-   float **Wvectors;
-
-   int **Fmatrices, **Pmatrices, **Ematrices;
-   int **Bvectors;
-
-   bool fixed_boundary;
-   bool pinned_vertices;
-   bool with_weighted_parameterization;
-   double weight_influence;
-   bool transform_islands;
-   int slim_reflection_mode;
-   double relativ

[Bf-blender-cvs] [118d63712d3] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: removing thesis marker-comments from code

2017-03-14 Thread Aurel Gruber
Commit: 118d63712d3a24b569d4c457f1caf315b471e590
Author: Aurel Gruber
Date:   Thu Mar 9 14:12:40 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB118d63712d3a24b569d4c457f1caf315b471e590

UV Unwrapping SLIM: removing thesis marker-comments from code

===

M   intern/slim/matrix_transfer.h
M   intern/slim/slim_parametrizer.h
M   intern/slim/src/slim_c_interface.cpp
M   source/blender/bmesh/bmesh_class.h
M   source/blender/editors/uvedit/uvedit_intern.h
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/intern/slim/matrix_transfer.h b/intern/slim/matrix_transfer.h
index fc275143936..4584981f93e 100644
--- a/intern/slim/matrix_transfer.h
+++ b/intern/slim/matrix_transfer.h
@@ -30,8 +30,7 @@
 
 #include 
 
-/* AUREL THESIS
-   Struct that holds all the information and data matrices to be 
transfered from the native Blender part to SLIM, named as follows:
+/* Struct that holds all the information and data matrices to be 
transfered from the native Blender part to SLIM, named as follows:
 
Matrix/Vector   |   contains pointers to arrays of:
|_
diff --git a/intern/slim/slim_parametrizer.h b/intern/slim/slim_parametrizer.h
index 834f9a8bf20..321b0944bae 100644
--- a/intern/slim/slim_parametrizer.h
+++ b/intern/slim/slim_parametrizer.h
@@ -35,8 +35,7 @@
 
 using namespace igl;
 
-/* AUREL THESIS
-   The header file that exposes the C++ functions to the native C part of 
Blender, see thesis.
+/* The header file that exposes the C++ functions to the native C part of 
Blender, see thesis.
 */
 
 Eigen::MatrixXd getInteractiveResultBlendedWithOriginal(float blend, SLIMData 
*slimData);
diff --git a/intern/slim/src/slim_c_interface.cpp 
b/intern/slim/src/slim_c_interface.cpp
index 61bc99e4738..6b91f141bdd 100644
--- a/intern/slim/src/slim_c_interface.cpp
+++ b/intern/slim/src/slim_c_interface.cpp
@@ -38,8 +38,7 @@
 
 using namespace igl;
 
-/* AUREL THESIS
-   Called from the native part during each iteration of interactive 
parametrisation.
+/*  Called from the native part during each iteration of interactive 
parametrisation.
The blend parameter decides the linear blending between the original UV 
map and the one
optained from the accumulated SLIM iterations so far.
  */
@@ -50,8 +49,7 @@ void transfer_uvs_blended_C(matrix_transfer *mt, void* 
slimDataPtr, int uvChartI
transferUvsBackToNativePart(mt, blendedUvs, uvChartIndex);
 }
 
-/* AUREL THESIS
-   Setup call from the native C part. Necessary for interactive 
parametrisation.
+/* Setup call from the native C part. Necessary for interactive 
parametrisation.
  */
 void* setup_slim_C(matrix_transfer *mt, int uvChartIndex, bool 
borderVerticesArePinned, bool skipInitialization){
igl::Timer timer;
@@ -60,8 +58,7 @@ void* setup_slim_C(matrix_transfer *mt, int uvChartIndex, 
bool borderVerticesAre
return slimData;
 }
 
-/* AUREL THESIS
-   Executes a single iteration of SLIM, to be called from the native part. 
It recasts the pointer to a SLIM object.
+/* Executes a single iteration of SLIM, to be called from the native part. 
It recasts the pointer to a SLIM object.
  */
 void param_slim_single_iteration_C(void* slimDataPtr){
SLIMData* slimData = (SLIMData*) slimDataPtr;
diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index 49077b19be3..82f97b873e0 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -99,7 +99,7 @@ typedef struct BMVert {
 *   which is a bit of an abuse of internal bmesh data but also 
works OK for now (use with care!).
 */
struct BMEdge *e;
-   /* AUREL */
+
int id;
 } BMVert;
 
diff --git a/source/blender/editors/uvedit/uvedit_intern.h 
b/source/blender/editors/uvedit/uvedit_intern.h
index e8dbb337cf4..032cf5e9148 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -75,7 +75,6 @@ void UV_OT_cube_project(struct wmOperatorType *ot);
 void UV_OT_cylinder_project(struct wmOperatorType *ot);
 void UV_OT_project_from_view(struct wmOperatorType *ot);
 void UV_OT_minimize_stretch(struct wmOperatorType *ot);
-// AUREL SLIM interactive parameterization
 void UV_OT_minimize_stretch_slim(struct wmOperatorType *ot);
 void UV_OT_pack_islands(struct wmOperatorType *ot);
 void UV_OT_reset(struct wmOperatorType *ot);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c 
b/source/blender

[Bf-blender-cvs] [bccca31bd1c] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: removing old minimize stretch operator

2017-03-14 Thread Aurel Gruber
Commit: bccca31bd1ce70d1bdec64fb2da4150bd49c6e59
Author: Aurel Gruber
Date:   Thu Mar 9 14:52:43 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBbccca31bd1ce70d1bdec64fb2da4150bd49c6e59

UV Unwrapping SLIM: removing old minimize stretch operator

===

M   source/blender/editors/uvedit/uvedit_intern.h
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_intern.h 
b/source/blender/editors/uvedit/uvedit_intern.h
index 032cf5e9148..e028c08091c 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -75,7 +75,6 @@ void UV_OT_cube_project(struct wmOperatorType *ot);
 void UV_OT_cylinder_project(struct wmOperatorType *ot);
 void UV_OT_project_from_view(struct wmOperatorType *ot);
 void UV_OT_minimize_stretch(struct wmOperatorType *ot);
-void UV_OT_minimize_stretch_slim(struct wmOperatorType *ot);
 void UV_OT_pack_islands(struct wmOperatorType *ot);
 void UV_OT_reset(struct wmOperatorType *ot);
 void UV_OT_sphere_project(struct wmOperatorType *ot);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c 
b/source/blender/editors/uvedit/uvedit_ops.c
index 1bf2557e28f..193b006cf0d 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -4265,7 +4265,6 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_cylinder_project);
WM_operatortype_append(UV_OT_project_from_view);
WM_operatortype_append(UV_OT_minimize_stretch);
-   WM_operatortype_append(UV_OT_minimize_stretch_slim);
WM_operatortype_append(UV_OT_pack_islands);
WM_operatortype_append(UV_OT_reset);
WM_operatortype_append(UV_OT_sphere_project);
@@ -4342,7 +4341,6 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* unwrap */
WM_keymap_add_item(keymap, "UV_OT_unwrap", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UV_OT_minimize_stretch", VKEY, KM_PRESS, 
KM_CTRL, 0);
-   WM_keymap_add_item(keymap, "UV_OT_minimize_stretch_slim", MKEY, 
KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_pack_islands", PKEY, KM_PRESS, 
KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_average_islands_scale", AKEY, 
KM_PRESS, KM_CTRL, 0);
 
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index d136993a174..f1626a0edc3 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -546,222 +546,11 @@ void enrich_handle_slim(Scene *scene, Object *obedit, 
BMEditMesh *em, ParamHandl
 
with_weighted_parameterization);
 }
 
-/*  Minimize Stretch operator  */
-
-typedef struct MinStretch {
-   Scene *scene;
-   Object *obedit;
-   BMEditMesh *em;
-   ParamHandle *handle;
-   float blend;
-   double lasttime;
-   int i, iterations;
-   wmTimer *timer;
-} MinStretch;
-
-static bool minimize_stretch_init(bContext *C, wmOperator *op)
-{
-   Scene *scene = CTX_data_scene(C);
-   Object *obedit = CTX_data_edit_object(C);
-   BMEditMesh *em = BKE_editmesh_from_object(obedit);
-   MinStretch *ms;
-   const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
-   bool implicit = true;
-
-   if (!uvedit_have_selection(scene, em, implicit)) {
-   return false;
-   }
-
-   ms = MEM_callocN(sizeof(MinStretch), "MinStretch");
-   ms->scene = scene;
-   ms->obedit = obedit;
-   ms->em = em;
-   ms->blend = RNA_float_get(op->ptr, "blend");
-   ms->iterations = RNA_int_get(op->ptr, "iterations");
-   ms->i = 0;
-   ms->handle = construct_param_handle(scene, obedit, em->bm, implicit, 
fill_holes, 1, 1);
-   ms->lasttime = PIL_check_seconds_timer();
-
-   param_stretch_begin(ms->handle);
-   if (ms->blend != 0.0f)
-   param_stretch_blend(ms->handle, ms->blend);
-
-   op->customdata = ms;
-
-   return true;
-}
-
-static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool 
interactive)
-{
-   MinStretch *ms = op->customdata;
-   ScrArea *sa = CTX_wm_area(C);
-
-   param_stretch_blend(ms->handle, ms->blend);
-   param_stretch_iter(ms->handle);
-
-   ms->i++;
-   RNA_int_set(op->ptr, "iterations", ms->i);
-
-   if (interactive && (PIL_check_seconds_timer() - ms->lasttime > 0.5)) {
-   char str[UI_MAX_DRAW_STR];
-
-  

[Bf-blender-cvs] [c35c83a3ab8] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: adding slim_matrix_transfer.h

2017-03-14 Thread Aurel Gruber
Commit: c35c83a3ab831854bc528e646a2e584bc6822d56
Author: Aurel Gruber
Date:   Thu Mar 9 16:46:00 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBc35c83a3ab831854bc528e646a2e584bc6822d56

UV Unwrapping SLIM: adding slim_matrix_transfer.h

===

A   intern/slim/slim_matrix_transfer.h

===

diff --git a/intern/slim/slim_matrix_transfer.h 
b/intern/slim/slim_matrix_transfer.h
new file mode 100644
index 000..3ac9050d349
--- /dev/null
+++ b/intern/slim/slim_matrix_transfer.h
@@ -0,0 +1,79 @@
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Aurel Gruber
+ *
+ * * END GPL LICENSE BLOCK *
+ */
+
+#ifndef slim_matrix_transfer_h
+#define slim_matrix_transfer_h
+
+#include 
+
+/* Struct that holds all the information and data matrices to be 
transfered from the native Blender part to SLIM, named as follows:
+
+   Matrix/Vector   |   contains pointers to arrays of:
+   |_
+   v_matrices  |   vertex positions
+   uv_matrices |   UV positions of vertices
+   PPmatrice   |   positions of pinned vertices
+   el_vectors  |   Edge lengths
+   w_vectors   |   weights pre vertex
+   f_matrices  |   vertexindex-triplets making up the faces
+   p_matrices  |   indices of pinned vertices
+   Ematrix |   vertexindex-tuples making up edges
+   Bvector |   vertexindices of boundary vertices
+   ---
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+   int n_charts;
+   int *n_verts, *n_faces, *n_pinned_vertices, *n_boundary_vertices, 
*n_edges;
+
+   double **v_matrices, **uv_matrices, **pp_matrices;
+   double **el_vectors;
+   float **w_vectors;
+
+   int **f_matrices, **p_matrices, **e_matrices;
+   int **b_vectors;
+
+   bool fixed_boundary;
+   bool pinned_vertices;
+   bool with_weighted_parameterization;
+   double weight_influence;
+   bool transform_islands;
+   int slim_reflection_mode;
+   double relative_scale;
+
+} SLIMMatrixTransfer;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* slim_matrix_transfer_h */
+

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [67ef01a2c38] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: respecting source/blender style conventions

2017-03-14 Thread Aurel Gruber
Commit: 67ef01a2c38759e810860a4a335418f02fd8a8c7
Author: Aurel Gruber
Date:   Thu Mar 9 14:47:12 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB67ef01a2c38759e810860a4a335418f02fd8a8c7

UV Unwrapping SLIM: respecting source/blender style conventions

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 21c4be1c8be..099b134281b 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4349,19 +4349,21 @@ void param_construct_end(ParamHandle *handle, ParamBool 
fill, ParamBool impl)
phandle->state = PHANDLE_STATE_CONSTRUCTED;
 }
 
-void add_index_to_vertices(BMEditMesh *em){
+void add_index_to_vertices(BMEditMesh *em)
+{

// iterate over bm edit mesh and set indices for weight retrieval,
// This allows for later matching of vertices to weights.
BMVert *vert;
BMIter iter;
int i;
-   BM_ITER_MESH_INDEX(vert, , em->bm, BM_VERTS_OF_MESH, i){
+   BM_ITER_MESH_INDEX(vert, , em->bm, BM_VERTS_OF_MESH, i) {
vert->id = i;
}
 }
 
-int retrieve_weightmap_index(Object *obedit, char *vertex_group){
+int retrieve_weightmap_index(Object *obedit, char *vertex_group)
+{
return defgroup_name_index(obedit, vertex_group);
 }
 
@@ -4376,7 +4378,8 @@ void param_slim_enrich_handle(Object *obedit,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
- bool 
with_weighted_parameterization){
+ bool 
with_weighted_parameterization)
+{
 
PHandle *phandle = (PHandle *)handle;
 
@@ -4392,41 +4395,47 @@ void param_slim_enrich_handle(Object *obedit,
phandle->bm = em->bm;
 }
 
-void param_begin(ParamHandle *handle, ParamBool abf, bool use_slim) {
-   if (use_slim){
+void param_begin(ParamHandle *handle, ParamBool abf, bool use_slim)
+{
+   if (use_slim) {
param_slim_begin(handle);
} else {
param_lscm_begin(handle, PARAM_FALSE, abf);
}
 }
 
-void param_solve(ParamHandle *handle, bool use_slim) {
-   if (use_slim){
+void param_solve(ParamHandle *handle, bool use_slim)
+{
+   if (use_slim) {
param_slim_solve(handle);
} else {
param_lscm_solve(handle);
}
 }
 
-void param_end(ParamHandle *handle, bool use_slim) {
-   if (use_slim){
+void param_end(ParamHandle *handle, bool use_slim)
+{
+   if (use_slim) {
param_slim_end(handle);
} else {
param_lscm_end(handle);
}
 }
 
-void param_slim_begin(ParamHandle *handle) {
+void param_slim_begin(ParamHandle *handle)
+{
transfer_data_to_slim(handle);
 }
 
-void param_slim_solve(ParamHandle *handle) {
+void param_slim_solve(ParamHandle *handle)
+{
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
param_slim_C(mt, phandle->n_iterations, mt->fixed_boundary, 
phandle->skip_initialization);
 }
 
-void param_slim_end(ParamHandle *handle) {
+void param_slim_end(ParamHandle *handle)
+{
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
set_uv_param_slim(handle, mt);
@@ -4827,7 +4836,8 @@ void transfer_boundary_vertices(const int chartNr, const 
PHandle *phandle, const
 void transfer_faces(const int chartNr, const PHandle *phandle, const 
matrix_transfer *mt);
 bool transformIslands(ParamHandle *handle);
 
-void transfer_data_to_slim(ParamHandle *handle){
+void transfer_data_to_slim(ParamHandle *handle)
+{
 
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
@@ -4865,7 +4875,7 @@ void convert_blender_slim(ParamHandle *handle, bool 
selectionOnly, int weightMap
 
float *tempW = MEM_callocN(mt->nVerts[chartNr] * 
sizeof(*tempW), " Weight-per-face Vector, ordered by BM_ITER_MESH_INDEX");
 
-   if (mt->with_weighted_parameterization){
+   if (mt->with_weighted_parameterization) {
create_weight_matrix(phandle, tempW, weightMapIndex);
}
transfer_boundary_vertices(chartNr, phandle, mt, tempW);
@@ -4881,7 +4891,7 @@ void convert_blender_slim(ParamHandle *handle, bool 
selectionOnly, int weightMap
MEM_freeN(tempW);
}

[Bf-blender-cvs] [3027e0bdcad] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: adding GPL header comment

2017-03-14 Thread Aurel Gruber
Commit: 3027e0bdcadcd537b5027cb2e5e8afc89dad437f
Author: Aurel Gruber
Date:   Thu Mar 9 14:07:04 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB3027e0bdcadcd537b5027cb2e5e8afc89dad437f

UV Unwrapping SLIM: adding GPL header comment

===

M   intern/slim/area_compensation.h
M   intern/slim/geometry_data_retrieval.h
M   intern/slim/least_squares_relocator.h
M   intern/slim/matrix_transfer.h
M   intern/slim/slim.h
M   intern/slim/slim_c_interface.h
M   intern/slim/slim_parametrizer.h
M   intern/slim/src/area_compensation.cpp
M   intern/slim/src/geometry_data_retrieval.cpp
M   intern/slim/src/least_squares_relocator.cpp
M   intern/slim/src/slim.cpp
M   intern/slim/src/slim_c_interface.cpp
M   intern/slim/src/slim_parametrizer.cpp
M   intern/slim/src/uv_initializer.cpp
M   intern/slim/uv_initializer.h

===

diff --git a/intern/slim/area_compensation.h b/intern/slim/area_compensation.h
index e884c56baa6..d44bdc19613 100644
--- a/intern/slim/area_compensation.h
+++ b/intern/slim/area_compensation.h
@@ -1,10 +1,29 @@
-//
-//  areaCompensator.cpp
-//  Blender
-//
-//  Created by Aurel Gruber on 05.12.16.
-//
-//
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Aurel Gruber
+ *
+ * * END GPL LICENSE BLOCK *
+ */
 
 #include "slim.h"
 
diff --git a/intern/slim/geometry_data_retrieval.h 
b/intern/slim/geometry_data_retrieval.h
index 8f87c9f3aca..1ab96f9d77b 100644
--- a/intern/slim/geometry_data_retrieval.h
+++ b/intern/slim/geometry_data_retrieval.h
@@ -1,10 +1,29 @@
-//
-//  geometry_data_retrieval.h
-//  Blender
-//
-//  Created by Aurel Gruber on 05.12.16.
-//
-//
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Aurel Gruber
+ *
+ * * END GPL LICENSE BLOCK *
+ */
 
 #ifndef geometry_data_retrieval_h
 #define geometry_data_retrieval_h
diff --git a/intern/slim/least_squares_relocator.h 
b/intern/slim/least_squares_relocator.h
index fd3c862c307..24bbb97ecb2 100644
--- a/intern/slim/least_squares_relocator.h
+++ b/intern/slim/least_squares_relocator.h
@@ -1,10 +1,29 @@
-//
-//  least_squares_relocator.hpp
-//  Blender
-//
-//  Created by Aurel Gruber on 05.12.16.
-//
-//
+/*
+ * * BEGIN GPL LICENSE BLOCK *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * 

[Bf-blender-cvs] [c603ba9e7c0] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: renaming slim_c_interface to slim_capi and renaming contained functions

2017-03-14 Thread Aurel Gruber
Commit: c603ba9e7c0f76fd300132c2b9d7ebce0d3a52fa
Author: Aurel Gruber
Date:   Thu Mar 9 17:04:58 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBc603ba9e7c0f76fd300132c2b9d7ebce0d3a52fa

UV Unwrapping SLIM: renaming slim_c_interface to slim_capi and renaming 
contained functions

===

M   intern/slim/CMakeLists.txt
R082intern/slim/intern/slim_c_interface.cpp intern/slim/intern/slim_capi.cpp
R067intern/slim/slim_c_interface.h  intern/slim/slim_capi.h
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/slim/CMakeLists.txt b/intern/slim/CMakeLists.txt
index 0b25182b145..0cb66132c6c 100644
--- a/intern/slim/CMakeLists.txt
+++ b/intern/slim/CMakeLists.txt
@@ -17,7 +17,7 @@ set(SRC
   slim.h
   slim_parametrizer.h
   uv_initializer.h
-  slim_c_interface.h
+  slim_capi.h
   area_compensation.h
   least_squares_relocator.h
   geometry_data_retrieval.h
@@ -25,7 +25,7 @@ set(SRC
   intern/slim.cpp
   intern/slim_parametrizer.cpp
   intern/uv_initializer.cpp
-  intern/slim_c_interface.cpp
+  intern/slim_capi.cpp
   intern/area_compensation.cpp
   intern/least_squares_relocator.cpp
   intern/geometry_data_retrieval.cpp
diff --git a/intern/slim/intern/slim_c_interface.cpp 
b/intern/slim/intern/slim_capi.cpp
similarity index 82%
rename from intern/slim/intern/slim_c_interface.cpp
rename to intern/slim/intern/slim_capi.cpp
index 349c290690a..7f42879b9b2 100644
--- a/intern/slim/intern/slim_c_interface.cpp
+++ b/intern/slim/intern/slim_capi.cpp
@@ -27,7 +27,7 @@
 
 #include 
 
-#include "slim_c_interface.h"
+#include "slim_capi.h"
 #include "slim_parametrizer.h"
 #include "slim.h"
 
@@ -42,7 +42,7 @@ using namespace igl;
The blend parameter decides the linear blending between the original UV 
map and the one
optained from the accumulated SLIM iterations so far.
  */
-void transfer_uvs_blended_C(SLIMMatrixTransfer *mt, void* slim_data_ptr, int 
uv_chart_index, float blend){
+void SLIM_transfer_uvs_blended(SLIMMatrixTransfer *mt, void* slim_data_ptr, 
int uv_chart_index, float blend){
SLIMData* slim_data = (SLIMData*) slim_data_ptr;
Eigen::MatrixXd blended_uvs = 
getInteractiveResultBlendedWithOriginal(blend, slim_data);
areacomp::correctMapSurfaceAreaIfNecessary(slim_data);
@@ -51,7 +51,7 @@ void transfer_uvs_blended_C(SLIMMatrixTransfer *mt, void* 
slim_data_ptr, int uv_
 
 /* Setup call from the native C part. Necessary for interactive 
parametrisation.
  */
-void* setup_slim_C(SLIMMatrixTransfer *mt, int uv_chart_index, bool 
are_border_vertices_pinned, bool skip_initialization){
+void* SLIM_setup(SLIMMatrixTransfer *mt, int uv_chart_index, bool 
are_border_vertices_pinned, bool skip_initialization){
igl::Timer timer;
timer.start();
SLIMData* slim_data = setup_slim(mt, 0, uv_chart_index, timer, 
are_border_vertices_pinned, skip_initialization);
@@ -60,15 +60,15 @@ void* setup_slim_C(SLIMMatrixTransfer *mt, int 
uv_chart_index, bool are_border_v
 
 /* Executes a single iteration of SLIM, to be called from the native part. 
It recasts the pointer to a SLIM object.
  */
-void param_slim_single_iteration_C(void* slim_data_ptr){
+void SLIM_parametrize_single_iteration(void* slim_data_ptr){
SLIMData* slim_data = (SLIMData*) slim_data_ptr;
param_slim_single_iteration(slim_data);
 }
 
-void param_slim_C(SLIMMatrixTransfer *mt, int n_iterations, bool 
are_border_vertices_pinned, bool skip_initialization){
+void SLIM_parametrize(SLIMMatrixTransfer *mt, int n_iterations, bool 
are_border_vertices_pinned, bool skip_initialization){
param_slim(mt, n_iterations, are_border_vertices_pinned, 
skip_initialization);
 }
 
-void free_slim_data_C(void* slim_data_ptr){
+void SLIM_free_data(void* slim_data_ptr){
free_slim_data((SLIMData*) slim_data_ptr);
 }
diff --git a/intern/slim/slim_c_interface.h b/intern/slim/slim_capi.h
similarity index 67%
rename from intern/slim/slim_c_interface.h
rename to intern/slim/slim_capi.h
index 7e9dea63d91..036a67eae49 100644
--- a/intern/slim/slim_c_interface.h
+++ b/intern/slim/slim_capi.h
@@ -25,8 +25,8 @@
  * * END GPL LICENSE BLOCK *
  */
 
-#ifndef slim_c_interface_h
-#define slim_c_interface_h
+#ifndef slim_capi_h
+#define slim_capi_h
 
 #include "slim_matrix_transfer.h"
 
@@ -34,14 +34,14 @@
 extern "C" {
 #endif
 
-void param_slim_C(SLIMMatrixTransfer *mt, int n_iterations, bool 
are_border_vertices_pinned, bool skip_initialization);
-void transfer_uvs_blended_C(SLIMMatrixTransfer *mt, void *slim, int 
uv_chart_index, float blend);
-void param_slim_single_iteration_C(void *slim);
-void* s

[Bf-blender-cvs] [ebae2d6aa2e] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: renaming files and moving headers

2017-03-14 Thread Aurel Gruber
Commit: ebae2d6aa2eb70e7116df9aa2924468c06db50d8
Author: Aurel Gruber
Date:   Thu Mar 9 13:56:18 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBebae2d6aa2eb70e7116df9aa2924468c06db50d8

UV Unwrapping SLIM: renaming files and moving headers

===

M   intern/slim/CMakeLists.txt
R100intern/slim/src/area_compensation.h intern/slim/area_compensation.h
R098intern/slim/src/geometry_data_retrieval.h   
intern/slim/geometry_data_retrieval.h
R100intern/slim/src/least_squares_relocator.h   
intern/slim/least_squares_relocator.h
R100intern/slim/src/matrix_transfer.h   intern/slim/matrix_transfer.h
R100intern/slim/src/Slim.h  intern/slim/slim.h
R100intern/slim/src/slim_parametrizer.h intern/slim/slim_parametrizer.h
R100intern/slim/src/Slim.cppintern/slim/src/slim.cpp
R096intern/slim/src/slim_C_interface.cpp
intern/slim/src/slim_c_interface.cpp
R087intern/slim/src/slim_C_interface.h  
intern/slim/src/slim_c_interface.h
M   intern/slim/src/slim_parametrizer.cpp
R099intern/slim/src/UVInitializer.cpp   
intern/slim/src/uv_initializer.cpp
R100intern/slim/src/UVInitializer.h intern/slim/uv_initializer.h
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/slim/CMakeLists.txt b/intern/slim/CMakeLists.txt
index d8cdc0fcfb3..ae133525a97 100644
--- a/intern/slim/CMakeLists.txt
+++ b/intern/slim/CMakeLists.txt
@@ -1,6 +1,7 @@
 cmake_minimum_required(VERSION 2.6)
 
 set(INC
+  ./
   ext/libigl_extract
   ../../source/blender/editors/uvedit
   ../../source/blender/makesdna
@@ -12,22 +13,23 @@ set(INC_SYS
 )
 
 set(SRC
+  matrix_transfer.h
+  slim.h
+  slim_parametrizer.h
+  uv_initializer.h
+  slim_c_interface.h
+  area_compensation.h
+  least_squares_relocator.h
+  geometry_data_retrieval.h
+
   src/slim.cpp
   src/slim_parametrizer.cpp
-  src/UVInitializer.cpp
-  src/slim_C_interface.cpp
+  src/uv_initializer.cpp
+  src/slim_c_interface.cpp
   src/area_compensation.cpp
   src/least_squares_relocator.cpp
   src/geometry_data_retrieval.cpp
 
-  src/matrix_transfer.h
-  src/slim.h
-  src/slim_parametrizer.h
-  src/UVInitializer.h
-  src/slim_C_interface.h
-  src/area_compensation.h
-  src/least_squares_relocator.h
-  src/geometry_data_retrieval.h
 
   ${ADDITIONAL_SOURCES}
 )
diff --git a/intern/slim/src/area_compensation.h 
b/intern/slim/area_compensation.h
similarity index 100%
rename from intern/slim/src/area_compensation.h
rename to intern/slim/area_compensation.h
diff --git a/intern/slim/src/geometry_data_retrieval.h 
b/intern/slim/geometry_data_retrieval.h
similarity index 98%
rename from intern/slim/src/geometry_data_retrieval.h
rename to intern/slim/geometry_data_retrieval.h
index fc0028187a4..8f87c9f3aca 100644
--- a/intern/slim/src/geometry_data_retrieval.h
+++ b/intern/slim/geometry_data_retrieval.h
@@ -14,7 +14,7 @@
 
 #include "matrix_transfer.h"
 #include "slim.h"
-#include "UVInitializer.h"
+#include "uv_initializer.h"
 
 using namespace Eigen;
 using namespace igl;
diff --git a/intern/slim/src/least_squares_relocator.h 
b/intern/slim/least_squares_relocator.h
similarity index 100%
rename from intern/slim/src/least_squares_relocator.h
rename to intern/slim/least_squares_relocator.h
diff --git a/intern/slim/src/matrix_transfer.h b/intern/slim/matrix_transfer.h
similarity index 100%
rename from intern/slim/src/matrix_transfer.h
rename to intern/slim/matrix_transfer.h
diff --git a/intern/slim/src/Slim.h b/intern/slim/slim.h
similarity index 100%
rename from intern/slim/src/Slim.h
rename to intern/slim/slim.h
diff --git a/intern/slim/src/slim_parametrizer.h 
b/intern/slim/slim_parametrizer.h
similarity index 100%
rename from intern/slim/src/slim_parametrizer.h
rename to intern/slim/slim_parametrizer.h
diff --git a/intern/slim/src/Slim.cpp b/intern/slim/src/slim.cpp
similarity index 100%
rename from intern/slim/src/Slim.cpp
rename to intern/slim/src/slim.cpp
diff --git a/intern/slim/src/slim_C_interface.cpp 
b/intern/slim/src/slim_c_interface.cpp
similarity index 96%
rename from intern/slim/src/slim_C_interface.cpp
rename to intern/slim/src/slim_c_interface.cpp
index 4ce3f6464fd..cbd79fd0fd0 100644
--- a/intern/slim/src/slim_C_interface.cpp
+++ b/intern/slim/src/slim_c_interface.cpp
@@ -1,5 +1,5 @@
 //
-//  slim_C_interface.cpp
+//  slim_c_interface.cpp
 //  Blender
 //
 //  Created by Aurel Gruber on 30.11.16.
@@ -8,7 +8,7 @@
 
 #include 
 
-#include "slim_C_interface.h"
+#include "slim_c_interface.h"
 #include "slim_parametrizer.h"
 #include "slim.h"
 
diff --git a/intern/slim/src/slim_C_interface.h 
b/intern/slim/src/slim_c_interface.h
similarity index 87%
rename from intern/slim/src/slim_C_interfa

[Bf-blender-cvs] [f5b51e4c654] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: removing unnecessary ui parameters from minimize_stretch_operator

2017-03-14 Thread Aurel Gruber
Commit: f5b51e4c654ca5f3b0d99283b5815a70840e2cba
Author: Aurel Gruber
Date:   Thu Mar 9 21:54:34 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBf5b51e4c654ca5f3b0d99283b5815a70840e2cba

UV Unwrapping SLIM: removing unnecessary ui parameters from 
minimize_stretch_operator

===

M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 70e8a1fb00f..e94853a834e 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -583,7 +583,6 @@ static bool minimize_stretch_init(bContext *C, wmOperator 
*op)
scene->toolsettings->slim_skip_initialization = true;
scene->toolsettings->slim_pack_islands = false;
scene->toolsettings->slim_fixed_boundary = true;
-   scene->toolsettings->slim_weight_influence = RNA_float_get(op->ptr, 
"slim_weight_influence");
 
enrich_handle_slim(scene, obedit, em, handle, mss->mt);
param_slim_begin(handle);
@@ -782,9 +781,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "fill_holes_slim", 1, "Fill Holes", "Virtual 
fill holes in mesh before unwrapping, to better avoid overlaps and preserve 
symmetry");
RNA_def_float_factor(ot->srna, "blend_slim", 0.0f, 0.0f, 1.0f, "Blend", 
"Blend factor between stretch minimized and original", 0.0f, 1.0f);
-   RNA_def_int(ot->srna, "iterations_slim", 0, 0, INT_MAX, "Iterations", 
"Number of iterations to run, 0 is unlimited when run interactively", 0, 100);
-   RNA_def_float(ot->srna, "slim_weight_influence", 1.0, -1.0, 
1.0, "SLIM Weight Map Influence",
- "How much influence the weightmap has for 
weighted parameterization, 0 being no influence.", 0.0, 10.0);}
+}
 
 /*  Pack Islands operator  */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2a76f4ea7de] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: space added after if

2017-03-14 Thread Aurel Gruber
Commit: 2a76f4ea7dedd54db718463f481173e292cbd26d
Author: Aurel Gruber
Date:   Thu Mar 9 21:56:23 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB2a76f4ea7dedd54db718463f481173e292cbd26d

UV Unwrapping SLIM: space added after if

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index b4a891e9011..87a87797f21 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -5039,7 +5039,7 @@ void transfer_vertices(const int chartNr, const PHandle 
*phandle, SLIMMatrixTran
UV[v->slimId] = v->uv[0];
UV[r + v->slimId] = v->uv[1];
 
-   if (v->flag & PVERT_PIN || !(v->flag & PVERT_SELECT)){
+   if (v->flag & PVERT_PIN || !(v->flag & PVERT_SELECT)) {
mt->pinned_vertices = true;
mt->n_pinned_vertices[chartNr] += 1;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5c4eedc91f7] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: renaming intern/SLIM to intern/slim

2017-03-14 Thread Aurel Gruber
Commit: 5c4eedc91f75ce68d224aa21c6e26bf0b7874134
Author: Aurel Gruber
Date:   Thu Mar 9 13:32:35 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB5c4eedc91f75ce68d224aa21c6e26bf0b7874134

UV Unwrapping SLIM: renaming intern/SLIM to intern/slim

===

R100intern/SLIM/.gitignore  intern/slim/.gitignore
R100intern/SLIM/CMakeLists.txt  intern/slim/CMakeLists.txt
R100intern/SLIM/LICENSE intern/slim/LICENSE
R100intern/SLIM/ext/libigl_extract/EPS.cpp  
intern/slim/ext/libigl_extract/EPS.cpp
R100intern/SLIM/ext/libigl_extract/EPS.h
intern/slim/ext/libigl_extract/EPS.h
R100intern/SLIM/ext/libigl_extract/IndexComparison.h
intern/slim/ext/libigl_extract/IndexComparison.h
R100intern/SLIM/ext/libigl_extract/cat.cpp  
intern/slim/ext/libigl_extract/cat.cpp
R100intern/SLIM/ext/libigl_extract/cat.h
intern/slim/ext/libigl_extract/cat.h
R100intern/SLIM/ext/libigl_extract/colon.cpp
intern/slim/ext/libigl_extract/colon.cpp
R100intern/SLIM/ext/libigl_extract/colon.h  
intern/slim/ext/libigl_extract/colon.h
R100intern/SLIM/ext/libigl_extract/cotmatrix.cpp
intern/slim/ext/libigl_extract/cotmatrix.cpp
R100intern/SLIM/ext/libigl_extract/cotmatrix.h  
intern/slim/ext/libigl_extract/cotmatrix.h
R100intern/SLIM/ext/libigl_extract/cotmatrix_entries.cpp
intern/slim/ext/libigl_extract/cotmatrix_entries.cpp
R100intern/SLIM/ext/libigl_extract/cotmatrix_entries.h  
intern/slim/ext/libigl_extract/cotmatrix_entries.h
R100intern/SLIM/ext/libigl_extract/dihedral_angles.cpp  
intern/slim/ext/libigl_extract/dihedral_angles.cpp
R100intern/SLIM/ext/libigl_extract/dihedral_angles.h
intern/slim/ext/libigl_extract/dihedral_angles.h
R100intern/SLIM/ext/libigl_extract/doublearea.cpp   
intern/slim/ext/libigl_extract/doublearea.cpp
R100intern/SLIM/ext/libigl_extract/doublearea.h 
intern/slim/ext/libigl_extract/doublearea.h
R100intern/SLIM/ext/libigl_extract/edge_lengths.cpp 
intern/slim/ext/libigl_extract/edge_lengths.cpp
R100intern/SLIM/ext/libigl_extract/edge_lengths.h   
intern/slim/ext/libigl_extract/edge_lengths.h
R100intern/SLIM/ext/libigl_extract/face_areas.cpp   
intern/slim/ext/libigl_extract/face_areas.cpp
R100intern/SLIM/ext/libigl_extract/face_areas.h 
intern/slim/ext/libigl_extract/face_areas.h
R100intern/SLIM/ext/libigl_extract/find.cpp 
intern/slim/ext/libigl_extract/find.cpp
R100intern/SLIM/ext/libigl_extract/find.h   
intern/slim/ext/libigl_extract/find.h
R100intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.cpp
intern/slim/ext/libigl_extract/flip_avoiding_line_search.cpp
R100intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.h  
intern/slim/ext/libigl_extract/flip_avoiding_line_search.h
R100intern/SLIM/ext/libigl_extract/grad.cpp 
intern/slim/ext/libigl_extract/grad.cpp
R100intern/SLIM/ext/libigl_extract/grad.h   
intern/slim/ext/libigl_extract/grad.h
R100intern/SLIM/ext/libigl_extract/igl/Timer.h  
intern/slim/ext/libigl_extract/igl/Timer.h
R100intern/SLIM/ext/libigl_extract/igl/harmonic.cpp 
intern/slim/ext/libigl_extract/igl/harmonic.cpp
R100intern/SLIM/ext/libigl_extract/igl/harmonic.h   
intern/slim/ext/libigl_extract/igl/harmonic.h
R100intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.cpp   
intern/slim/ext/libigl_extract/igl/map_vertices_to_circle.cpp
R100intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.h 
intern/slim/ext/libigl_extract/igl/map_vertices_to_circle.h
R100intern/SLIM/ext/libigl_extract/igl_inline.h 
intern/slim/ext/libigl_extract/igl_inline.h
R100intern/SLIM/ext/libigl_extract/invert_diag.cpp  
intern/slim/ext/libigl_extract/invert_diag.cpp
R100intern/SLIM/ext/libigl_extract/invert_diag.h
intern/slim/ext/libigl_extract/invert_diag.h
R100intern/SLIM/ext/libigl_extract/is_symmetric.cpp 
intern/slim/ext/libigl_extract/is_symmetric.cpp
R100intern/SLIM/ext/libigl_extract/is_symmetric.h   
intern/slim/ext/libigl_extract/is_symmetric.h
R100intern/SLIM/ext/libigl_extract/isdiag.cpp   
intern/slim/ext/libigl_extract/isdiag.cpp
R100intern/SLIM/ext/libigl_extract/isdiag.h 
intern/slim/ext/libigl_extract/isdiag.h
R100intern/SLIM/ext/libigl_extract/line_search.cpp  
intern/slim/ext/libigl_extract/line_search.cpp
R100intern/SLIM/ext/libigl_extract/line_search.h
intern/slim/ext/libigl_extract/line_search.h
R100intern/SLIM/ext/libigl_extract/local_basis.cpp  
intern/slim/ext/libigl_extract/local_basis.cpp
R100intern/SLIM/ext/libigl_extract/local_basis.h
intern/slim/ext/libigl_extract/local_basis.h
R100intern/SLIM/ext/libigl_extract/massmatrix.cpp   
intern/slim/ext/libigl_extract/massmatrix.cpp
R100intern/SLIM/ext/libigl_extract/massmatrix.h 
intern/slim/ext/libigl_extract/massmatrix.h
R100intern/SLIM/ext

[Bf-blender-cvs] [99ed9041e0a] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: renaming another file

2017-03-14 Thread Aurel Gruber
Commit: 99ed9041e0a809ab1cfa846b14a1b7d5fa1f3678
Author: Aurel Gruber
Date:   Thu Mar 9 13:58:28 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB99ed9041e0a809ab1cfa846b14a1b7d5fa1f3678

UV Unwrapping SLIM: renaming another file

===

R100intern/slim/src/slim_c_interface.h  intern/slim/slim_c_interface.h

===

diff --git a/intern/slim/src/slim_c_interface.h b/intern/slim/slim_c_interface.h
similarity index 100%
rename from intern/slim/src/slim_c_interface.h
rename to intern/slim/slim_c_interface.h

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [31dd6110033] uv_unwrapping_slim_algorithm: UV Unwrapping SLIM: adding harmonic and mvc to uvinitializer

2017-03-14 Thread Aurel Gruber
Commit: 31dd6110033e3f3708efffa1bfb2de53736c1541
Author: Aurel Gruber
Date:   Sun Mar 5 22:43:03 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB31dd6110033e3f3708efffa1bfb2de53736c1541

UV Unwrapping SLIM: adding harmonic and mvc to uvinitializer

===

M   intern/SLIM/src/UVInitializer.cpp
M   intern/SLIM/src/UVInitializer.h
M   intern/SLIM/src/slim_parametrizer.cpp

===

diff --git a/intern/SLIM/src/UVInitializer.cpp 
b/intern/SLIM/src/UVInitializer.cpp
index f77fd16ca63..339dcc6c3d5 100644
--- a/intern/SLIM/src/UVInitializer.cpp
+++ b/intern/SLIM/src/UVInitializer.cpp
@@ -7,134 +7,206 @@
 //
 
 #include "UVInitializer.h"
+#include
 
-#include 
 #include "igl/Timer.h"
 #include "igl/harmonic.h"
+#include "cotmatrix.h"
+#include 
 
+using namespace std;
+
+double computeAngle(const Eigen::Vector3d ,const Eigen::Vector3d ){
+   cout << "points for angle " << a << "   and" << b << endl;
+   double angle = acos(a.dot(b) / (a.norm() * b.norm()));
+   return angle;
+}
+
+void findVertexToOppositeAnglesCorrespondence(const Eigen::MatrixXi ,const 
Eigen::MatrixXd , Eigen::SparseMatrix ){
+
+   typedef Eigen::Triplet T;
+   std::vector coefficients;
+
+   for (int i = 0; i < F.rows(); i++){
+
+   int vertexIndex1 = F(i,0); // retrieve vertex index that is 
part of face
+   int vertexIndex2 = F(i,1); // retrieve vertex index that is 
part of face
+   int vertexIndex3 = F(i,2); // retrieve vertex index that is 
part of face
+
+   double angle1 = computeAngle(V.row(vertexIndex2) - 
V.row(vertexIndex1), V.row(vertexIndex3) - V.row(vertexIndex1));
+   double angle2 = computeAngle(V.row(vertexIndex3) - 
V.row(vertexIndex2), V.row(vertexIndex1) - V.row(vertexIndex2));
+   double angle3 = computeAngle(V.row(vertexIndex1) - 
V.row(vertexIndex3), V.row(vertexIndex2) - V.row(vertexIndex3));
+
+   cout << "vertex " << V.row(vertexIndex1) << " has angle " << 
angle1 << "for neighbors " << V.row(vertexIndex2) << " and" << 
V.row(vertexIndex3) << endl << endl;
+   cout << "vertex " << V.row(vertexIndex2) << " has angle " << 
angle2 << "for neighbors " << V.row(vertexIndex3) << " and" << 
V.row(vertexIndex1) << endl << endl;
+   cout << "vertex " << V.row(vertexIndex3) << " has angle " << 
angle3 << "for neighbors " << V.row(vertexIndex1) << " and" << 
V.row(vertexIndex2) << endl << endl;
+
+   coefficients.push_back(T(vertexIndex1, 2*vertexIndex2, angle3));
+   coefficients.push_back(T(vertexIndex1, 2*vertexIndex3 + 1, 
angle2));
+
+   coefficients.push_back(T(vertexIndex2, 2*vertexIndex1 + 1, 
angle3));
+   coefficients.push_back(T(vertexIndex2, 2*vertexIndex3, angle1));
+
+   coefficients.push_back(T(vertexIndex3, 2*vertexIndex1, angle2));
+   coefficients.push_back(T(vertexIndex3, 2*vertexIndex2 + 1, 
angle1));
+
+   }
+
+   vertexToFaceIndices.setFromTriplets(coefficients.begin(), 
coefficients.end());
+}
+
+void findVertexToItsAnglesCorrespondence(const Eigen::MatrixXi ,const 
Eigen::MatrixXd , Eigen::SparseMatrix ){
+
+   typedef Eigen::Triplet T;
+   std::vector coefficients;
+
+   for (int i = 0; i < F.rows(); i++){
+
+   int vertexIndex1 = F(i,0); // retrieve vertex index that is 
part of face
+   int vertexIndex2 = F(i,1); // retrieve vertex index that is 
part of face
+   int vertexIndex3 = F(i,2); // retrieve vertex index that is 
part of face
+
+   double angle1 = computeAngle(V.row(vertexIndex2) - 
V.row(vertexIndex1), V.row(vertexIndex3) - V.row(vertexIndex1));
+   double angle2 = computeAngle(V.row(vertexIndex3) - 
V.row(vertexIndex2), V.row(vertexIndex1) - V.row(vertexIndex2));
+   double angle3 = computeAngle(V.row(vertexIndex1) - 
V.row(vertexIndex3), V.row(vertexIndex2) - V.row(vertexIndex3));
+
+   coefficients.push_back(T(vertexIndex1, 2*vertexIndex2, angle1));
+   coefficients.push_back(T(vertexIndex1, 2*vertexIndex3 + 1, 
angle1));
+
+   coefficients.push_back(T(vertexIndex2, 2*vertexIndex1 + 1, 
angle2));
+   coefficients.push_back(T(vertexIndex2, 2*vertexIndex3, angle2));
+
+   coefficients.push_back(T(vertexIndex3, 2*vertexIndex1, angle3));
+   coefficients.push_back(T(vertex

[Bf-blender-cvs] [95863bbb98] uv_unwrapping_slim_algorithm: Merge branch 'uv_unwrapping_slim_algorithm' of git.blender.org:blender into uv_unwrapping_slim_algorithm

2017-02-27 Thread Aurel Gruber
Commit: 95863bbb9879224480783371eac5cc6db67de295
Author: Aurel Gruber
Date:   Mon Feb 27 14:15:46 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB95863bbb9879224480783371eac5cc6db67de295

Merge branch 'uv_unwrapping_slim_algorithm' of git.blender.org:blender into 
uv_unwrapping_slim_algorithm

===



===



___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2f86198cee] uv_unwrapping_slim_algorithm: Implementation of UV unwrapping with SLIM as disdussed on T48036.

2017-02-27 Thread Aurel Gruber
Commit: 2f86198cee8acc74379569ba91e371156ed0e0b9
Author: Aurel Gruber
Date:   Fri Feb 24 09:31:38 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB2f86198cee8acc74379569ba91e371156ed0e0b9

Implementation of UV unwrapping with SLIM as disdussed on T48036.

commits:

Category: UV Unwrapping SLIM Algorithm Integration

Added SLIM Subfolder

Category: UV Unwrapping SLIM Algorithm Integration

added subfolder SLIM to CMakeFile of /intern

Category: UV Unwrapping SLIM Algorithm Integration

integrating SLIM including data gathering and transfer from Blender to SLIM

This commit is huge, because I copied over the code from a different 
repository. Not commit-by-commit.

The Algorithm can be invoked either by choosing SLIM from the dropdown in the 
unwrapping settings or by
hitting ctrl. + m in the uv editor for relaxation. Tried adding it to the menu 
the same way as minimizing stretch is there but failed.

Category: UV Unwrapping SLIM Algorithm Integration

preserving vertex ids and gathering weights

Category: UV Unwrapping SLIM Algorithm Integration

adding more members to phandle and creating param_begin

Category: UV Unwrapping SLIM Algorithm Integration

fixing bug that causes weight-per-vertex mapping to be wrong

Category: UV Unwrapping SLIM Algorithm Integration

adjustments to the UI parameters

Category: UV Unwrapping SLIM Algorithm Integration

adding weightinfluence

Category: UV Unwrapping SLIM Algorithm Integration

slim interactive exec now only for changing parameters

Category: UV Unwrapping SLIM Algorithm Integration

taking care of memory leaks

Category: UV Unwrapping SLIM Algorithm Integration

adding relative scale, reflection mode and Vertex group input

Category: UV Unwrapping SLIM Algorithm Integration

correcting wrong comment on SLIM phases

Category: UV Unwrapping SLIM Algorithm Integration

Adding SLIM code by means of git read-tree

Category: UV Unwrapping SLIM Algorithm Integration

freeing matrix_transfer properly

Category: UV Unwrapping SLIM Algorithm Integration

adding (unsupported-) eigen files

Reviewers: brecht, sergey

Differential Revision: https://developer.blender.org/D2530

===

A   extern/Eigen3/unsupported/Eigen/AdolcForward
A   extern/Eigen3/unsupported/Eigen/AlignedVector3
A   extern/Eigen3/unsupported/Eigen/ArpackSupport
A   extern/Eigen3/unsupported/Eigen/AutoDiff
A   extern/Eigen3/unsupported/Eigen/BVH
A   extern/Eigen3/unsupported/Eigen/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/FFT
A   extern/Eigen3/unsupported/Eigen/IterativeSolvers
A   extern/Eigen3/unsupported/Eigen/KroneckerProduct
A   extern/Eigen3/unsupported/Eigen/LevenbergMarquardt
A   extern/Eigen3/unsupported/Eigen/MPRealSupport
A   extern/Eigen3/unsupported/Eigen/MatrixFunctions
A   extern/Eigen3/unsupported/Eigen/MoreVectorization
A   extern/Eigen3/unsupported/Eigen/NonLinearOptimization
A   extern/Eigen3/unsupported/Eigen/NumericalDiff
A   extern/Eigen3/unsupported/Eigen/OpenGLSupport
A   extern/Eigen3/unsupported/Eigen/Polynomials
A   extern/Eigen3/unsupported/Eigen/SVD
A   extern/Eigen3/unsupported/Eigen/Skyline
A   extern/Eigen3/unsupported/Eigen/SparseExtra
A   extern/Eigen3/unsupported/Eigen/Splines
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/BVH/BVAlgorithms.h
A   extern/Eigen3/unsupported/Eigen/src/BVH/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/BVH/KdBVH.h
A   extern/Eigen3/unsupported/Eigen/src/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
A   extern/Eigen3/unsupported/Eigen/src/Eigenvalues/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/FFT/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/FFT/ei_fftw_impl.h
A   extern/Eigen3/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IterationController.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/MINRES.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/Scaling.h
A   extern/Eigen3/unsupported/Eigen/src/KroneckerProduct/CMakeLists.txt

[Bf-blender-cvs] [d166cdfa25] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: d166cdfa2556c8323a642d0bbf3570b37edf71a6
Author: Aurel Gruber
Date:   Thu Feb 23 16:26:08 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rBd166cdfa2556c8323a642d0bbf3570b37edf71a6

Category: UV Unwrapping SLIM Algorithm Integration

Adding SLIM code by means of git read-tree

===

D   intern/SLIM
A   intern/SLIM/.gitignore
A   intern/SLIM/CMakeLists.txt
A   intern/SLIM/LICENSE
A   intern/SLIM/ext/libigl_extract/EPS.cpp
A   intern/SLIM/ext/libigl_extract/EPS.h
A   intern/SLIM/ext/libigl_extract/IndexComparison.h
A   intern/SLIM/ext/libigl_extract/cat.cpp
A   intern/SLIM/ext/libigl_extract/cat.h
A   intern/SLIM/ext/libigl_extract/colon.cpp
A   intern/SLIM/ext/libigl_extract/colon.h
A   intern/SLIM/ext/libigl_extract/cotmatrix.cpp
A   intern/SLIM/ext/libigl_extract/cotmatrix.h
A   intern/SLIM/ext/libigl_extract/cotmatrix_entries.cpp
A   intern/SLIM/ext/libigl_extract/cotmatrix_entries.h
A   intern/SLIM/ext/libigl_extract/dihedral_angles.cpp
A   intern/SLIM/ext/libigl_extract/dihedral_angles.h
A   intern/SLIM/ext/libigl_extract/doublearea.cpp
A   intern/SLIM/ext/libigl_extract/doublearea.h
A   intern/SLIM/ext/libigl_extract/edge_lengths.cpp
A   intern/SLIM/ext/libigl_extract/edge_lengths.h
A   intern/SLIM/ext/libigl_extract/face_areas.cpp
A   intern/SLIM/ext/libigl_extract/face_areas.h
A   intern/SLIM/ext/libigl_extract/find.cpp
A   intern/SLIM/ext/libigl_extract/find.h
A   intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.cpp
A   intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.h
A   intern/SLIM/ext/libigl_extract/grad.cpp
A   intern/SLIM/ext/libigl_extract/grad.h
A   intern/SLIM/ext/libigl_extract/igl/Timer.h
A   intern/SLIM/ext/libigl_extract/igl/harmonic.cpp
A   intern/SLIM/ext/libigl_extract/igl/harmonic.h
A   intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.cpp
A   intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.h
A   intern/SLIM/ext/libigl_extract/igl_inline.h
A   intern/SLIM/ext/libigl_extract/invert_diag.cpp
A   intern/SLIM/ext/libigl_extract/invert_diag.h
A   intern/SLIM/ext/libigl_extract/is_symmetric.cpp
A   intern/SLIM/ext/libigl_extract/is_symmetric.h
A   intern/SLIM/ext/libigl_extract/isdiag.cpp
A   intern/SLIM/ext/libigl_extract/isdiag.h
A   intern/SLIM/ext/libigl_extract/line_search.cpp
A   intern/SLIM/ext/libigl_extract/line_search.h
A   intern/SLIM/ext/libigl_extract/local_basis.cpp
A   intern/SLIM/ext/libigl_extract/local_basis.h
A   intern/SLIM/ext/libigl_extract/massmatrix.cpp
A   intern/SLIM/ext/libigl_extract/massmatrix.h
A   intern/SLIM/ext/libigl_extract/min_quad_with_fixed.cpp
A   intern/SLIM/ext/libigl_extract/min_quad_with_fixed.h
A   intern/SLIM/ext/libigl_extract/normalize_row_sums.cpp
A   intern/SLIM/ext/libigl_extract/normalize_row_sums.h
A   intern/SLIM/ext/libigl_extract/parallel_for.cpp
A   intern/SLIM/ext/libigl_extract/parallel_for.h
A   intern/SLIM/ext/libigl_extract/per_face_normals.cpp
A   intern/SLIM/ext/libigl_extract/per_face_normals.h
A   intern/SLIM/ext/libigl_extract/polar_svd.cpp
A   intern/SLIM/ext/libigl_extract/polar_svd.h
A   intern/SLIM/ext/libigl_extract/reorder.cpp
A   intern/SLIM/ext/libigl_extract/reorder.h
A   intern/SLIM/ext/libigl_extract/repmat.cpp
A   intern/SLIM/ext/libigl_extract/repmat.h
A   intern/SLIM/ext/libigl_extract/slice.cpp
A   intern/SLIM/ext/libigl_extract/slice.h
A   intern/SLIM/ext/libigl_extract/sort.cpp
A   intern/SLIM/ext/libigl_extract/sort.h
A   intern/SLIM/ext/libigl_extract/sparse.cpp
A   intern/SLIM/ext/libigl_extract/sparse.h
A   intern/SLIM/ext/libigl_extract/squared_edge_lengths.cpp
A   intern/SLIM/ext/libigl_extract/squared_edge_lengths.h
A   intern/SLIM/ext/libigl_extract/verbose.h
A   intern/SLIM/ext/libigl_extract/volume.cpp
A   intern/SLIM/ext/libigl_extract/volume.h
A   intern/SLIM/src/Slim.cpp
A   intern/SLIM/src/Slim.h
A   intern/SLIM/src/UVInitializer.cpp
A   intern/SLIM/src/UVInitializer.h
A   intern/SLIM/src/area_compensation.cpp
A   intern/SLIM/src/area_compensation.h
A   intern/SLIM/src/geometry_data_retrieval.cpp
A   intern/SLIM/src/geometry_data_retrieval.h
A   intern/SLIM/src/least_squares_relocator.cpp
A   intern/SLIM/src/least_squares_relocator.h
A   intern/SLIM/src/matrix_transfer.h
A   intern/SLIM/src/slim_C_interface.cpp
A   intern/SLIM/src/slim_C_interface.h
A   intern/SLIM/src/slim_parametrizer.cpp
A   intern/SLIM/src/slim_parametrizer.h
M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/tools

[Bf-blender-cvs] [25a455fd21] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping symmetric dirichlet energy with ceres Integration

2017-02-27 Thread Aurel Gruber
Commit: 25a455fd2142155b5c5a10c9485690a206dbfe19
Author: Aurel Gruber
Date:   Fri Feb 24 23:26:11 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB25a455fd2142155b5c5a10c9485690a206dbfe19

Category: UV Unwrapping symmetric dirichlet energy with ceres Integration

added ceres_mesh_unwrapper files

===

M   intern/SLIM/CMakeLists.txt
M   intern/SLIM/src/slim_parametrizer.cpp

===

diff --git a/intern/SLIM/CMakeLists.txt b/intern/SLIM/CMakeLists.txt
index d8cdc0fcfb..91c8ff5e52 100644
--- a/intern/SLIM/CMakeLists.txt
+++ b/intern/SLIM/CMakeLists.txt
@@ -1,10 +1,16 @@
 cmake_minimum_required(VERSION 2.6)
 
+set(ADDITIONAL_LIBRARIES "extern_ceres")
+
 set(INC
   ext/libigl_extract
   ../../source/blender/editors/uvedit
   ../../source/blender/makesdna
   ../../source/blender/blenlib
+  ../../extern/ceres/include
+  ../../extern/ceres/config
+  ../../extern/glog/src
+  ../../extern/gflags/src
 )
 
 set(INC_SYS
@@ -19,6 +25,7 @@ set(SRC
   src/area_compensation.cpp
   src/least_squares_relocator.cpp
   src/geometry_data_retrieval.cpp
+  src/ceres_mesh_unwrapper.cpp
 
   src/matrix_transfer.h
   src/slim.h
@@ -28,6 +35,7 @@ set(SRC
   src/area_compensation.h
   src/least_squares_relocator.h
   src/geometry_data_retrieval.h
+  src/ceres_mesh_unwrapper.h
 
   ${ADDITIONAL_SOURCES}
 )
diff --git a/intern/SLIM/src/slim_parametrizer.cpp 
b/intern/SLIM/src/slim_parametrizer.cpp
index a554cc731a..3178acb4da 100644
--- a/intern/SLIM/src/slim_parametrizer.cpp
+++ b/intern/SLIM/src/slim_parametrizer.cpp
@@ -21,6 +21,7 @@
 #include 
 
 #include "slim_parametrizer.h"
+#include "ceres_mesh_unwrapper.h"
 
 using namespace std;
 using namespace igl;
@@ -61,9 +62,16 @@ void param_slim(matrix_transfer *mt, int nIterations, bool 
borderVerticesArePinn
 
for (int uvChartIndex = 0; uvChartIndex < mt->nCharts; uvChartIndex++) {
 
+   cout << "doing " << nIterations % 100 << " SLIM iterations" << 
endl;
SLIMData *slimData = setup_slim(mt, nIterations, uvChartIndex, 
timer, borderVerticesArePinned, skipInitialization);
 
-   slim_solve(*slimData, nIterations);
+
+   slim_solve(*slimData, nIterations % 100);
+
+   if (nIterations > 99){
+   cout << "using ceres with " << (nIterations / 100) * 10 
<< " iterations..." << endl;
+   solve_map_with_ceres(slimData->V, slimData->F, 
slimData->V_o, (nIterations / 100) * 10);
+   }
 
areacomp::correctMapSurfaceAreaIfNecessary(slimData);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [90d9819de9] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 90d9819de9c4e6c3a0db6818d5bab70dc122f3f7
Author: Aurel Gruber
Date:   Thu Feb 23 13:22:30 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB90d9819de9c4e6c3a0db6818d5bab70dc122f3f7

Category: UV Unwrapping SLIM Algorithm Integration

correcting wrong comment on SLIM phases

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.h

===

diff --git a/intern/SLIM b/intern/SLIM
index cffc347ba2..8bdd2ea2de 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit cffc347ba26c31b04f9080916b99b1e603d4ee5c
+Subproject commit 8bdd2ea2ded2dffa5b02ba51cd00e46af19af87d
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 8dcaf952ed..abfc4a0162 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -112,16 +112,12 @@ void param_begin(ParamHandle *handle, ParamBool abf, bool 
useSlim);
 void param_solve(ParamHandle *handle, bool useSlim);
 void param_end(ParamHandle *handle, bool useSlim);
 
-/* Least Squares Conformal Maps:
+/* SLIM:
  * -
- * - charts with less than two pinned vertices are assigned 2 pins
- * - lscm is divided in three steps:
- * - begin: compute matrix and it's factorization (expensive)
- * - solve using pinned coordinates (cheap)
+ * - begin: Data is gathered into matrices and transferred to SLIM
+ * - solve: compute cheap initialization (if necessary) and refine iteratively
  * - end: clean up
- * - uv coordinates are allowed to change within begin/end, for
- *   quick re-solving
- */
+*/
 
 void param_slim_begin(ParamHandle *handle);
 void param_slim_solve(ParamHandle *handle);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [eafa04ecfa] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: eafa04ecfa6e06c37661dd75ee5261805dd70dd7
Author: Aurel Gruber
Date:   Fri Feb 24 09:28:33 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rBeafa04ecfa6e06c37661dd75ee5261805dd70dd7

Category: UV Unwrapping SLIM Algorithm Integration

freeing matrix_transfer properly

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 6ff5176491..e8af44e32b 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4430,6 +4430,7 @@ void param_slim_end(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
set_uv_param_slim(handle, mt);
+   free_matrix_transfer(mt);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ccd7f57f5a] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping symmetric dirichlet energy with ceres Integration

2017-02-27 Thread Aurel Gruber
Commit: ccd7f57f5a8020775de71079b11ea8a4702e7559
Author: Aurel Gruber
Date:   Mon Feb 27 11:11:35 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rBccd7f57f5a8020775de71079b11ea8a4702e7559

Category: UV Unwrapping symmetric dirichlet energy with ceres Integration

adding mesh_unwrapper_ceres

===

A   intern/SLIM/src/ceres_mesh_unwrapper.cpp
A   intern/SLIM/src/ceres_mesh_unwrapper.h
M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/tools

===

diff --git a/intern/SLIM/src/ceres_mesh_unwrapper.cpp 
b/intern/SLIM/src/ceres_mesh_unwrapper.cpp
new file mode 100644
index 00..b0ef67628b
--- /dev/null
+++ b/intern/SLIM/src/ceres_mesh_unwrapper.cpp
@@ -0,0 +1,302 @@
+//
+//  ceres_mesh_unwrapper.cpp
+//  Blender
+//
+//  Created by Aurel Gruber on 24.02.17.
+//
+//
+
+#include "ceres_mesh_unwrapper.h"
+#include "ceres/ceres.h"
+#include 
+#include/* cos */
+
+
+using namespace std;
+
+template 
+T cross_2D(const Eigen::Matrix<T, 1, 2> , const Eigen::Matrix<T, 1, 2> ){
+   return -T(a(0) * b(1) - a(1) * b(0));
+}
+
+/**
+ *find SVD according to 
http://scicomp.stackexchange.com/questions/8899/robust-algorithm-for-2x2-svd
+ * -> Alex Eftimiades' answer
+ */
+template 
+void computeSingularValues(T j11, T j12, T j21, T j22, T& s1, T& s2) {
+
+   T y1 = j12 + j21;
+   T x1 = j11 - j22;
+   T y2 = j12 - j21;
+   T x2 = j11 + j22;
+
+   T h1 = T(sqrt(y1*y1 + x1*x1));
+   T h2 = T(sqrt(y2*y2 + x2*x2));
+
+   s1 = (h1 + h2) / T(2.0);
+   s2 = (h1 - h2) / T(2.0);
+
+   //cout << "s1: " << s1 << endl;
+   //cout << "s2: " << s2 << endl;
+
+}
+
+template 
+void findJacobian(const double* orig_v2D_A, const double* orig_v2D_B, const 
double* orig_v2D_C,
+ T* new_v2D_A, T* new_v2D_B, T* new_v2D_C,
+ T& j11, T& j12, T& j21, T& j22) {
+   /*
+
+To find J we can use the points B and C:
+
+J = j11j12
+j21j22
+
+|j11  j12|   |b1|   |b'1|
+JB = B' ->  || * |  | = |   |
+|j21  j22|   |b2|   |b'2|
+
+-->
+
+|j11  j12|   |c1|   |c'1|
+JC = C' ->  || * |  | = |   |
+|j21  j22|   |c2|   |c'2|
+
+
+We know, that c2 is zero, due to the nature of the embedding of the 
original triangle in 2d
+
+j11 * b1 + j12 * b2 = b'1
+j21 * b1 + j22 * b2 = b'2
+j11 * c1 = c'1
+j21 * c1 = c'2
+
+Thereofore:
+
+j11 = c'1 / c1
+j21 = c'2 / c1
+
+j12 = ( b'1 - j11*b1 ) / b2
+j22 = ( b'2 - j21*b1 ) / b2
+
+*/
+
+   j11 = new_v2D_C[0] / T(orig_v2D_C[0]);
+   j21 = new_v2D_C[1] / T(orig_v2D_C[0]);
+
+   j12 = ( new_v2D_B[0] - j11 * T(orig_v2D_B[0]) ) / T(orig_v2D_B[1]);
+   j22 = ( new_v2D_B[1] - j21 * T(orig_v2D_B[0]) ) / T(orig_v2D_B[1]);
+}
+
+void map_3D_triangles_to_2D_undistorded(
+   
const Eigen::Vector3d ,
+   
const Eigen::Vector3d ,
+   
const Eigen::Vector3d ,
+   
Eigen::Vector2d ,
+   
Eigen::Vector2d ,
+   
Eigen::Vector2d 
+   
) {
+   /*
+b
+A __ B
+  \/
+ a \  / c
+\/
+C
+
+We place A on 0,0
+A = 0,0
+
+We place C on the x axis
+C = ||C-A||, 0
+
+We compute B via angle
+
+b = B - A
+a = C - A
+
+phi =  arccos(a*b)/|a|*|b|
+
+B = cos(phi)*b, sin(phi)*b
+*/
+
+   Eigen::Vector3d xUnitVector = Eigen::Vector3d::UnitX();
+   Eigen::Vector3d yUnitVector = Eigen::Vector3d::UnitY();
+
+   //translate to origin
+   Eigen::Vector3d v3DAembedded;
+   v3DAembedded<< 0,0,0;
+
+   Eigen::Vector3d v3DBembedded = v3DB - v3DA;
+   Eigen::Vector3d v3DCembedded = v3DC - v3DA;
+
+   // rotate triangle, s.t. C is on x axis
+   double angleC_X = std::acos( (v3DCembedded.dot(xUnitVector)) / 
v3DCembedded.norm() );
+   Eigen::Vector3d axis = v3DCembedded.cross(xUnitVector);
+
+   if (axis.norm() > 0) {
+   axi

[Bf-blender-cvs] [518ab567e1] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 518ab567e175032ab32c27d3287dfb62577e4f8b
Author: Aurel Gruber
Date:   Tue Jan 31 13:58:43 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB518ab567e175032ab32c27d3287dfb62577e4f8b

Category: UV Unwrapping SLIM Algorithm Integration

adding weightinfluence

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index ea8bf4df4a..1459f9d45c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -252,6 +252,7 @@ typedef struct PHandle {
bool with_weighted_parameterization;
MDeformVert *weightMapData;
int weightMapIndex;
+   double weightInfluence;
BMesh *bm;
 
 } PHandle;
@@ -4370,6 +4371,7 @@ void param_slim_enrich_handle(Object *obedit,
  matrix_transfer *mt,
  MDeformVert *dvert,
  int weightMapIndex,
+ double 
weightInfluence,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
@@ -4384,6 +4386,7 @@ void param_slim_enrich_handle(Object *obedit,
phandle->with_weighted_parameterization = 
with_weighted_parameterization;
phandle->weightMapData = dvert;
phandle->weightMapIndex = weightMapIndex;
+   phandle->weightInfluence = weightInfluence;
phandle->bm = em->bm;
 }
 
@@ -4830,6 +4833,7 @@ void transfer_data_to_slim(ParamHandle *handle){
mt->pinned_vertices = false;
mt->transform_islands = true;
mt->with_weighted_parameterization = 
phandle->with_weighted_parameterization;
+   mt->weight_influence = phandle->weightInfluence;
convert_blender_slim(handle, false, phandle->weightMapIndex);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index bb5b9e16f4..ed5b10a594 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -97,6 +97,7 @@ void param_slim_enrich_handle(Object *obedit,
  matrix_transfer *mt,
  MDeformVert *dvert,
  int weightMapIndex,
+ double 
weightInfluence,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index a19336643e..247c43c4c5 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -530,6 +530,7 @@ void enrich_handle_slim(Scene *scene, Object *obedit, 
BMEditMesh *em, ParamHandl
int n_iterations = scene->toolsettings->slim_n_iterations;
bool skip_initialization = 
scene->toolsettings->slim_skip_initialization;
bool pack_islands = scene->toolsettings->slim_pack_islands;
+   double weight_influence = scene->toolsettings->slim_weight_influence;
 
MDeformVert *weightMapData = NULL;
 
@@ -545,6 +546,7 @@ void enrich_handle_slim(Scene *scene, Object *obedit, 
BMEditMesh *em, ParamHandl
 mt,
 weightMapData,
 weightMapIndex,
+weight_influence,
 n_iterations,
 skip_initialization,
 pack_islands,
@@ -813,7 +815,7 @@ static bool minimize_stretch_SLIM_init(bContext *C, 
wmOperator *op)
scene->toolsettings->slim_skip_initialization = true;
scene->toolsettings->slim_pack_islands = false;
scene->toolsettings->slim_fixed_boundary = true;
- 

[Bf-blender-cvs] [97222dbac0] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 97222dbac0f18b70a776e92405975ed9ca9857e8
Author: Aurel Gruber
Date:   Sat Feb 4 14:42:19 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB97222dbac0f18b70a776e92405975ed9ca9857e8

Category: UV Unwrapping SLIM Algorithm Integration

slim interactive exec now only for changing parameters

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 94ed5ce815..8c6ee9dbdc 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 94ed5ce815517fc0c1215411ef2404686d80e1a0
+Subproject commit 8c6ee9dbdc60a9e2c3543eec38e71f9ca4fcd971
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 247c43c4c5..5920ecfecd 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -903,21 +903,10 @@ static void minimize_stretch_SLIM_exit(bContext *C, 
wmOperator *op, bool cancel)
 }
 
 /* AUREL THESIS
-   NON-interactive version of interactive parametrisation. Every modal 
operator of blender has this mode.
-   In this case, it's obviously never used, since the "normal" 
non-interactive unwrapping method is to be preferred.
+   Used Only to adjust parameters.
  */
 static int minimize_stretch_SLIM_exec(bContext *C, wmOperator *op)
 {
-   int n_iterations = 1;
-
-   if (!minimize_stretch_SLIM_init(C, op))
-   return OPERATOR_CANCELLED;
-
-   MinStretchSlim *mss = op->customdata;
-
-   param_slim_C(mss->mt, n_iterations, true, true);
-
-   minimize_stretch_SLIM_exit(C, op, false);
 
return OPERATOR_FINISHED;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4aac14f0d2] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 4aac14f0d2d83e4bf38f6a92335de6c3e73559f9
Author: Aurel Gruber
Date:   Fri Nov 18 12:54:50 2016 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB4aac14f0d2d83e4bf38f6a92335de6c3e73559f9

Category: UV Unwrapping SLIM Algorithm Integration

integrating SLIM including data gathering and transfer from Blender to SLIM

This commit is huge, because I copied over the code from a different 
repository. Not commit-by-commit.

The Algorithm can be invoked either by choosing SLIM from the dropdown in the 
unwrapping settings or by
hitting ctrl. + m in the uv editor for relaxation. Tried adding it to the menu 
the same way as minimizing stretch is there but failed.

===

M   intern/SLIM
M   source/blender/bmesh/bmesh_class.h
M   source/blender/editors/uvedit/CMakeLists.txt
M   source/blender/editors/uvedit/uvedit_intern.h
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/intern/SLIM b/intern/SLIM
index fa4b84c7dd..e897ae04d5 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit fa4b84c7dd2aac4502887999f6b4ee9c524adedf
+Subproject commit e897ae04d52607970344a601fc85c1329f2314ed
diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index 104df625ee..49077b19be 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -99,6 +99,8 @@ typedef struct BMVert {
 *   which is a bit of an abuse of internal bmesh data but also 
works OK for now (use with care!).
 */
struct BMEdge *e;
+   /* AUREL */
+   int id;
 } BMVert;
 
 typedef struct BMVert_OFlag {
diff --git a/source/blender/editors/uvedit/CMakeLists.txt 
b/source/blender/editors/uvedit/CMakeLists.txt
index 543ef0e066..a7e2da0508 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -31,6 +31,8 @@ set(INC
../../../../intern/guardedalloc
../../../../intern/eigen
../../../../intern/glew-mx
+
+   ../../../../intern/SLIM/src
 )
 
 set(INC_SYS
@@ -56,3 +58,4 @@ endif()
 add_definitions(${GL_DEFINITIONS})
 
 blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}")
+target_link_libraries(bf_editor_uvedit bf_intern_slim)
diff --git a/source/blender/editors/uvedit/uvedit_intern.h 
b/source/blender/editors/uvedit/uvedit_intern.h
index e028c08091..e8dbb337cf 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -75,6 +75,8 @@ void UV_OT_cube_project(struct wmOperatorType *ot);
 void UV_OT_cylinder_project(struct wmOperatorType *ot);
 void UV_OT_project_from_view(struct wmOperatorType *ot);
 void UV_OT_minimize_stretch(struct wmOperatorType *ot);
+// AUREL SLIM interactive parameterization
+void UV_OT_minimize_stretch_slim(struct wmOperatorType *ot);
 void UV_OT_pack_islands(struct wmOperatorType *ot);
 void UV_OT_reset(struct wmOperatorType *ot);
 void UV_OT_sphere_project(struct wmOperatorType *ot);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c 
b/source/blender/editors/uvedit/uvedit_ops.c
index 193b006cf0..6cdce37ab0 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -4265,6 +4265,8 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_cylinder_project);
WM_operatortype_append(UV_OT_project_from_view);
WM_operatortype_append(UV_OT_minimize_stretch);
+   // AUREL SLIM Interactive Parameterization
+   WM_operatortype_append(UV_OT_minimize_stretch_slim);
WM_operatortype_append(UV_OT_pack_islands);
WM_operatortype_append(UV_OT_reset);
WM_operatortype_append(UV_OT_sphere_project);
@@ -4341,6 +4343,8 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* unwrap */
WM_keymap_add_item(keymap, "UV_OT_unwrap", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UV_OT_minimize_stretch", VKEY, KM_PRESS, 
KM_CTRL, 0);
+   // AUREL SLIM Interactive Parameterization
+   WM_keymap_add_item(keymap, "UV_OT_minimize_stretch_slim", MKEY, 
KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_pack_islands", PKEY, KM_PRESS, 
KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_average_islands_scale", AKEY, 
KM_PRESS, KM_CTRL, 0);
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index bdfff123aa..759af69fd3 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b

[Bf-blender-cvs] [9cedd1d68b] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 9cedd1d68bfced2f630c7c3018589130f254ed5f
Author: Aurel Gruber
Date:   Fri Feb 10 17:13:03 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB9cedd1d68bfced2f630c7c3018589130f254ed5f

Category: UV Unwrapping SLIM Algorithm Integration

taking care of memory leaks

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 8c6ee9dbdc..8686b499ce 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 8c6ee9dbdc60a9e2c3543eec38e71f9ca4fcd971
+Subproject commit 8686b499ce3f23d537e1e56ab91412bc0b2aefb3
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 1459f9d45c..472e293d8a 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4428,6 +4428,7 @@ void param_slim_end(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
set_uv_param_slim(handle, mt);
+   free_matrix_transfer(mt);
 }
 
 
@@ -4874,6 +4875,8 @@ void convert_blender_slim(ParamHandle *handle, bool 
selectionOnly, int weightMap
mt->Pmatrices[chartNr] = 
MEM_reallocN_id(mt->Pmatrices[chartNr], mt->nPinnedVertices[chartNr] * 
sizeof(**mt->Pmatrices), " Pinned-Vertex Matrix");
mt->Bvectors[chartNr] = MEM_reallocN_id(mt->Bvectors[chartNr], 
mt->nBoundaryVertices[chartNr] * sizeof(**mt->Bvectors), " boundary-Vertex 
Matrix");
mt->Ematrices[chartNr] = 
MEM_reallocN_id(mt->Ematrices[chartNr], (mt->nEdges[chartNr] + 
mt->nBoundaryVertices[chartNr]) * 2 * sizeof(**mt->Ematrices), " 
boundarys-Vertex Matrix");
+
+   MEM_freeN(tempW);
}
 
if (mt->nPinnedVertices > 0){
@@ -5164,17 +5167,31 @@ void free_matrix_transfer(matrix_transfer *mt){
MEM_freeN(mt->Vmatrices[chartNr]);
MEM_freeN(mt->UVmatrices[chartNr]);
MEM_freeN(mt->Fmatrices[chartNr]);
-
+   MEM_freeN(mt->PPmatrices[chartNr]);
+   MEM_freeN(mt->ELvectors[chartNr]);
+   MEM_freeN(mt->Wvectors[chartNr]);
+   MEM_freeN(mt->Pmatrices[chartNr]);
+   MEM_freeN(mt->Ematrices[chartNr]);
+   MEM_freeN(mt->Bvectors[chartNr]);
}
 
-   MEM_freeN(mt->nVerts);
-   MEM_freeN(mt->nFaces);
-   MEM_freeN(mt->nPinnedVertices);
+
MEM_freeN(mt->Vmatrices);
MEM_freeN(mt->UVmatrices);
MEM_freeN(mt->Fmatrices);
-   MEM_freeN(mt->Pmatrices);
MEM_freeN(mt->PPmatrices);
+   MEM_freeN(mt->ELvectors);
+   MEM_freeN(mt->Wvectors);
+   MEM_freeN(mt->Pmatrices);
+   MEM_freeN(mt->Ematrices);
+   MEM_freeN(mt->Bvectors);
+
+   MEM_freeN(mt->nVerts);
+   MEM_freeN(mt->nFaces);
+   MEM_freeN(mt->nPinnedVertices);
+   MEM_freeN(mt->nBoundaryVertices);
+   MEM_freeN(mt->nEdges);
+
MEM_freeN(mt);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index ed5b10a594..2a3abaa35c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -175,7 +175,9 @@ void convert_blender_slim(ParamHandle *handle, bool 
selectionOnly, int weightMap
 void set_uv_param_slim(ParamHandle *handle, matrix_transfer *mt);
 bool transformIslands(ParamHandle *handle);
 bool mark_pins(ParamHandle *paramHandle);
-
+void add_index_to_vertices(BMEditMesh *em);
+void free_matrix_transfer(matrix_transfer *mt);
+   
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 5920ecfecd..ccce5ca230 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -787,9 +787,6 @@ typedef struct {
bool noPins;
 } MinStretchSlim;
 
-void add_index_to_vertices(BMEditMesh *em);
-void free_matrix_transfer(matrix_transfer *mt);
-
 /* AUREL THESIS
Initialises SLIM and transfars data matrices
  */
@@ -865,6 +862,12 @@ static void minimize_stretch_SLIM_iteration(bContext *C, 
wmOperator *op, bool in
WM_event_add_notifier(C, NC_GEOM | ND_DATA, mss->obedit->data);
 }
 
+void free_slimPtrs(void **slimPtrs, int nCharts){
+   for (int i = 0; i<nCharts; i++){
+   free_slim_data_C(slimPtrs[i]);
+   }
+}
+
 /* 

[Bf-blender-cvs] [989740aae9] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 989740aae94a72add6c58228a1432516314c3524
Author: Aurel Gruber
Date:   Thu Jan 26 10:06:38 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB989740aae94a72add6c58228a1432516314c3524

Category: UV Unwrapping SLIM Algorithm Integration

fixing bug that causes weight-per-vertex mapping to be wrong

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 7da79fe62d..fdce9c05a4 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 7da79fe62d79adc1189fee09a96ecf592b92284a
+Subproject commit fdce9c05a458dc7109f11c52b67f1f2f5f734f47
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index cc4511606e..ea8bf4df4a 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -246,8 +246,8 @@ typedef struct PHandle {
 
matrix_transfer *mt;
int n_iterations;
+   int slim_global_method;
bool skip_initialization;
-   bool fixed_boundary;
bool pack_islands;
bool with_weighted_parameterization;
MDeformVert *weightMapData;
@@ -4348,7 +4348,7 @@ void param_construct_end(ParamHandle *handle, ParamBool 
fill, ParamBool impl)
 }
 
 void add_index_to_vertices(BMEditMesh *em){
-
+   
// AUREL THESIS iterate over bm edit mesh and set indices for weight 
retrieval,
//  This allows for later matching of 
vertices to weights.
BMVert *vert;
@@ -4372,7 +4372,6 @@ void param_slim_enrich_handle(Object *obedit,
  int weightMapIndex,
  int n_iterations,
  bool 
skip_initialization,
- bool fixed_boundary,
  bool pack_islands,
  bool 
with_weighted_parameterization){
 
@@ -4381,7 +4380,6 @@ void param_slim_enrich_handle(Object *obedit,
phandle->mt = mt;
phandle->n_iterations = n_iterations;
phandle->skip_initialization = skip_initialization;
-   phandle->fixed_boundary = fixed_boundary;
phandle->pack_islands = pack_islands;
phandle->with_weighted_parameterization = 
with_weighted_parameterization;
phandle->weightMapData = dvert;
@@ -4420,7 +4418,7 @@ void param_slim_begin(ParamHandle *handle) {
 void param_slim_solve(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
-   param_slim_C(mt, phandle->n_iterations, phandle->fixed_boundary, 
phandle->skip_initialization);
+   param_slim_C(mt, phandle->n_iterations, mt->fixed_boundary, 
phandle->skip_initialization);
 }
 
 void param_slim_end(ParamHandle *handle) {
@@ -5011,13 +5009,14 @@ void transfer_vertices(const int chartNr, const PHandle 
*phandle, matrix_transfe
for (v = chart->verts; v; v = v->nextlink){
 
if (!v->on_boundary_flag){
-   v->slimId = vid;
-
+   // set v->slim_id to vid ONLY AFTER assigning weight!
if (mt->with_weighted_parameterization){
weight = tempW[v->slimId];
-   W[v->slimId] = weight;
+   W[vid] = weight;
}
 
+   v->slimId = vid;
+
vid++;
}
 
@@ -5076,16 +5075,17 @@ void transfer_boundary_vertices(const int chartNr, 
const PHandle *phandle, const
PEdge *be = outer;
do{
 
-   mt->nBoundaryVertices[chartNr] += 1;
-   be->vert->slimId = vid;
-   be->vert->on_boundary_flag = true;
-   B[vid] = vid;
-
+   // set be->vert->slim_id to vid ONLY AFTER assigning weight!
if (mt->with_weighted_parameterization){
weight = tempW[be->vert->slimId];
W[vid] = weight;
}
 
+   mt->nBoundaryVertices[chartNr] += 1;
+   be->vert->slimId = vid;
+   be->vert->on_boundary_flag = true;
+   B[vid] = vid;
+
vid += 1;
be = p_boundary_edge_next(be);
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/bl

[Bf-blender-cvs] [26f72d9c3c] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 26f72d9c3cd682cfeadebad35ac1fe458c9214a3
Author: Aurel Gruber
Date:   Wed Feb 22 12:06:21 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB26f72d9c3cd682cfeadebad35ac1fe458c9214a3

Category: UV Unwrapping SLIM Algorithm Integration

adding relative scale, reflection mode and Vertex group input

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/intern/SLIM b/intern/SLIM
index 8686b499ce..cffc347ba2 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 8686b499ce3f23d537e1e56ab91412bc0b2aefb3
+Subproject commit cffc347ba26c31b04f9080916b99b1e603d4ee5c
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 472e293d8a..6ff5176491 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -253,6 +253,7 @@ typedef struct PHandle {
MDeformVert *weightMapData;
int weightMapIndex;
double weightInfluence;
+   double relative_scale;
BMesh *bm;
 
 } PHandle;
@@ -4360,9 +4361,8 @@ void add_index_to_vertices(BMEditMesh *em){
}
 }
 
-int retrieve_weightmap_index(Object *obedit){
-   char *name = "slim";
-   return defgroup_name_index(obedit, name);
+int retrieve_weightmap_index(Object *obedit, char *vertex_group){
+   return defgroup_name_index(obedit, vertex_group);
 }
 
 void param_slim_enrich_handle(Object *obedit,
@@ -4372,6 +4372,7 @@ void param_slim_enrich_handle(Object *obedit,
  MDeformVert *dvert,
  int weightMapIndex,
  double 
weightInfluence,
+ double relative_scale,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
@@ -4387,6 +4388,7 @@ void param_slim_enrich_handle(Object *obedit,
phandle->weightMapData = dvert;
phandle->weightMapIndex = weightMapIndex;
phandle->weightInfluence = weightInfluence;
+   phandle->relative_scale = relative_scale;
phandle->bm = em->bm;
 }
 
@@ -4428,7 +4430,6 @@ void param_slim_end(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
set_uv_param_slim(handle, mt);
-   free_matrix_transfer(mt);
 }
 
 
@@ -4835,6 +4836,7 @@ void transfer_data_to_slim(ParamHandle *handle){
mt->transform_islands = true;
mt->with_weighted_parameterization = 
phandle->with_weighted_parameterization;
mt->weight_influence = phandle->weightInfluence;
+   mt->relative_scale = phandle->relative_scale;
convert_blender_slim(handle, false, phandle->weightMapIndex);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 2a3abaa35c..8dcaf952ed 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -90,7 +90,7 @@ void param_delete(ParamHandle *chart);
  */
 
 void add_index_to_vertices(BMEditMesh *em);
-int retrieve_weightmap_index(Object *obedit);
+int retrieve_weightmap_index(Object *obedit, char *vertex_group);
 void param_slim_enrich_handle(Object *obedit,
  BMEditMesh *em,
  ParamHandle *handle,
@@ -98,6 +98,7 @@ void param_slim_enrich_handle(Object *obedit,
  MDeformVert *dvert,
  int weightMapIndex,
  double 
weightInfluence,
+ double relative_scale,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index ccce5ca230..db56fc9399 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedi

[Bf-blender-cvs] [19486fb8c4] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 19486fb8c41b581567eb5f0b69cc5bfd5bb48986
Author: Aurel Gruber
Date:   Fri Feb 24 09:31:38 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB19486fb8c41b581567eb5f0b69cc5bfd5bb48986

Category: UV Unwrapping SLIM Algorithm Integration

adding (unsupported-) eigen files

===

A   extern/Eigen3/unsupported/Eigen/AdolcForward
A   extern/Eigen3/unsupported/Eigen/AlignedVector3
A   extern/Eigen3/unsupported/Eigen/ArpackSupport
A   extern/Eigen3/unsupported/Eigen/AutoDiff
A   extern/Eigen3/unsupported/Eigen/BVH
A   extern/Eigen3/unsupported/Eigen/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/FFT
A   extern/Eigen3/unsupported/Eigen/IterativeSolvers
A   extern/Eigen3/unsupported/Eigen/KroneckerProduct
A   extern/Eigen3/unsupported/Eigen/LevenbergMarquardt
A   extern/Eigen3/unsupported/Eigen/MPRealSupport
A   extern/Eigen3/unsupported/Eigen/MatrixFunctions
A   extern/Eigen3/unsupported/Eigen/MoreVectorization
A   extern/Eigen3/unsupported/Eigen/NonLinearOptimization
A   extern/Eigen3/unsupported/Eigen/NumericalDiff
A   extern/Eigen3/unsupported/Eigen/OpenGLSupport
A   extern/Eigen3/unsupported/Eigen/Polynomials
A   extern/Eigen3/unsupported/Eigen/SVD
A   extern/Eigen3/unsupported/Eigen/Skyline
A   extern/Eigen3/unsupported/Eigen/SparseExtra
A   extern/Eigen3/unsupported/Eigen/Splines
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/BVH/BVAlgorithms.h
A   extern/Eigen3/unsupported/Eigen/src/BVH/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/BVH/KdBVH.h
A   extern/Eigen3/unsupported/Eigen/src/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
A   extern/Eigen3/unsupported/Eigen/src/Eigenvalues/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/FFT/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/FFT/ei_fftw_impl.h
A   extern/Eigen3/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IterationController.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/MINRES.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/Scaling.h
A   extern/Eigen3/unsupported/Eigen/src/KroneckerProduct/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/CopyrightMINPACK.txt
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h
A   
extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
A   
extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/StemFunction.h
A   extern/Eigen3/unsupported/Eigen/src/MoreVectorization/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
A   
extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/chkder.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/covar.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization

[Bf-blender-cvs] [185418608e] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 185418608e8714093b032be4cb2e0521e1391df3
Author: Aurel Gruber
Date:   Tue Jan 31 12:49:17 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB185418608e8714093b032be4cb2e0521e1391df3

Category: UV Unwrapping SLIM Algorithm Integration

adjustments to the UI parameters

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/intern/SLIM b/intern/SLIM
index fdce9c05a4..94ed5ce815 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit fdce9c05a458dc7109f11c52b67f1f2f5f734f47
+Subproject commit 94ed5ce815517fc0c1215411ef2404686d80e1a0
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 6dd754c96d..a19336643e 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -768,7 +768,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
 /* AUREL THESIS
 Minimize Stretch SLIM operator  */
 
-/* AUREL THESIS
+/* AUREL GRUBER
Holds all necessary state for one session of interactive 
parametrisation.
  */
 typedef struct {
@@ -810,6 +810,11 @@ static bool minimize_stretch_SLIM_init(bContext *C, 
wmOperator *op)
mss->fixBorder = true;
mss->mt->fixed_boundary = true;
 
+   scene->toolsettings->slim_skip_initialization = true;
+   scene->toolsettings->slim_pack_islands = false;
+   scene->toolsettings->slim_fixed_boundary = true;
+   
+
enrich_handle_slim(scene, obedit, em, handle, mss->mt);
param_slim_begin(handle);
 
@@ -1456,6 +1461,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const 
short sel)
 
const bool fill_holes = (scene->toolsettings->uvcalc_flag & 
UVCALC_FILLHOLES) != 0;
const bool correct_aspect = (scene->toolsettings->uvcalc_flag & 
UVCALC_NO_ASPECT_CORRECT) == 0;
+   scene->toolsettings->slim_skip_initialization = false;
+   scene->toolsettings->slim_pack_islands = true;
+   scene->toolsettings->slim_fixed_boundary = false;
bool use_subsurf;
 
bool use_slim_method = (scene->toolsettings->unwrapper == 2);
@@ -1497,9 +1505,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
int method = RNA_enum_get(op->ptr, "method");
 
int n_slim_iterations = RNA_int_get(op->ptr, "slim_iterations");
-   bool slim_pack_islands = RNA_int_get(op->ptr, "slim_pack_islands");
-   bool slim_skip_initialization = RNA_int_get(op->ptr, 
"slim_skip_initialization");
-   bool slim_fixed_boundary = RNA_int_get(op->ptr, "slim_fixed_boundary");
+   double slim_weight_influence = RNA_float_get(op->ptr, 
"slim_weight_influence");
 
const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
@@ -1531,12 +1537,9 @@ static int unwrap_exec(bContext *C, wmOperator *op)
else
RNA_enum_set(op->ptr, "method", scene->toolsettings->unwrapper);
 
-   /* get number of iterations and methood in global phase for SLIM 
unwraping*/
+   /* get number of iterations and method in global phase for SLIM 
unwraping*/
scene->toolsettings->slim_n_iterations = n_slim_iterations;
-   scene->toolsettings->slim_fixed_boundary = slim_fixed_boundary;
-   scene->toolsettings->slim_pack_islands = slim_pack_islands;
-   scene->toolsettings->slim_skip_initialization = 
slim_skip_initialization;
-
+   scene->toolsettings->slim_weight_influence = slim_weight_influence;
 
/* remember packing marging */
if (RNA_struct_property_is_set(op->ptr, "margin"))
@@ -1600,12 +1603,8 @@ void UV_OT_unwrap(wmOperatorType *ot)
 
RNA_def_int(ot->srna, "slim_iterations", 1, 0, 1, "SLIM Iterations",
"Number of Iterations if the SLIM algorithm is 
used.", 1, 30);
-   RNA_def_boolean(ot->srna, "slim_skip_initialization", 0, "SLIM Skip 
Initialization",
-   "Use existing map as initialization for 
SLIM (May not contain flips!).");
-   RNA_def_boolean(ot->srna, "slim_fixed_boundary", 0, "SLIM Fix Boundary",
-   "When using SLIM and skipping 
initialization, this pins the boundary vertices to stay in place.");
-   RNA_def_boolean(ot->srna, "slim_pack_islands", 

[Bf-blender-cvs] [9aee5cd8d2] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 9aee5cd8d2b8b1b774738b59b06ac9b6313a5488
Author: Aurel Gruber
Date:   Thu Jan 19 16:03:34 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB9aee5cd8d2b8b1b774738b59b06ac9b6313a5488

Category: UV Unwrapping SLIM Algorithm Integration

preserving vertex ids and gathering weights

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index e897ae04d5..62a96ad0e8 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit e897ae04d52607970344a601fc85c1329f2314ed
+Subproject commit 62a96ad0e853e1008bd971272e5f79231cd4308c
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 759af69fd3..0e3d343401 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -744,7 +744,7 @@ static void p_face_restore_uvs(PFace *f)
 
 /* Construction (use only during construction, relies on u.key being set */
 
-static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], 
PEdge *e)
+static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], 
float id, PEdge *e)
 {
PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof(*v));
copy_v3_v3(v->co, co);
@@ -761,20 +761,21 @@ static PVert *p_vert_add(PHandle *handle, PHashKey key, 
const float co[3], PEdge
v->u.key = key;
v->edge = e;
v->flag = 0;
+   v->slimId = id;
 
phash_insert(handle->hash_verts, (PHashLink *)v);
 
return v;
 }
 
-static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], 
PEdge *e)
+static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], 
float id, PEdge *e)
 {
PVert *v = (PVert *)phash_lookup(handle->hash_verts, key);
 
if (v)
return v;
else
-   return p_vert_add(handle, key, co, e);
+   return p_vert_add(handle, key, co, id, e);
 }
 
 static PVert *p_vert_copy(PChart *chart, PVert *v)
@@ -1115,15 +1116,15 @@ static PFace *p_face_add(PHandle *handle)
 }
 
 static PFace *p_face_add_construct(PHandle *handle, ParamKey key, ParamKey 
*vkeys,
-   float *co[4], float *uv[4], int i1, int i2, 
int i3,
+   float *co[4], float *uv[4], float id[4], 
int i1, int i2, int i3,
ParamBool *pin, ParamBool *select)
 {
PFace *f = p_face_add(handle);
PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 
-   e1->vert = p_vert_lookup(handle, vkeys[i1], co[i1], e1);
-   e2->vert = p_vert_lookup(handle, vkeys[i2], co[i2], e2);
-   e3->vert = p_vert_lookup(handle, vkeys[i3], co[i3], e3);
+   e1->vert = p_vert_lookup(handle, vkeys[i1], co[i1], id[i1], e1);
+   e2->vert = p_vert_lookup(handle, vkeys[i2], co[i2], id[i2], e2);
+   e3->vert = p_vert_lookup(handle, vkeys[i3], co[i3], id[i3], e3);
 
e1->orig_uv = uv[i1];
e2->orig_uv = uv[i2];
@@ -4174,7 +4175,7 @@ void param_delete(ParamHandle *handle)
 }
 
 static void p_add_ngon(ParamHandle *handle, ParamKey key, int nverts,
-   ParamKey *vkeys, float **co, float **uv,
+   ParamKey *vkeys, float **co, float **uv, float *id,
ParamBool *pin, ParamBool *select, const float 
normal[3])
 {
int *boundary = BLI_array_alloca(boundary, nverts);
@@ -4229,10 +4230,11 @@ static void p_add_ngon(ParamHandle *handle, ParamKey 
key, int nverts,
ParamKey tri_vkeys[3] = {vkeys[v0], vkeys[v1], 
vkeys[v2]};
float *tri_co[3] = {co[v0], co[v1], co[v2]};
float *tri_uv[3] = {uv[v0], uv[v1], uv[v2]};
+   float tri_id[3] = {id[v0], id[v1], id[v2]};
ParamBool tri_pin[3] = {pin[v0], pin[v1], pin[v2]};
ParamBool tri_select[3] = {select[v0], select[v1], 
select[v2]};
 
-   param_face_add(handle, key, 3, tri_vkeys, tri_co, 
tri_uv, tri_pin, tri_select, NULL);
+   param_face_add(handle, key, 3, tri_vkeys, tri_co, 
tri_uv, tri_id, tri_pin, tri_select, NULL);
}
 
/* remove corner */
@@ -4244,7 +4246,7 @@ static void p_add_ngon(ParamHandle *handle, ParamKey key, 
int nverts,
 }
 
 void param_face_add(ParamHandle *handle, ParamKey key, int nverts,
-ParamKey *vkeys, float *co[4], float *uv[4],
+ParamKey *vkeys, float *co[4], float *uv[4], float id[4

[Bf-blender-cvs] [23fa368898] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: 23fa36889820965033d90e4ecb5855776fc41d65
Author: Aurel Gruber
Date:   Tue Nov 15 13:25:10 2016 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rB23fa36889820965033d90e4ecb5855776fc41d65

Category: UV Unwrapping SLIM Algorithm Integration

added subfolder SLIM to CMakeFile of /intern

===

M   intern/CMakeLists.txt

===

diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index dd9889c81b..090966f3b3 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -92,3 +92,5 @@ endif()
 if(WITH_OPENVDB)
add_subdirectory(openvdb)
 endif()
+
+add_subdirectory(SLIM)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f65b1a80ac] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: f65b1a80ac01b9d64be356c349f7a55bf2c0c969
Author: Aurel Gruber
Date:   Mon Jan 23 13:51:17 2017 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rBf65b1a80ac01b9d64be356c349f7a55bf2c0c969

Category: UV Unwrapping SLIM Algorithm Integration

adding more members to phandle and creating param_begin

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 62a96ad0e8..7da79fe62d 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 62a96ad0e853e1008bd971272e5f79231cd4308c
+Subproject commit 7da79fe62d79adc1189fee09a96ecf592b92284a
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 0e3d343401..cc4511606e 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -241,6 +241,19 @@ typedef struct PHandle {
RNG *rng;
float blend;
char do_aspect;
+
+   // SLIM
+
+   matrix_transfer *mt;
+   int n_iterations;
+   bool skip_initialization;
+   bool fixed_boundary;
+   bool pack_islands;
+   bool with_weighted_parameterization;
+   MDeformVert *weightMapData;
+   int weightMapIndex;
+   BMesh *bm;
+
 } PHandle;
 
 /* PHash
@@ -4334,6 +4347,89 @@ void param_construct_end(ParamHandle *handle, ParamBool 
fill, ParamBool impl)
phandle->state = PHANDLE_STATE_CONSTRUCTED;
 }
 
+void add_index_to_vertices(BMEditMesh *em){
+
+   // AUREL THESIS iterate over bm edit mesh and set indices for weight 
retrieval,
+   //  This allows for later matching of 
vertices to weights.
+   BMVert *vert;
+   BMIter iter;
+   int i;
+   BM_ITER_MESH_INDEX(vert, , em->bm, BM_VERTS_OF_MESH, i){
+   vert->id = i;
+   }
+}
+
+int retrieve_weightmap_index(Object *obedit){
+   char *name = "slim";
+   return defgroup_name_index(obedit, name);
+}
+
+void param_slim_enrich_handle(Object *obedit,
+ BMEditMesh *em,
+ ParamHandle *handle,
+ matrix_transfer *mt,
+ MDeformVert *dvert,
+ int weightMapIndex,
+ int n_iterations,
+ bool 
skip_initialization,
+ bool fixed_boundary,
+ bool pack_islands,
+ bool 
with_weighted_parameterization){
+
+   PHandle *phandle = (PHandle *)handle;
+
+   phandle->mt = mt;
+   phandle->n_iterations = n_iterations;
+   phandle->skip_initialization = skip_initialization;
+   phandle->fixed_boundary = fixed_boundary;
+   phandle->pack_islands = pack_islands;
+   phandle->with_weighted_parameterization = 
with_weighted_parameterization;
+   phandle->weightMapData = dvert;
+   phandle->weightMapIndex = weightMapIndex;
+   phandle->bm = em->bm;
+}
+
+void param_begin(ParamHandle *handle, ParamBool abf, bool use_slim) {
+   if (use_slim){
+   param_slim_begin(handle);
+   } else {
+   param_lscm_begin(handle, PARAM_FALSE, abf);
+   }
+}
+
+void param_solve(ParamHandle *handle, bool use_slim) {
+   if (use_slim){
+   param_slim_solve(handle);
+   } else {
+   param_lscm_solve(handle);
+   }
+}
+
+void param_end(ParamHandle *handle, bool use_slim) {
+   if (use_slim){
+   param_slim_end(handle);
+   } else {
+   param_lscm_end(handle);
+   }
+}
+
+void param_slim_begin(ParamHandle *handle) {
+   transfer_data_to_slim(handle);
+}
+
+void param_slim_solve(ParamHandle *handle) {
+   PHandle *phandle = (PHandle *) handle;
+   matrix_transfer *mt = phandle->mt;
+   param_slim_C(mt, phandle->n_iterations, phandle->fixed_boundary, 
phandle->skip_initialization);
+}
+
+void param_slim_end(ParamHandle *handle) {
+   PHandle *phandle = (PHandle *) handle;
+   matrix_transfer *mt = phandle->mt;
+   set_uv_param_slim(handle, mt);
+}
+
+
 void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf)
 {
PHandle *phandle = (PHandle *)handle;
@@ -4716,18 +4812,34 @@ vo

[Bf-blender-cvs] [bf279c8d1e] uv_unwrapping_slim_and_ceres: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-27 Thread Aurel Gruber
Commit: bf279c8d1e8192cfe7a89fa456f0cd0f22cfb3cf
Author: Aurel Gruber
Date:   Tue Nov 15 13:20:40 2016 +0100
Branches: uv_unwrapping_slim_and_ceres
https://developer.blender.org/rBbf279c8d1e8192cfe7a89fa456f0cd0f22cfb3cf

Category: UV Unwrapping SLIM Algorithm Integration

Added SLIM Subfolder

===

M   .gitmodules
A   intern/SLIM

===

diff --git a/.gitmodules b/.gitmodules
index 0b8228e3f1..8abcc4584f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -13,4 +13,4 @@
 [submodule "source/tools"]
path = source/tools
url = ../blender-dev-tools.git
-   ignore = all
+   ignore = all
\ No newline at end of file
diff --git a/intern/SLIM b/intern/SLIM
new file mode 16
index 00..fa4b84c7dd
--- /dev/null
+++ b/intern/SLIM
@@ -0,0 +1 @@
+Subproject commit fa4b84c7dd2aac4502887999f6b4ee9c524adedf

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [16c6c8a1c4] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-24 Thread Aurel Gruber
Commit: 16c6c8a1c4f6bb368cff5d5f60b05cdfced0a8ca
Author: Aurel Gruber
Date:   Fri Feb 24 09:31:38 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB16c6c8a1c4f6bb368cff5d5f60b05cdfced0a8ca

Category: UV Unwrapping SLIM Algorithm Integration

adding (unsupported-) eigen files

===

A   extern/Eigen3/unsupported/Eigen/AdolcForward
A   extern/Eigen3/unsupported/Eigen/AlignedVector3
A   extern/Eigen3/unsupported/Eigen/ArpackSupport
A   extern/Eigen3/unsupported/Eigen/AutoDiff
A   extern/Eigen3/unsupported/Eigen/BVH
A   extern/Eigen3/unsupported/Eigen/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/FFT
A   extern/Eigen3/unsupported/Eigen/IterativeSolvers
A   extern/Eigen3/unsupported/Eigen/KroneckerProduct
A   extern/Eigen3/unsupported/Eigen/LevenbergMarquardt
A   extern/Eigen3/unsupported/Eigen/MPRealSupport
A   extern/Eigen3/unsupported/Eigen/MatrixFunctions
A   extern/Eigen3/unsupported/Eigen/MoreVectorization
A   extern/Eigen3/unsupported/Eigen/NonLinearOptimization
A   extern/Eigen3/unsupported/Eigen/NumericalDiff
A   extern/Eigen3/unsupported/Eigen/OpenGLSupport
A   extern/Eigen3/unsupported/Eigen/Polynomials
A   extern/Eigen3/unsupported/Eigen/SVD
A   extern/Eigen3/unsupported/Eigen/Skyline
A   extern/Eigen3/unsupported/Eigen/SparseExtra
A   extern/Eigen3/unsupported/Eigen/Splines
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h
A   extern/Eigen3/unsupported/Eigen/src/AutoDiff/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/BVH/BVAlgorithms.h
A   extern/Eigen3/unsupported/Eigen/src/BVH/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/BVH/KdBVH.h
A   extern/Eigen3/unsupported/Eigen/src/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h
A   extern/Eigen3/unsupported/Eigen/src/Eigenvalues/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/FFT/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/FFT/ei_fftw_impl.h
A   extern/Eigen3/unsupported/Eigen/src/FFT/ei_kissfft_impl.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteCholesky.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h
A   
extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/IterationController.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/MINRES.h
A   extern/Eigen3/unsupported/Eigen/src/IterativeSolvers/Scaling.h
A   extern/Eigen3/unsupported/Eigen/src/KroneckerProduct/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/CopyrightMINPACK.txt
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h
A   extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h
A   
extern/Eigen3/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h
A   
extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunctionAtomic.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h
A   extern/Eigen3/unsupported/Eigen/src/MatrixFunctions/StemFunction.h
A   extern/Eigen3/unsupported/Eigen/src/MoreVectorization/CMakeLists.txt
A   extern/Eigen3/unsupported/Eigen/src/MoreVectorization/MathFunctions.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/CMakeLists.txt
A   
extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h
A   
extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/chkder.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization/covar.h
A   extern/Eigen3/unsupported/Eigen/src/NonLinearOptimization

[Bf-blender-cvs] [1cb016491a] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-24 Thread Aurel Gruber
Commit: 1cb016491afea7656a3934cfd4bac1ac6d9a0e38
Author: Aurel Gruber
Date:   Fri Feb 24 09:28:33 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB1cb016491afea7656a3934cfd4bac1ac6d9a0e38

Category: UV Unwrapping SLIM Algorithm Integration

freeing matrix_transfer properly

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 6ff5176491..e8af44e32b 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4430,6 +4430,7 @@ void param_slim_end(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
set_uv_param_slim(handle, mt);
+   free_matrix_transfer(mt);
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5793441a35] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 5793441a3532ddce477788fd0870f72e8f415098
Author: Aurel Gruber
Date:   Tue Nov 15 13:25:10 2016 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB5793441a3532ddce477788fd0870f72e8f415098

Category: UV Unwrapping SLIM Algorithm Integration

added subfolder SLIM to CMakeFile of /intern

===

M   intern/CMakeLists.txt

===

diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index dd9889c81b..090966f3b3 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -92,3 +92,5 @@ endif()
 if(WITH_OPENVDB)
add_subdirectory(openvdb)
 endif()
+
+add_subdirectory(SLIM)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9f7c4aa581] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 9f7c4aa581eaf42aa60db9941143c8ffceb47498
Author: Aurel Gruber
Date:   Thu Jan 26 10:06:38 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB9f7c4aa581eaf42aa60db9941143c8ffceb47498

Category: UV Unwrapping SLIM Algorithm Integration

fixing bug that causes weight-per-vertex mapping to be wrong

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 7da79fe62d..fdce9c05a4 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 7da79fe62d79adc1189fee09a96ecf592b92284a
+Subproject commit fdce9c05a458dc7109f11c52b67f1f2f5f734f47
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index cc4511606e..ea8bf4df4a 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -246,8 +246,8 @@ typedef struct PHandle {
 
matrix_transfer *mt;
int n_iterations;
+   int slim_global_method;
bool skip_initialization;
-   bool fixed_boundary;
bool pack_islands;
bool with_weighted_parameterization;
MDeformVert *weightMapData;
@@ -4348,7 +4348,7 @@ void param_construct_end(ParamHandle *handle, ParamBool 
fill, ParamBool impl)
 }
 
 void add_index_to_vertices(BMEditMesh *em){
-
+   
// AUREL THESIS iterate over bm edit mesh and set indices for weight 
retrieval,
//  This allows for later matching of 
vertices to weights.
BMVert *vert;
@@ -4372,7 +4372,6 @@ void param_slim_enrich_handle(Object *obedit,
  int weightMapIndex,
  int n_iterations,
  bool 
skip_initialization,
- bool fixed_boundary,
  bool pack_islands,
  bool 
with_weighted_parameterization){
 
@@ -4381,7 +4380,6 @@ void param_slim_enrich_handle(Object *obedit,
phandle->mt = mt;
phandle->n_iterations = n_iterations;
phandle->skip_initialization = skip_initialization;
-   phandle->fixed_boundary = fixed_boundary;
phandle->pack_islands = pack_islands;
phandle->with_weighted_parameterization = 
with_weighted_parameterization;
phandle->weightMapData = dvert;
@@ -4420,7 +4418,7 @@ void param_slim_begin(ParamHandle *handle) {
 void param_slim_solve(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
-   param_slim_C(mt, phandle->n_iterations, phandle->fixed_boundary, 
phandle->skip_initialization);
+   param_slim_C(mt, phandle->n_iterations, mt->fixed_boundary, 
phandle->skip_initialization);
 }
 
 void param_slim_end(ParamHandle *handle) {
@@ -5011,13 +5009,14 @@ void transfer_vertices(const int chartNr, const PHandle 
*phandle, matrix_transfe
for (v = chart->verts; v; v = v->nextlink){
 
if (!v->on_boundary_flag){
-   v->slimId = vid;
-
+   // set v->slim_id to vid ONLY AFTER assigning weight!
if (mt->with_weighted_parameterization){
weight = tempW[v->slimId];
-   W[v->slimId] = weight;
+   W[vid] = weight;
}
 
+   v->slimId = vid;
+
vid++;
}
 
@@ -5076,16 +5075,17 @@ void transfer_boundary_vertices(const int chartNr, 
const PHandle *phandle, const
PEdge *be = outer;
do{
 
-   mt->nBoundaryVertices[chartNr] += 1;
-   be->vert->slimId = vid;
-   be->vert->on_boundary_flag = true;
-   B[vid] = vid;
-
+   // set be->vert->slim_id to vid ONLY AFTER assigning weight!
if (mt->with_weighted_parameterization){
weight = tempW[be->vert->slimId];
W[vid] = weight;
}
 
+   mt->nBoundaryVertices[chartNr] += 1;
+   be->vert->slimId = vid;
+   be->vert->on_boundary_flag = true;
+   B[vid] = vid;
+
vid += 1;
be = p_boundary_edge_next(be);
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/bl

[Bf-blender-cvs] [08d1b312be] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 08d1b312be5e06400672a2bc4b5fe7eed3600be2
Author: Aurel Gruber
Date:   Fri Nov 18 12:54:50 2016 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB08d1b312be5e06400672a2bc4b5fe7eed3600be2

Category: UV Unwrapping SLIM Algorithm Integration

integrating SLIM including data gathering and transfer from Blender to SLIM

This commit is huge, because I copied over the code from a different 
repository. Not commit-by-commit.

The Algorithm can be invoked either by choosing SLIM from the dropdown in the 
unwrapping settings or by
hitting ctrl. + m in the uv editor for relaxation. Tried adding it to the menu 
the same way as minimizing stretch is there but failed.

===

M   intern/SLIM
M   source/blender/bmesh/bmesh_class.h
M   source/blender/editors/uvedit/CMakeLists.txt
M   source/blender/editors/uvedit/uvedit_intern.h
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/intern/SLIM b/intern/SLIM
index fa4b84c7dd..e897ae04d5 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit fa4b84c7dd2aac4502887999f6b4ee9c524adedf
+Subproject commit e897ae04d52607970344a601fc85c1329f2314ed
diff --git a/source/blender/bmesh/bmesh_class.h 
b/source/blender/bmesh/bmesh_class.h
index 104df625ee..49077b19be 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -99,6 +99,8 @@ typedef struct BMVert {
 *   which is a bit of an abuse of internal bmesh data but also 
works OK for now (use with care!).
 */
struct BMEdge *e;
+   /* AUREL */
+   int id;
 } BMVert;
 
 typedef struct BMVert_OFlag {
diff --git a/source/blender/editors/uvedit/CMakeLists.txt 
b/source/blender/editors/uvedit/CMakeLists.txt
index 543ef0e066..a7e2da0508 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -31,6 +31,8 @@ set(INC
../../../../intern/guardedalloc
../../../../intern/eigen
../../../../intern/glew-mx
+
+   ../../../../intern/SLIM/src
 )
 
 set(INC_SYS
@@ -56,3 +58,4 @@ endif()
 add_definitions(${GL_DEFINITIONS})
 
 blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}")
+target_link_libraries(bf_editor_uvedit bf_intern_slim)
diff --git a/source/blender/editors/uvedit/uvedit_intern.h 
b/source/blender/editors/uvedit/uvedit_intern.h
index e028c08091..e8dbb337cf 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -75,6 +75,8 @@ void UV_OT_cube_project(struct wmOperatorType *ot);
 void UV_OT_cylinder_project(struct wmOperatorType *ot);
 void UV_OT_project_from_view(struct wmOperatorType *ot);
 void UV_OT_minimize_stretch(struct wmOperatorType *ot);
+// AUREL SLIM interactive parameterization
+void UV_OT_minimize_stretch_slim(struct wmOperatorType *ot);
 void UV_OT_pack_islands(struct wmOperatorType *ot);
 void UV_OT_reset(struct wmOperatorType *ot);
 void UV_OT_sphere_project(struct wmOperatorType *ot);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c 
b/source/blender/editors/uvedit/uvedit_ops.c
index 193b006cf0..6cdce37ab0 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -4265,6 +4265,8 @@ void ED_operatortypes_uvedit(void)
WM_operatortype_append(UV_OT_cylinder_project);
WM_operatortype_append(UV_OT_project_from_view);
WM_operatortype_append(UV_OT_minimize_stretch);
+   // AUREL SLIM Interactive Parameterization
+   WM_operatortype_append(UV_OT_minimize_stretch_slim);
WM_operatortype_append(UV_OT_pack_islands);
WM_operatortype_append(UV_OT_reset);
WM_operatortype_append(UV_OT_sphere_project);
@@ -4341,6 +4343,8 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* unwrap */
WM_keymap_add_item(keymap, "UV_OT_unwrap", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UV_OT_minimize_stretch", VKEY, KM_PRESS, 
KM_CTRL, 0);
+   // AUREL SLIM Interactive Parameterization
+   WM_keymap_add_item(keymap, "UV_OT_minimize_stretch_slim", MKEY, 
KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_pack_islands", PKEY, KM_PRESS, 
KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_average_islands_scale", AKEY, 
KM_PRESS, KM_CTRL, 0);
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index bdfff123aa..759af69fd3 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b

[Bf-blender-cvs] [15785145b1] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 15785145b163d18136dfe3178709b5fabfcc4ea8
Author: Aurel Gruber
Date:   Thu Feb 23 13:22:30 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB15785145b163d18136dfe3178709b5fabfcc4ea8

Category: UV Unwrapping SLIM Algorithm Integration

correcting wrong comment on SLIM phases

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.h

===

diff --git a/intern/SLIM b/intern/SLIM
index cffc347ba2..8bdd2ea2de 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit cffc347ba26c31b04f9080916b99b1e603d4ee5c
+Subproject commit 8bdd2ea2ded2dffa5b02ba51cd00e46af19af87d
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 8dcaf952ed..abfc4a0162 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -112,16 +112,12 @@ void param_begin(ParamHandle *handle, ParamBool abf, bool 
useSlim);
 void param_solve(ParamHandle *handle, bool useSlim);
 void param_end(ParamHandle *handle, bool useSlim);
 
-/* Least Squares Conformal Maps:
+/* SLIM:
  * -
- * - charts with less than two pinned vertices are assigned 2 pins
- * - lscm is divided in three steps:
- * - begin: compute matrix and it's factorization (expensive)
- * - solve using pinned coordinates (cheap)
+ * - begin: Data is gathered into matrices and transferred to SLIM
+ * - solve: compute cheap initialization (if necessary) and refine iteratively
  * - end: clean up
- * - uv coordinates are allowed to change within begin/end, for
- *   quick re-solving
- */
+*/
 
 void param_slim_begin(ParamHandle *handle);
 void param_slim_solve(ParamHandle *handle);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7e2e77714c] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 7e2e77714c050de0c25932046396b6254b3c92ad
Author: Aurel Gruber
Date:   Thu Feb 23 16:26:08 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB7e2e77714c050de0c25932046396b6254b3c92ad

Category: UV Unwrapping SLIM Algorithm Integration

Adding SLIM code by means of git read-tree

===

D   intern/SLIM
A   intern/SLIM/.gitignore
A   intern/SLIM/CMakeLists.txt
A   intern/SLIM/LICENSE
A   intern/SLIM/ext/libigl_extract/EPS.cpp
A   intern/SLIM/ext/libigl_extract/EPS.h
A   intern/SLIM/ext/libigl_extract/IndexComparison.h
A   intern/SLIM/ext/libigl_extract/cat.cpp
A   intern/SLIM/ext/libigl_extract/cat.h
A   intern/SLIM/ext/libigl_extract/colon.cpp
A   intern/SLIM/ext/libigl_extract/colon.h
A   intern/SLIM/ext/libigl_extract/cotmatrix.cpp
A   intern/SLIM/ext/libigl_extract/cotmatrix.h
A   intern/SLIM/ext/libigl_extract/cotmatrix_entries.cpp
A   intern/SLIM/ext/libigl_extract/cotmatrix_entries.h
A   intern/SLIM/ext/libigl_extract/dihedral_angles.cpp
A   intern/SLIM/ext/libigl_extract/dihedral_angles.h
A   intern/SLIM/ext/libigl_extract/doublearea.cpp
A   intern/SLIM/ext/libigl_extract/doublearea.h
A   intern/SLIM/ext/libigl_extract/edge_lengths.cpp
A   intern/SLIM/ext/libigl_extract/edge_lengths.h
A   intern/SLIM/ext/libigl_extract/face_areas.cpp
A   intern/SLIM/ext/libigl_extract/face_areas.h
A   intern/SLIM/ext/libigl_extract/find.cpp
A   intern/SLIM/ext/libigl_extract/find.h
A   intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.cpp
A   intern/SLIM/ext/libigl_extract/flip_avoiding_line_search.h
A   intern/SLIM/ext/libigl_extract/grad.cpp
A   intern/SLIM/ext/libigl_extract/grad.h
A   intern/SLIM/ext/libigl_extract/igl/Timer.h
A   intern/SLIM/ext/libigl_extract/igl/harmonic.cpp
A   intern/SLIM/ext/libigl_extract/igl/harmonic.h
A   intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.cpp
A   intern/SLIM/ext/libigl_extract/igl/map_vertices_to_circle.h
A   intern/SLIM/ext/libigl_extract/igl_inline.h
A   intern/SLIM/ext/libigl_extract/invert_diag.cpp
A   intern/SLIM/ext/libigl_extract/invert_diag.h
A   intern/SLIM/ext/libigl_extract/is_symmetric.cpp
A   intern/SLIM/ext/libigl_extract/is_symmetric.h
A   intern/SLIM/ext/libigl_extract/isdiag.cpp
A   intern/SLIM/ext/libigl_extract/isdiag.h
A   intern/SLIM/ext/libigl_extract/line_search.cpp
A   intern/SLIM/ext/libigl_extract/line_search.h
A   intern/SLIM/ext/libigl_extract/local_basis.cpp
A   intern/SLIM/ext/libigl_extract/local_basis.h
A   intern/SLIM/ext/libigl_extract/massmatrix.cpp
A   intern/SLIM/ext/libigl_extract/massmatrix.h
A   intern/SLIM/ext/libigl_extract/min_quad_with_fixed.cpp
A   intern/SLIM/ext/libigl_extract/min_quad_with_fixed.h
A   intern/SLIM/ext/libigl_extract/normalize_row_sums.cpp
A   intern/SLIM/ext/libigl_extract/normalize_row_sums.h
A   intern/SLIM/ext/libigl_extract/parallel_for.cpp
A   intern/SLIM/ext/libigl_extract/parallel_for.h
A   intern/SLIM/ext/libigl_extract/per_face_normals.cpp
A   intern/SLIM/ext/libigl_extract/per_face_normals.h
A   intern/SLIM/ext/libigl_extract/polar_svd.cpp
A   intern/SLIM/ext/libigl_extract/polar_svd.h
A   intern/SLIM/ext/libigl_extract/reorder.cpp
A   intern/SLIM/ext/libigl_extract/reorder.h
A   intern/SLIM/ext/libigl_extract/repmat.cpp
A   intern/SLIM/ext/libigl_extract/repmat.h
A   intern/SLIM/ext/libigl_extract/slice.cpp
A   intern/SLIM/ext/libigl_extract/slice.h
A   intern/SLIM/ext/libigl_extract/sort.cpp
A   intern/SLIM/ext/libigl_extract/sort.h
A   intern/SLIM/ext/libigl_extract/sparse.cpp
A   intern/SLIM/ext/libigl_extract/sparse.h
A   intern/SLIM/ext/libigl_extract/squared_edge_lengths.cpp
A   intern/SLIM/ext/libigl_extract/squared_edge_lengths.h
A   intern/SLIM/ext/libigl_extract/verbose.h
A   intern/SLIM/ext/libigl_extract/volume.cpp
A   intern/SLIM/ext/libigl_extract/volume.h
A   intern/SLIM/src/Slim.cpp
A   intern/SLIM/src/Slim.h
A   intern/SLIM/src/UVInitializer.cpp
A   intern/SLIM/src/UVInitializer.h
A   intern/SLIM/src/area_compensation.cpp
A   intern/SLIM/src/area_compensation.h
A   intern/SLIM/src/geometry_data_retrieval.cpp
A   intern/SLIM/src/geometry_data_retrieval.h
A   intern/SLIM/src/least_squares_relocator.cpp
A   intern/SLIM/src/least_squares_relocator.h
A   intern/SLIM/src/matrix_transfer.h
A   intern/SLIM/src/slim_C_interface.cpp
A   intern/SLIM/src/slim_C_interface.h
A   intern/SLIM/src/slim_parametrizer.cpp
A   intern/SLIM/src/slim_parametrizer.h
M   release/datafiles/locale
M   release/scripts/addons
M   release/scripts/addons_contrib
M   source/tools

[Bf-blender-cvs] [2bf059ad3b] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 2bf059ad3ba57aa300af6c5b5ab5c017efa980c8
Author: Aurel Gruber
Date:   Sat Feb 4 14:42:19 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB2bf059ad3ba57aa300af6c5b5ab5c017efa980c8

Category: UV Unwrapping SLIM Algorithm Integration

slim interactive exec now only for changing parameters

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 94ed5ce815..8c6ee9dbdc 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 94ed5ce815517fc0c1215411ef2404686d80e1a0
+Subproject commit 8c6ee9dbdc60a9e2c3543eec38e71f9ca4fcd971
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 247c43c4c5..5920ecfecd 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -903,21 +903,10 @@ static void minimize_stretch_SLIM_exit(bContext *C, 
wmOperator *op, bool cancel)
 }
 
 /* AUREL THESIS
-   NON-interactive version of interactive parametrisation. Every modal 
operator of blender has this mode.
-   In this case, it's obviously never used, since the "normal" 
non-interactive unwrapping method is to be preferred.
+   Used Only to adjust parameters.
  */
 static int minimize_stretch_SLIM_exec(bContext *C, wmOperator *op)
 {
-   int n_iterations = 1;
-
-   if (!minimize_stretch_SLIM_init(C, op))
-   return OPERATOR_CANCELLED;
-
-   MinStretchSlim *mss = op->customdata;
-
-   param_slim_C(mss->mt, n_iterations, true, true);
-
-   minimize_stretch_SLIM_exit(C, op, false);
 
return OPERATOR_FINISHED;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1f88850826] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 1f8885082654bc7ffaeefca03ee2f72de752a0e7
Author: Aurel Gruber
Date:   Tue Jan 31 12:49:17 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB1f8885082654bc7ffaeefca03ee2f72de752a0e7

Category: UV Unwrapping SLIM Algorithm Integration

adjustments to the UI parameters

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/intern/SLIM b/intern/SLIM
index fdce9c05a4..94ed5ce815 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit fdce9c05a458dc7109f11c52b67f1f2f5f734f47
+Subproject commit 94ed5ce815517fc0c1215411ef2404686d80e1a0
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 6dd754c96d..a19336643e 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -768,7 +768,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
 /* AUREL THESIS
 Minimize Stretch SLIM operator  */
 
-/* AUREL THESIS
+/* AUREL GRUBER
Holds all necessary state for one session of interactive 
parametrisation.
  */
 typedef struct {
@@ -810,6 +810,11 @@ static bool minimize_stretch_SLIM_init(bContext *C, 
wmOperator *op)
mss->fixBorder = true;
mss->mt->fixed_boundary = true;
 
+   scene->toolsettings->slim_skip_initialization = true;
+   scene->toolsettings->slim_pack_islands = false;
+   scene->toolsettings->slim_fixed_boundary = true;
+   
+
enrich_handle_slim(scene, obedit, em, handle, mss->mt);
param_slim_begin(handle);
 
@@ -1456,6 +1461,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const 
short sel)
 
const bool fill_holes = (scene->toolsettings->uvcalc_flag & 
UVCALC_FILLHOLES) != 0;
const bool correct_aspect = (scene->toolsettings->uvcalc_flag & 
UVCALC_NO_ASPECT_CORRECT) == 0;
+   scene->toolsettings->slim_skip_initialization = false;
+   scene->toolsettings->slim_pack_islands = true;
+   scene->toolsettings->slim_fixed_boundary = false;
bool use_subsurf;
 
bool use_slim_method = (scene->toolsettings->unwrapper == 2);
@@ -1497,9 +1505,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
int method = RNA_enum_get(op->ptr, "method");
 
int n_slim_iterations = RNA_int_get(op->ptr, "slim_iterations");
-   bool slim_pack_islands = RNA_int_get(op->ptr, "slim_pack_islands");
-   bool slim_skip_initialization = RNA_int_get(op->ptr, 
"slim_skip_initialization");
-   bool slim_fixed_boundary = RNA_int_get(op->ptr, "slim_fixed_boundary");
+   double slim_weight_influence = RNA_float_get(op->ptr, 
"slim_weight_influence");
 
const bool fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
const bool correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
@@ -1531,12 +1537,9 @@ static int unwrap_exec(bContext *C, wmOperator *op)
else
RNA_enum_set(op->ptr, "method", scene->toolsettings->unwrapper);
 
-   /* get number of iterations and methood in global phase for SLIM 
unwraping*/
+   /* get number of iterations and method in global phase for SLIM 
unwraping*/
scene->toolsettings->slim_n_iterations = n_slim_iterations;
-   scene->toolsettings->slim_fixed_boundary = slim_fixed_boundary;
-   scene->toolsettings->slim_pack_islands = slim_pack_islands;
-   scene->toolsettings->slim_skip_initialization = 
slim_skip_initialization;
-
+   scene->toolsettings->slim_weight_influence = slim_weight_influence;
 
/* remember packing marging */
if (RNA_struct_property_is_set(op->ptr, "margin"))
@@ -1600,12 +1603,8 @@ void UV_OT_unwrap(wmOperatorType *ot)
 
RNA_def_int(ot->srna, "slim_iterations", 1, 0, 1, "SLIM Iterations",
"Number of Iterations if the SLIM algorithm is 
used.", 1, 30);
-   RNA_def_boolean(ot->srna, "slim_skip_initialization", 0, "SLIM Skip 
Initialization",
-   "Use existing map as initialization for 
SLIM (May not contain flips!).");
-   RNA_def_boolean(ot->srna, "slim_fixed_boundary", 0, "SLIM Fix Boundary",
-   "When using SLIM and skipping 
initialization, this pins the boundary vertices to stay in place.");
-   RNA_def_boolean(ot->srna, "slim_pack_islands", 

[Bf-blender-cvs] [979b1b1159] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 979b1b1159ef78a286f79adaee5ca665e9a9f5e9
Author: Aurel Gruber
Date:   Tue Nov 15 13:20:40 2016 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB979b1b1159ef78a286f79adaee5ca665e9a9f5e9

Category: UV Unwrapping SLIM Algorithm Integration

Added SLIM Subfolder

===

M   .gitmodules
A   intern/SLIM

===

diff --git a/.gitmodules b/.gitmodules
index 0b8228e3f1..8abcc4584f 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -13,4 +13,4 @@
 [submodule "source/tools"]
path = source/tools
url = ../blender-dev-tools.git
-   ignore = all
+   ignore = all
\ No newline at end of file
diff --git a/intern/SLIM b/intern/SLIM
new file mode 16
index 00..fa4b84c7dd
--- /dev/null
+++ b/intern/SLIM
@@ -0,0 +1 @@
+Subproject commit fa4b84c7dd2aac4502887999f6b4ee9c524adedf

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3e184a57c5] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 3e184a57c5372fff6cd3415a56b394e993911907
Author: Aurel Gruber
Date:   Mon Jan 23 13:51:17 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB3e184a57c5372fff6cd3415a56b394e993911907

Category: UV Unwrapping SLIM Algorithm Integration

adding more members to phandle and creating param_begin

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 62a96ad0e8..7da79fe62d 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 62a96ad0e853e1008bd971272e5f79231cd4308c
+Subproject commit 7da79fe62d79adc1189fee09a96ecf592b92284a
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 0e3d343401..cc4511606e 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -241,6 +241,19 @@ typedef struct PHandle {
RNG *rng;
float blend;
char do_aspect;
+
+   // SLIM
+
+   matrix_transfer *mt;
+   int n_iterations;
+   bool skip_initialization;
+   bool fixed_boundary;
+   bool pack_islands;
+   bool with_weighted_parameterization;
+   MDeformVert *weightMapData;
+   int weightMapIndex;
+   BMesh *bm;
+
 } PHandle;
 
 /* PHash
@@ -4334,6 +4347,89 @@ void param_construct_end(ParamHandle *handle, ParamBool 
fill, ParamBool impl)
phandle->state = PHANDLE_STATE_CONSTRUCTED;
 }
 
+void add_index_to_vertices(BMEditMesh *em){
+
+   // AUREL THESIS iterate over bm edit mesh and set indices for weight 
retrieval,
+   //  This allows for later matching of 
vertices to weights.
+   BMVert *vert;
+   BMIter iter;
+   int i;
+   BM_ITER_MESH_INDEX(vert, , em->bm, BM_VERTS_OF_MESH, i){
+   vert->id = i;
+   }
+}
+
+int retrieve_weightmap_index(Object *obedit){
+   char *name = "slim";
+   return defgroup_name_index(obedit, name);
+}
+
+void param_slim_enrich_handle(Object *obedit,
+ BMEditMesh *em,
+ ParamHandle *handle,
+ matrix_transfer *mt,
+ MDeformVert *dvert,
+ int weightMapIndex,
+ int n_iterations,
+ bool 
skip_initialization,
+ bool fixed_boundary,
+ bool pack_islands,
+ bool 
with_weighted_parameterization){
+
+   PHandle *phandle = (PHandle *)handle;
+
+   phandle->mt = mt;
+   phandle->n_iterations = n_iterations;
+   phandle->skip_initialization = skip_initialization;
+   phandle->fixed_boundary = fixed_boundary;
+   phandle->pack_islands = pack_islands;
+   phandle->with_weighted_parameterization = 
with_weighted_parameterization;
+   phandle->weightMapData = dvert;
+   phandle->weightMapIndex = weightMapIndex;
+   phandle->bm = em->bm;
+}
+
+void param_begin(ParamHandle *handle, ParamBool abf, bool use_slim) {
+   if (use_slim){
+   param_slim_begin(handle);
+   } else {
+   param_lscm_begin(handle, PARAM_FALSE, abf);
+   }
+}
+
+void param_solve(ParamHandle *handle, bool use_slim) {
+   if (use_slim){
+   param_slim_solve(handle);
+   } else {
+   param_lscm_solve(handle);
+   }
+}
+
+void param_end(ParamHandle *handle, bool use_slim) {
+   if (use_slim){
+   param_slim_end(handle);
+   } else {
+   param_lscm_end(handle);
+   }
+}
+
+void param_slim_begin(ParamHandle *handle) {
+   transfer_data_to_slim(handle);
+}
+
+void param_slim_solve(ParamHandle *handle) {
+   PHandle *phandle = (PHandle *) handle;
+   matrix_transfer *mt = phandle->mt;
+   param_slim_C(mt, phandle->n_iterations, phandle->fixed_boundary, 
phandle->skip_initialization);
+}
+
+void param_slim_end(ParamHandle *handle) {
+   PHandle *phandle = (PHandle *) handle;
+   matrix_transfer *mt = phandle->mt;
+   set_uv_param_slim(handle, mt);
+}
+
+
 void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf)
 {
PHandle *phandle = (PHandle *)handle;
@@ -4716,18 +4812,34 @@ vo

[Bf-blender-cvs] [b6ab20876b] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: b6ab20876b08bb8e6f85253f6c569a3e5630c5ce
Author: Aurel Gruber
Date:   Thu Jan 19 16:03:34 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rBb6ab20876b08bb8e6f85253f6c569a3e5630c5ce

Category: UV Unwrapping SLIM Algorithm Integration

preserving vertex ids and gathering weights

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index e897ae04d5..62a96ad0e8 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit e897ae04d52607970344a601fc85c1329f2314ed
+Subproject commit 62a96ad0e853e1008bd971272e5f79231cd4308c
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 759af69fd3..0e3d343401 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -744,7 +744,7 @@ static void p_face_restore_uvs(PFace *f)
 
 /* Construction (use only during construction, relies on u.key being set */
 
-static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], 
PEdge *e)
+static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], 
float id, PEdge *e)
 {
PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof(*v));
copy_v3_v3(v->co, co);
@@ -761,20 +761,21 @@ static PVert *p_vert_add(PHandle *handle, PHashKey key, 
const float co[3], PEdge
v->u.key = key;
v->edge = e;
v->flag = 0;
+   v->slimId = id;
 
phash_insert(handle->hash_verts, (PHashLink *)v);
 
return v;
 }
 
-static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], 
PEdge *e)
+static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], 
float id, PEdge *e)
 {
PVert *v = (PVert *)phash_lookup(handle->hash_verts, key);
 
if (v)
return v;
else
-   return p_vert_add(handle, key, co, e);
+   return p_vert_add(handle, key, co, id, e);
 }
 
 static PVert *p_vert_copy(PChart *chart, PVert *v)
@@ -1115,15 +1116,15 @@ static PFace *p_face_add(PHandle *handle)
 }
 
 static PFace *p_face_add_construct(PHandle *handle, ParamKey key, ParamKey 
*vkeys,
-   float *co[4], float *uv[4], int i1, int i2, 
int i3,
+   float *co[4], float *uv[4], float id[4], 
int i1, int i2, int i3,
ParamBool *pin, ParamBool *select)
 {
PFace *f = p_face_add(handle);
PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 
-   e1->vert = p_vert_lookup(handle, vkeys[i1], co[i1], e1);
-   e2->vert = p_vert_lookup(handle, vkeys[i2], co[i2], e2);
-   e3->vert = p_vert_lookup(handle, vkeys[i3], co[i3], e3);
+   e1->vert = p_vert_lookup(handle, vkeys[i1], co[i1], id[i1], e1);
+   e2->vert = p_vert_lookup(handle, vkeys[i2], co[i2], id[i2], e2);
+   e3->vert = p_vert_lookup(handle, vkeys[i3], co[i3], id[i3], e3);
 
e1->orig_uv = uv[i1];
e2->orig_uv = uv[i2];
@@ -4174,7 +4175,7 @@ void param_delete(ParamHandle *handle)
 }
 
 static void p_add_ngon(ParamHandle *handle, ParamKey key, int nverts,
-   ParamKey *vkeys, float **co, float **uv,
+   ParamKey *vkeys, float **co, float **uv, float *id,
ParamBool *pin, ParamBool *select, const float 
normal[3])
 {
int *boundary = BLI_array_alloca(boundary, nverts);
@@ -4229,10 +4230,11 @@ static void p_add_ngon(ParamHandle *handle, ParamKey 
key, int nverts,
ParamKey tri_vkeys[3] = {vkeys[v0], vkeys[v1], 
vkeys[v2]};
float *tri_co[3] = {co[v0], co[v1], co[v2]};
float *tri_uv[3] = {uv[v0], uv[v1], uv[v2]};
+   float tri_id[3] = {id[v0], id[v1], id[v2]};
ParamBool tri_pin[3] = {pin[v0], pin[v1], pin[v2]};
ParamBool tri_select[3] = {select[v0], select[v1], 
select[v2]};
 
-   param_face_add(handle, key, 3, tri_vkeys, tri_co, 
tri_uv, tri_pin, tri_select, NULL);
+   param_face_add(handle, key, 3, tri_vkeys, tri_co, 
tri_uv, tri_id, tri_pin, tri_select, NULL);
}
 
/* remove corner */
@@ -4244,7 +4246,7 @@ static void p_add_ngon(ParamHandle *handle, ParamKey key, 
int nverts,
 }
 
 void param_face_add(ParamHandle *handle, ParamKey key, int nverts,
-ParamKey *vkeys, float *co[4], float *uv[4],
+ParamKey *vkeys, float *co[4], float *uv[4], float id[4

[Bf-blender-cvs] [88a327d3ed] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 88a327d3edeb325c59d60110d553122727c41fa0
Author: Aurel Gruber
Date:   Fri Feb 10 17:13:03 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB88a327d3edeb325c59d60110d553122727c41fa0

Category: UV Unwrapping SLIM Algorithm Integration

taking care of memory leaks

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/intern/SLIM b/intern/SLIM
index 8c6ee9dbdc..8686b499ce 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 8c6ee9dbdc60a9e2c3543eec38e71f9ca4fcd971
+Subproject commit 8686b499ce3f23d537e1e56ab91412bc0b2aefb3
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 1459f9d45c..472e293d8a 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4428,6 +4428,7 @@ void param_slim_end(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
set_uv_param_slim(handle, mt);
+   free_matrix_transfer(mt);
 }
 
 
@@ -4874,6 +4875,8 @@ void convert_blender_slim(ParamHandle *handle, bool 
selectionOnly, int weightMap
mt->Pmatrices[chartNr] = 
MEM_reallocN_id(mt->Pmatrices[chartNr], mt->nPinnedVertices[chartNr] * 
sizeof(**mt->Pmatrices), " Pinned-Vertex Matrix");
mt->Bvectors[chartNr] = MEM_reallocN_id(mt->Bvectors[chartNr], 
mt->nBoundaryVertices[chartNr] * sizeof(**mt->Bvectors), " boundary-Vertex 
Matrix");
mt->Ematrices[chartNr] = 
MEM_reallocN_id(mt->Ematrices[chartNr], (mt->nEdges[chartNr] + 
mt->nBoundaryVertices[chartNr]) * 2 * sizeof(**mt->Ematrices), " 
boundarys-Vertex Matrix");
+
+   MEM_freeN(tempW);
}
 
if (mt->nPinnedVertices > 0){
@@ -5164,17 +5167,31 @@ void free_matrix_transfer(matrix_transfer *mt){
MEM_freeN(mt->Vmatrices[chartNr]);
MEM_freeN(mt->UVmatrices[chartNr]);
MEM_freeN(mt->Fmatrices[chartNr]);
-
+   MEM_freeN(mt->PPmatrices[chartNr]);
+   MEM_freeN(mt->ELvectors[chartNr]);
+   MEM_freeN(mt->Wvectors[chartNr]);
+   MEM_freeN(mt->Pmatrices[chartNr]);
+   MEM_freeN(mt->Ematrices[chartNr]);
+   MEM_freeN(mt->Bvectors[chartNr]);
}
 
-   MEM_freeN(mt->nVerts);
-   MEM_freeN(mt->nFaces);
-   MEM_freeN(mt->nPinnedVertices);
+
MEM_freeN(mt->Vmatrices);
MEM_freeN(mt->UVmatrices);
MEM_freeN(mt->Fmatrices);
-   MEM_freeN(mt->Pmatrices);
MEM_freeN(mt->PPmatrices);
+   MEM_freeN(mt->ELvectors);
+   MEM_freeN(mt->Wvectors);
+   MEM_freeN(mt->Pmatrices);
+   MEM_freeN(mt->Ematrices);
+   MEM_freeN(mt->Bvectors);
+
+   MEM_freeN(mt->nVerts);
+   MEM_freeN(mt->nFaces);
+   MEM_freeN(mt->nPinnedVertices);
+   MEM_freeN(mt->nBoundaryVertices);
+   MEM_freeN(mt->nEdges);
+
MEM_freeN(mt);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index ed5b10a594..2a3abaa35c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -175,7 +175,9 @@ void convert_blender_slim(ParamHandle *handle, bool 
selectionOnly, int weightMap
 void set_uv_param_slim(ParamHandle *handle, matrix_transfer *mt);
 bool transformIslands(ParamHandle *handle);
 bool mark_pins(ParamHandle *paramHandle);
-
+void add_index_to_vertices(BMEditMesh *em);
+void free_matrix_transfer(matrix_transfer *mt);
+   
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 5920ecfecd..ccce5ca230 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -787,9 +787,6 @@ typedef struct {
bool noPins;
 } MinStretchSlim;
 
-void add_index_to_vertices(BMEditMesh *em);
-void free_matrix_transfer(matrix_transfer *mt);
-
 /* AUREL THESIS
Initialises SLIM and transfars data matrices
  */
@@ -865,6 +862,12 @@ static void minimize_stretch_SLIM_iteration(bContext *C, 
wmOperator *op, bool in
WM_event_add_notifier(C, NC_GEOM | ND_DATA, mss->obedit->data);
 }
 
+void free_slimPtrs(void **slimPtrs, int nCharts){
+   for (int i = 0; i<nCharts; i++){
+   free_slim_data_C(slimPtrs[i]);
+   }
+}
+
 /* 

[Bf-blender-cvs] [26fd7e084f] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 26fd7e084fdfa18354f6ad5fc420fbc6f955c013
Author: Aurel Gruber
Date:   Wed Feb 22 12:06:21 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB26fd7e084fdfa18354f6ad5fc420fbc6f955c013

Category: UV Unwrapping SLIM Algorithm Integration

adding relative scale, reflection mode and Vertex group input

===

M   intern/SLIM
M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/intern/SLIM b/intern/SLIM
index 8686b499ce..cffc347ba2 16
--- a/intern/SLIM
+++ b/intern/SLIM
@@ -1 +1 @@
-Subproject commit 8686b499ce3f23d537e1e56ab91412bc0b2aefb3
+Subproject commit cffc347ba26c31b04f9080916b99b1e603d4ee5c
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 472e293d8a..6ff5176491 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -253,6 +253,7 @@ typedef struct PHandle {
MDeformVert *weightMapData;
int weightMapIndex;
double weightInfluence;
+   double relative_scale;
BMesh *bm;
 
 } PHandle;
@@ -4360,9 +4361,8 @@ void add_index_to_vertices(BMEditMesh *em){
}
 }
 
-int retrieve_weightmap_index(Object *obedit){
-   char *name = "slim";
-   return defgroup_name_index(obedit, name);
+int retrieve_weightmap_index(Object *obedit, char *vertex_group){
+   return defgroup_name_index(obedit, vertex_group);
 }
 
 void param_slim_enrich_handle(Object *obedit,
@@ -4372,6 +4372,7 @@ void param_slim_enrich_handle(Object *obedit,
  MDeformVert *dvert,
  int weightMapIndex,
  double 
weightInfluence,
+ double relative_scale,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
@@ -4387,6 +4388,7 @@ void param_slim_enrich_handle(Object *obedit,
phandle->weightMapData = dvert;
phandle->weightMapIndex = weightMapIndex;
phandle->weightInfluence = weightInfluence;
+   phandle->relative_scale = relative_scale;
phandle->bm = em->bm;
 }
 
@@ -4428,7 +4430,6 @@ void param_slim_end(ParamHandle *handle) {
PHandle *phandle = (PHandle *) handle;
matrix_transfer *mt = phandle->mt;
set_uv_param_slim(handle, mt);
-   free_matrix_transfer(mt);
 }
 
 
@@ -4835,6 +4836,7 @@ void transfer_data_to_slim(ParamHandle *handle){
mt->transform_islands = true;
mt->with_weighted_parameterization = 
phandle->with_weighted_parameterization;
mt->weight_influence = phandle->weightInfluence;
+   mt->relative_scale = phandle->relative_scale;
convert_blender_slim(handle, false, phandle->weightMapIndex);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 2a3abaa35c..8dcaf952ed 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -90,7 +90,7 @@ void param_delete(ParamHandle *chart);
  */
 
 void add_index_to_vertices(BMEditMesh *em);
-int retrieve_weightmap_index(Object *obedit);
+int retrieve_weightmap_index(Object *obedit, char *vertex_group);
 void param_slim_enrich_handle(Object *obedit,
  BMEditMesh *em,
  ParamHandle *handle,
@@ -98,6 +98,7 @@ void param_slim_enrich_handle(Object *obedit,
  MDeformVert *dvert,
  int weightMapIndex,
  double 
weightInfluence,
+ double relative_scale,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index ccce5ca230..db56fc9399 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedi

[Bf-blender-cvs] [9c55a8374e] uv_unwrapping_slim_algorithm: Category: UV Unwrapping SLIM Algorithm Integration

2017-02-23 Thread Aurel Gruber
Commit: 9c55a8374ef257c610027750ee6d3c1cf95cd360
Author: Aurel Gruber
Date:   Tue Jan 31 13:58:43 2017 +0100
Branches: uv_unwrapping_slim_algorithm
https://developer.blender.org/rB9c55a8374ef257c610027750ee6d3c1cf95cd360

Category: UV Unwrapping SLIM Algorithm Integration

adding weightinfluence

===

M   source/blender/editors/uvedit/uvedit_parametrizer.c
M   source/blender/editors/uvedit/uvedit_parametrizer.h
M   source/blender/editors/uvedit/uvedit_unwrap_ops.c

===

diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index ea8bf4df4a..1459f9d45c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -252,6 +252,7 @@ typedef struct PHandle {
bool with_weighted_parameterization;
MDeformVert *weightMapData;
int weightMapIndex;
+   double weightInfluence;
BMesh *bm;
 
 } PHandle;
@@ -4370,6 +4371,7 @@ void param_slim_enrich_handle(Object *obedit,
  matrix_transfer *mt,
  MDeformVert *dvert,
  int weightMapIndex,
+ double 
weightInfluence,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
@@ -4384,6 +4386,7 @@ void param_slim_enrich_handle(Object *obedit,
phandle->with_weighted_parameterization = 
with_weighted_parameterization;
phandle->weightMapData = dvert;
phandle->weightMapIndex = weightMapIndex;
+   phandle->weightInfluence = weightInfluence;
phandle->bm = em->bm;
 }
 
@@ -4830,6 +4833,7 @@ void transfer_data_to_slim(ParamHandle *handle){
mt->pinned_vertices = false;
mt->transform_islands = true;
mt->with_weighted_parameterization = 
phandle->with_weighted_parameterization;
+   mt->weight_influence = phandle->weightInfluence;
convert_blender_slim(handle, false, phandle->weightMapIndex);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h 
b/source/blender/editors/uvedit/uvedit_parametrizer.h
index bb5b9e16f4..ed5b10a594 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -97,6 +97,7 @@ void param_slim_enrich_handle(Object *obedit,
  matrix_transfer *mt,
  MDeformVert *dvert,
  int weightMapIndex,
+ double 
weightInfluence,
  int n_iterations,
  bool 
skip_initialization,
  bool pack_islands,
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c 
b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index a19336643e..247c43c4c5 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -530,6 +530,7 @@ void enrich_handle_slim(Scene *scene, Object *obedit, 
BMEditMesh *em, ParamHandl
int n_iterations = scene->toolsettings->slim_n_iterations;
bool skip_initialization = 
scene->toolsettings->slim_skip_initialization;
bool pack_islands = scene->toolsettings->slim_pack_islands;
+   double weight_influence = scene->toolsettings->slim_weight_influence;
 
MDeformVert *weightMapData = NULL;
 
@@ -545,6 +546,7 @@ void enrich_handle_slim(Scene *scene, Object *obedit, 
BMEditMesh *em, ParamHandl
 mt,
 weightMapData,
 weightMapIndex,
+weight_influence,
 n_iterations,
 skip_initialization,
 pack_islands,
@@ -813,7 +815,7 @@ static bool minimize_stretch_SLIM_init(bContext *C, 
wmOperator *op)
scene->toolsettings->slim_skip_initialization = true;
scene->toolsettings->slim_pack_islands = false;
scene->toolsettings->slim_fixed_boundary = true;
-