Commit 2943c138 by Christophe Geuzaine

don't recompute curve parameters every time we transform a point: do it after…

don't recompute curve parameters every time we transform a point: do it after all points have been transformed
parent 41eb98ad
Pipeline #345 passed with stage
in 11 minutes 6 seconds
3.0.5: bug fixes.
3.0.4 (July 28, 2017): moved vorometal code to plugin; openmp improvements; bug
fixes.
......
......@@ -1381,8 +1381,7 @@ static void vecmat4x4(double mat[4][4], double vec[4], double res[4])
}
}
static void ApplyTransformationToPoint(double matrix[4][4], Vertex *v,
bool end_curve_surface=false)
static void ApplyTransformationToPoint(double matrix[4][4], Vertex *v)
{
double pos[4], vec[4];
......@@ -1404,28 +1403,6 @@ static void ApplyTransformationToPoint(double matrix[4][4], Vertex *v,
v->Pos.Y = pos[1];
v->Pos.Z = pos[2];
v->w = pos[3];
// Warning: in theory we should always redo these checks if
// end_curve_surface is true; but in practice this is so slow for
// big models that we need to provide a way to bypass it (which is
// OK if the guy who builds the geometry knowns what he's
// doing). Instead of adding one more option, let's just bypass all
// the checks if auto_coherence==0...
if(CTX::instance()->geom.autoCoherence && end_curve_surface){
List_T *All = Tree2List(GModel::current()->getGEOInternals()->Curves);
for(int i = 0; i < List_Nbr(All); i++) {
Curve *c;
List_Read(All, i, &c);
for(int j = 0; j < List_Nbr(c->Control_Points); j++) {
Vertex *pv = *(Vertex **)List_Pointer(c->Control_Points, j);
if(pv->Num == v->Num){
EndCurve(c);
break;
}
}
}
List_Delete(All);
}
}
static void ApplyTransformationToCurve(double matrix[4][4], Curve *c)
......@@ -1482,7 +1459,7 @@ static void ApplicationOnShapes(double matrix[4][4], List_T *shapes)
case MSH_POINT:
v = FindPoint(O.Num);
if(v)
ApplyTransformationToPoint(matrix, v, true);
ApplyTransformationToPoint(matrix, v);
else
Msg::Error("Unknown GEO vertex with tag %d", O.Num);
break;
......@@ -1524,6 +1501,28 @@ static void ApplicationOnShapes(double matrix[4][4], List_T *shapes)
}
}
// recompute curve parameters if control points have been transformed.
// Warning: in theory we should always redo these checks; but in practice this
// is so slow for big models that we need to provide a way to bypass it (which
// is OK if the guy who builds the geometry knowns what he's doing). Instead
// of adding one more option, let's just bypass all the checks if
// auto_coherence==0.
if(CTX::instance()->geom.autoCoherence){
List_T *All = Tree2List(GModel::current()->getGEOInternals()->Curves);
for(int i = 0; i < List_Nbr(All); i++) {
Curve *c;
List_Read(All, i, &c);
for(int j = 0; j < List_Nbr(c->Control_Points); j++) {
Vertex *pv = *(Vertex **)List_Pointer(c->Control_Points, j);
if(List_Search(ListOfTransformedPoints, &pv->Num, fcmp_absint)) {
EndCurve(c);
break;
}
}
}
List_Delete(All);
}
List_Reset(ListOfTransformedPoints);
}
......
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 sign in to comment