﻿<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AShuvro%2Fsoc2011%2Fcodedocs</id>
	<title>利用者:Shuvro/soc2011/codedocs - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.blender.jp/index.php?action=history&amp;feed=atom&amp;title=%E5%88%A9%E7%94%A8%E8%80%85%3AShuvro%2Fsoc2011%2Fcodedocs"/>
	<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Shuvro/soc2011/codedocs&amp;action=history"/>
	<updated>2026-11-27T08:54:34Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.31.0</generator>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Shuvro/soc2011/codedocs&amp;diff=106125&amp;oldid=prev</id>
		<title>Yamyam: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Shuvro/soc2011/codedocs&amp;diff=106125&amp;oldid=prev"/>
		<updated>2018-06-28T19:45:07Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2018年6月28日 (木) 19:45時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Yamyam</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Shuvro/soc2011/codedocs&amp;diff=106124&amp;oldid=prev</id>
		<title>2011年8月22日 (月) 18:59にwiki&gt;Shuvroによる</title>
		<link rel="alternate" type="text/html" href="https://wiki.blender.jp/index.php?title=%E5%88%A9%E7%94%A8%E8%80%85:Shuvro/soc2011/codedocs&amp;diff=106124&amp;oldid=prev"/>
		<updated>2011-08-22T18:59:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Development Documentation =&lt;br /&gt;
&lt;br /&gt;
This needs to be added:&lt;br /&gt;
* How do we detect that a componenent is connected&lt;br /&gt;
* What do we do to generate the seam? &lt;br /&gt;
* What do we calculate the Eigenvalues for?&lt;br /&gt;
* How are the Eigenvectors used to find a split of the mesh?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Notes about the algorithm  ==&lt;br /&gt;
&lt;br /&gt;
=== Getting connected component of the meshes ===&lt;br /&gt;
&lt;br /&gt;
To do that, first of all we considered each face of the mesh as a node of a Graph. We run the Depth first search algorithm for the whole mesh until all of the faces of the mesh is visited. Each call of the depth first algorithm visited some new unvisited nodes. These nodes form a connected component of the&lt;br /&gt;
mesh. Later on, we run our algorithm for each of the components separately.&lt;br /&gt;
&lt;br /&gt;
=== The main approach for generating the seam ===&lt;br /&gt;
&lt;br /&gt;
In order to generate seam, in short, we calculated connected components of each mesh. For each connected component we calculated graph laplacian matrix. We calculated eigenspace (eigenvalues, eigenvectors) for the laplacian matrix. Each eigen vector separates a component of the mesh into two parts. In one set there resides the faces having positive eigen value and in another set there reside faces with negative eigen values. Now, if the faces having positive eigen values are connected and the faces having negative values are connected we can consider the corresponding vector as a candidate for solution. Each such eigen vector separate a component into two parts if we draw a line between the connected positive eigen valued faces and negative eigen valued faces. We can call the line seam. From all candidate eigen vectors, the one that generates the seam with the maximum length is our desired seam.&lt;br /&gt;
&lt;br /&gt;
=== The reason behind calculating eigen values ===&lt;br /&gt;
&lt;br /&gt;
In short, we calculated eigen values of the laplacian matrix of the mesh in order to encode the semantic information of mesh into the eigenspace. By doing so, we are getting a numerical representation of the semantic information of the mesh. With this avialable, we have the scope to do operation on it to get our desired result.&lt;br /&gt;
&lt;br /&gt;
=== How are the Eigenvectors used to find a split of the mesh? ===&lt;br /&gt;
&lt;br /&gt;
I think this is already discussed in section 1.1.1.2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Milestones ==&lt;br /&gt;
* Write a wrapper API for Eigen3 library.&lt;br /&gt;
* Generate Laplacian matrix and calculate Eigenspace.&lt;br /&gt;
* Implement algorithm for marking seam/seams.&lt;br /&gt;
* Integrate the seam unwrap functionality with the added code.&lt;br /&gt;
* Handle some special cases and draw UI.&lt;br /&gt;
* Implementation of a Sparse Matrix module.&lt;br /&gt;
* Integration of ARPACK library to solve Eigenspace for large matrix.&lt;br /&gt;
* Implement a extendible eigen solver class and extend it for eigen library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Write a wrapper API for Eigen3 library ===&lt;br /&gt;
Currently we are using Eigen3 library for eigenvalue calculation. Which can only calculate eigen values of small matrixes. We are using this for now just to implement the basic algorthm first. This library is written in C++. So, to use it&amp;#039;s functionality we have to write a wrapper API for this library. Here, I am showing only how to use the wrapper.&lt;br /&gt;
&lt;br /&gt;
To create a n*n zero valued matrix:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
AUTOSEAM_Adjacency adj;&lt;br /&gt;
adj = autoseam_create_adjacency(n);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To set a value of the element with index (m,n):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
float value = 3.0;&lt;br /&gt;
autoseam_set_adjacent(m, n, value);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To generate seam and get the split of face indexes in fplus and fminus array:&lt;br /&gt;
&amp;lt;source lang = &amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
AUTOSEAM_Adjacency adj;&lt;br /&gt;
int s;&lt;br /&gt;
&lt;br /&gt;
autoseam_generate_seam(adj);&lt;br /&gt;
s = autoseam_get_best_split(adj);&lt;br /&gt;
autoseam_get_split(adj, s, fplus, &amp;amp;nplus, fminus, &amp;amp;nminus);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Generate Laplacian matrix and calculate Eigenspace ===&lt;br /&gt;
&lt;br /&gt;
Let, ( V, E , F ) be the V  vertices, E  edges and F facets sets of a structured polygonal mesh. Calculate dual graph of the mesh G( &amp;lt;math&amp;gt;F^*&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;E^*&amp;lt;/math&amp;gt; ). &lt;br /&gt;
&lt;br /&gt;
Where,&lt;br /&gt;
* &amp;lt;math&amp;gt;F^*&amp;lt;/math&amp;gt; = The vertices of the dual graph &lt;br /&gt;
* &amp;lt;math&amp;gt;E^*&amp;lt;/math&amp;gt; = The edges of the dual graph&lt;br /&gt;
Now, calculate martrix A which is the adjacency matrix of graph G. Compute another diagonal matrix D where,&lt;br /&gt;
* &amp;lt;math&amp;gt;D_{ii}&amp;lt;/math&amp;gt; = &amp;lt;math&amp;gt;i^{th}&amp;lt;/math&amp;gt; row sum of G.&lt;br /&gt;
The Laplacian matrix L is -&lt;br /&gt;
* &amp;lt;math&amp;gt; L = A - D&amp;lt;/math&amp;gt;&lt;br /&gt;
After this, the Eigenspace of L is calculated.&lt;br /&gt;
&lt;br /&gt;
The function that calculates the dual graph of the selected mesh is -&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang= &amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*@main parameters:&lt;br /&gt;
 * adj             : AUTOSEAM_Adjacency instance&lt;br /&gt;
 * bm              : selected mesh&lt;br /&gt;
 * is_combinatorial: act as boolean, it set from the UI&lt;br /&gt;
 */&lt;br /&gt;
autoseam_create_graph(adj, bm, is_combinatorial, -1, NULL, 1);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implement algorithm for marking seam/seams ===&lt;br /&gt;
The main functions related to algorithm of marking seams is described in this section with the top level flow of the algorithm.&lt;br /&gt;
&lt;br /&gt;
* Get connected components of the mesh and call the seam generation algorithm for each component. The function signature to do this is -&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*@parameters:&lt;br /&gt;
 * adj             : AUTOSEAM_Adjacency instance&lt;br /&gt;
 * num_nodes       : number of faces in the passed component&lt;br /&gt;
 * bm              : instance of the mesh&lt;br /&gt;
 * recursion_depth : How far the recursion will go, set from UI&lt;br /&gt;
 * C               : bContext of the operator&lt;br /&gt;
 */&lt;br /&gt;
int handle_separate_components(AUTOSEAM_Adjacency adj, int num_nodes, BMesh *bm, int recursion_depth, bContext *C);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Call a recursive function that will generate the seam recursively up to a given depth set by the user from the UI. The function that does this is -&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang = &amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*@parameters:&lt;br /&gt;
 * bm              : instance of the mesh&lt;br /&gt;
 * adj             : adjacency matrix of the current portion of mesh&lt;br /&gt;
 * adj_big         : adjacency matrix of the main mesh&lt;br /&gt;
 * recursion_depth : How far the recursion will go, set from UI&lt;br /&gt;
 * C               : bContext instance of the operator&lt;br /&gt;
 * stretch         : stretch value for the whole mesh&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
int generate_seam_recursive(BMesh *bm, AUTOSEAM_Adjacency adj, AUTOSEAM_Adjacency adj_big, int recursion_depth, bContext *C, float stretch)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Integrate the seam unwrap functionality with the added code ===&lt;br /&gt;
&lt;br /&gt;
This portion was pretty straightforward. We just integrated the existing seam unwrapping functionalities. This integration allows the operator to unwrap the marked seams in one go. The code snippet that does this is given below -&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang = &amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* add uvs if they don&amp;#039;t exist yet */&lt;br /&gt;
if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {&lt;br /&gt;
    return OPERATOR_CANCELLED;&lt;br /&gt;
}&lt;br /&gt;
	&lt;br /&gt;
/* remember last method for live unwrap */&lt;br /&gt;
scene-&amp;gt;toolsettings-&amp;gt;unwrapper = method;&lt;br /&gt;
if(fill_holes)	scene-&amp;gt;toolsettings-&amp;gt;uvcalc_flag |=  UVCALC_FILLHOLES;&lt;br /&gt;
else            scene-&amp;gt;toolsettings-&amp;gt;uvcalc_flag &amp;amp;= ~UVCALC_FILLHOLES;&lt;br /&gt;
	&lt;br /&gt;
if(correct_aspect) scene-&amp;gt;toolsettings-&amp;gt;uvcalc_flag&amp;amp;=~UVCALC_NO_ASPECT_CORRECT;&lt;br /&gt;
else   scene-&amp;gt;toolsettings-&amp;gt;uvcalc_flag |=  UVCALC_NO_ASPECT_CORRECT;&lt;br /&gt;
    &lt;br /&gt;
ED_unwrap_lscm(scene, obedit, TRUE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Handle some special cases and draw UI ===&lt;br /&gt;
&lt;br /&gt;
There were some special case in generating seams. For example, a mesh has some non-connected selected components. So, in case of generating seams we need to generate seams for all of the selected components. Moreover, a selected component can have hole inside it. We also handled this case in our code. While generating seams there should be some space between the generated seams to aid texturing. It&amp;#039;s already implemented in Blender Smart UV Project and known ase &amp;#039;Island Margin&amp;#039; feature. We have integrated this functionality with our operator. And the user interface for using the operator is drawn with the blender python API.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation of a Sparse Matrix module ===&lt;br /&gt;
&lt;br /&gt;
If we represent the meshes as matrix in most of the case they will be sparse matrixes. So, for the computational and storage efficiency it is better for us to store them in Sparse Matrix. It will also needed in efficient Matrix-Vector product calculation which is used a lot of times while calculating eigenspace with the eigen solvers. That&amp;#039;s why we implemented a class for storing geometric representation of mesh in SparseMatrix.h. We used the Compressed Row Storage (CRS) data structure in our implementation. In short, the Compressed Row Storage (CRS) format puts the subsequent nonzeros of the matrix rows in contiguous memory locations. More information about it can be found here - http://netlib.org/linalg/html_templates/node91.html&lt;br /&gt;
&lt;br /&gt;
=== Integration of ARPACK library to solve Eigenspace for large matrix ===&lt;br /&gt;
&lt;br /&gt;
Done.&lt;br /&gt;
&lt;br /&gt;
===Implement a extendible eigen solver class and extend it for eigen library ===&lt;br /&gt;
&lt;br /&gt;
Done.&lt;/div&gt;</summary>
		<author><name>wiki&gt;Shuvro</name></author>
		
	</entry>
</feed>