Draw node index
Retargetting, go to higher levels no nodes when no match is found Fix bug in exterme threshold external filtering
This commit is contained in:
@@ -76,6 +76,7 @@ typedef struct ReebNode {
|
||||
int index;
|
||||
float weight;
|
||||
struct ReebNode *link_down; /* for multi resolution filtering, points to lower levels, if present */
|
||||
struct ReebNode *link_up;
|
||||
} ReebNode;
|
||||
|
||||
typedef struct ReebEdge {
|
||||
|
@@ -630,7 +630,14 @@ static float calcCost(ReebArcIterator *iter, RigEdge *e1, RigEdge *e2, float *ve
|
||||
{
|
||||
test_angle = saacos(Inpf(vec_first, vec_second));
|
||||
/* ANGLE COST HERE */
|
||||
new_cost += G.scene->toolsettings->skgen_retarget_angle_weight * fabs((test_angle - angle) / test_angle);
|
||||
if (angle > 0)
|
||||
{
|
||||
new_cost += G.scene->toolsettings->skgen_retarget_angle_weight * fabs((test_angle - angle) / angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_cost += G.scene->toolsettings->skgen_retarget_angle_weight * fabs(test_angle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -886,7 +893,7 @@ static void retargetArctoArcAggresive(RigArc *iarc)
|
||||
{
|
||||
RigEdge *previous = edge->prev;
|
||||
float angle = previous->angle;
|
||||
float test_angle = previous->angle;
|
||||
float test_angle;
|
||||
|
||||
vec0 = vec_cache[i - 1];
|
||||
VecSubf(vec_first, vec1, vec0);
|
||||
@@ -896,7 +903,14 @@ static void retargetArctoArcAggresive(RigArc *iarc)
|
||||
{
|
||||
test_angle = saacos(Inpf(vec_first, vec_second));
|
||||
/* ANGLE COST HERE */
|
||||
new_cost += G.scene->toolsettings->skgen_retarget_angle_weight * fabs((test_angle - angle) / test_angle);
|
||||
if (angle > 0)
|
||||
{
|
||||
new_cost += G.scene->toolsettings->skgen_retarget_angle_weight * fabs((test_angle - angle) / angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_cost += G.scene->toolsettings->skgen_retarget_angle_weight * fabs(test_angle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1247,7 +1261,7 @@ static void matchMultiResolutionArc(RigNode *start_node, RigArc *next_iarc, Reeb
|
||||
ishape = BLI_subtreeShape((BNode*)start_node, (BArc*)next_iarc, 1) % MAGIC_NUMBER;
|
||||
eshape = BLI_subtreeShape((BNode*)enode, (BArc*)next_earc, 1) % MAGIC_NUMBER;
|
||||
|
||||
while (ishape > eshape && next_earc->link_up)
|
||||
while (ishape != eshape && next_earc->link_up)
|
||||
{
|
||||
next_earc->flag = 1; // mark previous as taken, to prevent backtrack on lower levels
|
||||
|
||||
@@ -1289,7 +1303,17 @@ static void findCorrespondingArc(RigArc *start_arc, RigNode *start_node, RigArc
|
||||
}
|
||||
}
|
||||
|
||||
/* not found, try at higher nodes (lower node might have filtered internal arcs, messing shape of tree */
|
||||
if (next_iarc->link_mesh == NULL)
|
||||
{
|
||||
if (enode->link_up)
|
||||
{
|
||||
start_node->link_mesh = enode->link_up;
|
||||
findCorrespondingArc(start_arc, start_node, next_iarc);
|
||||
}
|
||||
}
|
||||
|
||||
/* still not found, print debug info */
|
||||
if (next_iarc->link_mesh == NULL)
|
||||
{
|
||||
printf("--------------------------\n");
|
||||
|
@@ -210,6 +210,9 @@ ReebNode * copyNode(ReebGraph *rg, ReebNode *node)
|
||||
cp_node->next = NULL;
|
||||
cp_node->arcs = NULL;
|
||||
|
||||
cp_node->link_up = NULL;
|
||||
cp_node->link_down = NULL;
|
||||
|
||||
BLI_addtail(&rg->nodes, cp_node);
|
||||
rg->totnodes++;
|
||||
|
||||
@@ -232,6 +235,7 @@ void relinkNodes(ReebGraph *low_rg, ReebGraph *high_rg)
|
||||
if (low_node->index == high_node->index)
|
||||
{
|
||||
high_node->link_down = low_node;
|
||||
low_node->link_up = high_node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1202,9 +1206,10 @@ int filterExternalReebGraph(ReebGraph *rg, float threshold)
|
||||
// If middle node is a normal node, it will be removed later
|
||||
if (middleNode->degree == 2)
|
||||
{
|
||||
removedNode = middleNode;
|
||||
|
||||
filterArc(rg, terminalNode, removedNode, arc, 1);
|
||||
continue;
|
||||
// removedNode = middleNode;
|
||||
//
|
||||
// filterArc(rg, terminalNode, removedNode, arc, 1);
|
||||
}
|
||||
// Otherwise, just plain remove of the arc
|
||||
else
|
||||
@@ -3103,10 +3108,18 @@ void REEB_draw()
|
||||
{
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
else
|
||||
else if (arc->head->symmetry_flag & SYM_AXIAL)
|
||||
{
|
||||
glColor3f(1, 0.5f, 0);
|
||||
}
|
||||
else if (arc->head->symmetry_flag & SYM_RADIAL)
|
||||
{
|
||||
glColor3f(0.5f, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
glColor3f(1, 1, 0);
|
||||
}
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(arc->head->p);
|
||||
|
||||
@@ -3145,6 +3158,14 @@ void REEB_draw()
|
||||
glColor3f(0, 1, 0);
|
||||
glRasterPos3fv(vec);
|
||||
BMF_DrawString( G.fonts, text);
|
||||
|
||||
sprintf(text, "%i", arc->head->index);
|
||||
glRasterPos3fv(arc->head->p);
|
||||
BMF_DrawString( G.fonts, text);
|
||||
|
||||
sprintf(text, "%i", arc->tail->index);
|
||||
glRasterPos3fv(arc->tail->p);
|
||||
BMF_DrawString( G.fonts, text);
|
||||
}
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
|
Reference in New Issue
Block a user