More robust primary symmetry axis algorithm (support branch in two)

Draw primary axis and weight delta
This commit is contained in:
2008-06-23 21:47:31 +00:00
parent 488fa13fc0
commit c0daf62733
4 changed files with 292 additions and 197 deletions

View File

@@ -695,9 +695,14 @@ static void markdownSecondarySymmetry(BGraph *graph, BNode *node, int depth, int
void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level, float limit)
{
int i;
arc->symmetry_level = level;
node = BLI_otherNode(arc, node);
/* if arc is null, we start straight from a node */
if (arc)
{
arc->symmetry_level = level;
node = BLI_otherNode(arc, node);
}
for (i = 0; i < node->degree; i++)
{
@@ -727,7 +732,7 @@ void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level, float
/* true by default */
issymmetryAxis = 1;
for (j = 0; j < node->degree && issymmetryAxis == 1; j++)
for (j = 0; j < node->degree; j++)
{
BArc *otherArc = node->arcs[j];
@@ -736,6 +741,7 @@ void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level, float
{
/* not on the symmetry axis */
issymmetryAxis = 0;
break;
}
}
}
@@ -748,11 +754,10 @@ void markdownSymmetryArc(BGraph *graph, BArc *arc, BNode *node, int level, float
{
arc = connectedArc;
}
else
else if (connectedArc->symmetry_level < arc->symmetry_level)
{
/* there can't be more than one symmetry arc */
arc = NULL;
break;
/* go with more complex subtree as symmetry arc */
arc = connectedArc;
}
}
}
@@ -796,12 +801,21 @@ void BLI_markdownSymmetry(BGraph *graph, BNode *root_node, float limit)
node = root_node;
/* only work on acyclic graphs and if only one arc is incident on the first node */
if (node->degree == 1)
/* sanity check REMOVE ME */
if (node->degree > 0)
{
arc = node->arcs[0];
markdownSymmetryArc(graph, arc, node, 1, limit);
if (node->degree == 1)
{
markdownSymmetryArc(graph, arc, node, 1, limit);
}
else
{
markdownSymmetryArc(graph, NULL, node, 1, limit);
}
/* mark down non-symetric arcs */
for (arc = graph->arcs.first; arc; arc = arc->next)

View File

@@ -841,6 +841,7 @@ typedef struct Scene {
#define SKGEN_HARMONIC 64
#define SKGEN_STICK_TO_EMBEDDING 128
#define SKGEN_ADAPTIVE_DISTANCE 512
#define SKGEN_FILTER_SMART 1024
#define SKGEN_SUB_LENGTH 0
#define SKGEN_SUB_ANGLE 1

View File

@@ -5021,9 +5021,10 @@ static void editing_panel_mesh_skgen_retarget(Object *ob, Mesh *me)
uiDefButS(block, NUM, B_DIFF, "Resolution:", 1025,150,225,19, &G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0, "Specifies the resolution of the graph's embedding");
uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF, "H", 1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Apply harmonic smoothing to the weighting");
uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In", 1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter internal small arcs from graph");
uiDefButF(block, NUM, B_DIFF, "T:", 1111,130,164,19, &G.scene->toolsettings->skgen_threshold_internal,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering internal arcs");
uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex", 1025,110, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter external small arcs from graph");
uiDefButF(block, NUM, B_DIFF, "T:", 1111,110,164,19, &G.scene->toolsettings->skgen_threshold_external,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering external arcs");
uiDefButF(block, NUM, B_DIFF, "", 1111,130,164,19, &G.scene->toolsettings->skgen_threshold_internal,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering internal arcs");
uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex", 1025,110, 53,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter external small arcs from graph");
uiDefButBitS(block, TOG, SKGEN_FILTER_SMART, B_DIFF, "Sm", 1078,110, 30,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Smart Filtering");
uiDefButF(block, NUM, B_DIFF, "", 1111,110,164,19, &G.scene->toolsettings->skgen_threshold_external,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering external arcs");
uiBlockEndAlign(block);
uiDefButF(block, NUM, B_DIFF, "Ang:", 1025, 60, 83,19, &G.scene->toolsettings->skgen_retarget_angle_weight, 0, 10, 1, 0, "Angle Weight");
@@ -5057,13 +5058,16 @@ static void editing_panel_mesh_skgen(Object *ob, Mesh *me)
uiButSetFunc(but, skgen_graphfree, NULL, NULL);
uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_DIFF, "Resolution:", 1025,150,225,19, &G.scene->toolsettings->skgen_resolution,2.0,1000.0, 0, 0, "Specifies the resolution of the graph's embedding");
uiDefButS(block, NUM, B_DIFF, "Resolution:", 1025,150,225,19, &G.scene->toolsettings->skgen_resolution,10.0,1000.0, 0, 0, "Specifies the resolution of the graph's embedding");
uiDefButBitS(block, TOG, SKGEN_HARMONIC, B_DIFF, "H", 1250,150, 25,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Apply harmonic smoothing to the weighting");
uiDefButBitS(block, TOG, SKGEN_FILTER_INTERNAL, B_DIFF, "Filter In", 1025,130, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter internal small arcs from graph");
uiDefButF(block, NUM, B_DIFF, "T:", 1111,130,164,19, &G.scene->toolsettings->skgen_threshold_internal,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering internal arcs");
uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex", 1025,110, 83,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter external small arcs from graph");
uiDefButF(block, NUM, B_DIFF, "T:", 1111,110,164,19, &G.scene->toolsettings->skgen_threshold_external,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering external arcs");
uiDefButF(block, NUM, B_DIFF, "", 1111,130,164,19, &G.scene->toolsettings->skgen_threshold_internal,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering internal arcs");
uiDefButBitS(block, TOG, SKGEN_FILTER_EXTERNAL, B_DIFF, "Filter Ex", 1025,110, 53,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Filter external small arcs from graph");
uiDefButBitS(block, TOG, SKGEN_FILTER_SMART, B_DIFF, "Sm", 1078,110, 30,19, &G.scene->toolsettings->skgen_options, 0, 0, 0, 0, "Smart Filtering");
uiDefButF(block, NUM, B_DIFF, "", 1111,110,164,19, &G.scene->toolsettings->skgen_threshold_external,0.0, 1.0, 10, 0, "Specify the threshold ratio for filtering external arcs");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
for(i = 0; i < SKGEN_SUB_TOTAL; i++)
{
int y = 90 - 20 * i;

File diff suppressed because it is too large Load Diff