[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49676] branches/soc-2012-bratwurst/source /blender: Cleanup, remove isomap old O(n^4) distance calculation method

Antony Riakiotakis kalast at gmail.com
Wed Aug 8 02:52:14 CEST 2012


Revision: 49676
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49676
Author:   psy-fi
Date:     2012-08-08 00:52:14 +0000 (Wed, 08 Aug 2012)
Log Message:
-----------
Cleanup, remove isomap old O(n^4) distance calculation method

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/editors/uvedit/uvedit_parametrizer.c
    branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c

Modified: branches/soc-2012-bratwurst/source/blender/editors/uvedit/uvedit_parametrizer.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/uvedit/uvedit_parametrizer.c	2012-08-07 23:10:18 UTC (rev 49675)
+++ branches/soc-2012-bratwurst/source/blender/editors/uvedit/uvedit_parametrizer.c	2012-08-08 00:52:14 UTC (rev 49676)
@@ -3078,66 +3078,20 @@
 
 static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
 {
-
-	//#define OLD_DIST_CONSTRUCTION
 	enum UnwrapMethods method = handle->method;
 
 	if (method == UNWRAP_ISOMAP) {
-		PEdge *e;
 		PVert *v;
 		int nverts = chart->nverts;
-		int i, j, k, l;
+		int i, j;
 
 		/* create matrix with squared edge distances */
 		float *dist_map = MEM_mallocN(sizeof(*dist_map)*nverts*nverts, "isomap_distance_map");
-		#ifndef OLD_DIST_CONSTRUCTION
 		GraphVertInfo *visited = MEM_mallocN(nverts*sizeof(*visited), "isomap_visited_flags");
 		Heap *graph_heap = BLI_heap_new();
-		#endif
 
 		param_isomap_new_solver(nverts);
 
-		#ifdef OLD_DIST_CONSTRUCTION
-		/* initialize every point to "infinity" according to the paper.
-		 * since this will make every inner product give infinity as well, initialize to some
-		 * large number instead */
-		for (i = 0; i < nverts; i++)
-			for (j = 0; j < nverts; j++) {
-				dist_map[i*nverts + j] = (i == j)? 0 : MAXFLOAT;
-			}
-
-		/* for each edge, put the squared distance to the appropriate matrix positions */
-		for (e = chart->edges; e; e = e->nextlink) {
-			/* fill the upper right part of the matrix */
-			dist_map[e->vert->u.id*nverts + e->next->vert->u.id] =
-			dist_map[e->next->vert->u.id*nverts + e->vert->u.id] =
-			        p_edge_length(e);
-		}
-
-		/* now edge length has been computed. Construct shortest paths
-		 * and run the algorithm nverts times to eventually calculate shortest
-		 * paths between all verts. This is a silly way to do this and will probably be optimized
-		 * if i go on working on this. */
-		for (l = 0; l < nverts; l++) {
-			for (i = 0; i < nverts; i++) {
-				for (j = 0; j < nverts; j++) {
-					for (k = 0; k < nverts; k++) {
-						float sum_dist = dist_map[i*nverts + k] + dist_map[k*nverts + j];
-
-						dist_map[i*nverts + j] = dist_map[j*nverts + i] = minf(dist_map[i*nverts + j], sum_dist);
-					}
-				}
-			}
-		}
-
-		/* square distances */
-		for (i = 0; i < nverts; i++) {
-			for (j = 0; j < nverts; j++) {
-				dist_map[i*nverts + j] *=  dist_map[i*nverts + j];
-			}
-		}
-		#else
-
 		/* initialize graph distances */
 		for (i = 0; i < nverts; i++) {
 			for (j = 0; j < i + 1; j++) {
@@ -3246,8 +3200,6 @@
 		BLI_heap_free(graph_heap, NULL);
 		MEM_freeN(visited);
 
-		#endif
-
 		if(!param_isomap_solve(dist_map)) {
 			param_isomap_delete_solver();
 			MEM_freeN(dist_map);

Modified: branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c	2012-08-07 23:10:18 UTC (rev 49675)
+++ branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_space.c	2012-08-08 00:52:14 UTC (rev 49676)
@@ -2086,7 +2086,7 @@
 	RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
 
 	prop = RNA_def_property(srna, "show_maskedit", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_maskedit_get", NULL);
+	RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_maskedit_get", NULL, NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Show Mask Editor", "Show Mask editing related properties");
 




More information about the Bf-blender-cvs mailing list