Commit 375dc28a authored by GoshaZotov's avatar GoshaZotov

change order drawing edges

parent 019ceb58
...@@ -12032,100 +12032,68 @@ CSortFaces.prototype = ...@@ -12032,100 +12032,68 @@ CSortFaces.prototype =
} }
var g = res2;
var color = {}; // цвет вершины (0, 1, или 2)
var time_in = {}, time_out = {}; // "времена" захода и выхода из вершины
var dfs_timer = 0;
/*var getFirst = function() var dfs = function(v)
{ {
var result = null; time_in[v] = dfs_timer++;
for(var i = 0; i < cubs.length; i++) color[v] = 1;
for (var i in g[v])
{ {
if((res[i] === undefined || res[i].length === 0) && !firstArr[i]) if (!color[i])
{ {
result = parseInt(i); dfs (i);
break;
} }
} }
return result;
}; color[v] = 2;
time_out[v] = dfs_timer++;
}
var getLast = function() for(var i = 0; i < startIndexs.length; i++)
{ {
var result = null; dfs(startIndexs[i].index);
for(var i = 0; i < cubs.length; i++) }
{
if((res2[i] === undefined || res2[i].length === 0) && !firstArr[i])
{
result = parseInt(i);
break;
}
}
return result;
};
var cleanStartIndex = function(startIndex)
{
res2.splice(startIndex, 1);
for(var i = 0; i < res.length; i++)
{
if(res[i] && res[i][startIndex])
{
res[i].splice(startIndex, 1);
}
}
};
var cleanLastIndex = function(lastIndex) var addIndexes = {};
var getMax = function()
{ {
res.splice(lastIndex, 1); var max = 0;
for(var i = 0; i < res2.length; i++) var res = null;
for(var i in time_out)
{ {
if(res2[i] && res2[i][lastIndex]) if(!addIndexes[i] && time_out[i] > max)
{ {
res2[i].splice(lastIndex, 1); max = time_out[i];
res = i;
} }
} }
return res;
}; };
var firstMainArray = []; var i = 0;
var lastMainArray = []; var test = [];
var firstArr = {};
var lastArr = {};
var arr1 = [];
var arr2 = [];
while(true) while(true)
{ {
var startIndex = getFirst(); var index = getMax();
var lastIndex = getLast();
if(null !== startIndex) if(null === index)
{
firstMainArray.push({nextIndex: startIndex});
}
if(null !== lastIndex)
{
lastMainArray.push({nextIndex: lastIndex});
}
firstArr[startIndex] = 1;
firstArr[lastIndex] = 1;
cleanStartIndex(startIndex);
cleanLastIndex(lastIndex);
if(res.length === 0 && res2.length === 0)
{ {
break; break;
} }
test.push({nextIndex: index});
addIndexes[index] = 1;
} }
lastMainArray = lastMainArray.reverse()
var mainTest = lastMainArray.concat(firstMainArray);*/
//return mainTest;
return test.reverse(); return test.reverse();
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment