diff --git a/Geo/CAD.cpp b/Geo/CAD.cpp index e051adb9cbd7063797eeef5ee4fb629c11278a2b..9b06e2d5dab2ea1c71f56fd05aaf7cc8274b757f 100644 --- a/Geo/CAD.cpp +++ b/Geo/CAD.cpp @@ -1,4 +1,4 @@ -// $Id: CAD.cpp,v 1.86 2006-01-06 00:34:23 geuzaine Exp $ +// $Id: CAD.cpp,v 1.87 2006-01-06 03:06:24 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -872,6 +872,30 @@ static void vecmat4x4(double mat[4][4], double vec[4], double res[4]) } } +void printCurve(Curve * c) +{ + Vertex *v; + int N = List_Nbr(c->Control_Points); + Msg(DEBUG, "Curve %d %d cp (%d->%d)", c->Num, N, c->beg->Num, c->end->Num); + for(int i = 0; i < N; i++) { + List_Read(c->Control_Points, i, &v); + Msg(DEBUG, "Vertex %d (%g,%g,%g,%g)", v->Num, v->Pos.X, v->Pos.Y, + v->Pos.Z, v->lc); + } +} + +void printSurface(Surface * s) +{ + Curve *c; + int N = List_Nbr(s->Generatrices); + + Msg(DEBUG, "Surface %d, %d generatrices", s->Num, N); + for(int i = 0; i < N; i++) { + List_Read(s->Generatrices, i, &c); + printCurve(c); + } +} + void ApplyTransformationToPoint(double matrix[4][4], Vertex * v) { double pos[4], vec[4]; @@ -915,18 +939,6 @@ void ApplyTransformationToCurve(double matrix[4][4], Curve * c) End_Curve(c); } -void printCurve(Curve * c) -{ - Vertex *v; - int N = List_Nbr(c->Control_Points); - Msg(DEBUG, "Curve %d %d cp (%d->%d)", c->Num, N, c->beg->Num, c->end->Num); - for(int i = 0; i < N; i++) { - List_Read(c->Control_Points, i, &v); - Msg(DEBUG, "Vertex %d (%g,%g,%g,%g)", v->Num, v->Pos.X, v->Pos.Y, - v->Pos.Z, v->lc); - } -} - void ApplyTransformationToSurface(double matrix[4][4], Surface * s) { Curve *c; @@ -935,7 +947,11 @@ void ApplyTransformationToSurface(double matrix[4][4], Surface * s) for(i = 0; i < List_Nbr(s->Generatrices); i++) { List_Read(s->Generatrices, i, &c); - ApplyTransformationToCurve(matrix, c); + // FIXME: this fixes benchmarks/bug/transfo_neg_curves.geo, but is + // it the correct fix? + //ApplyTransformationToCurve(matrix, c); + Curve *cc = FindCurve(abs(c->Num), THEM); + ApplyTransformationToCurve(matrix, cc); } for(i = 0; i < List_Nbr(s->Control_Points); i++) { List_Read(s->Control_Points, i, &v); @@ -944,18 +960,6 @@ void ApplyTransformationToSurface(double matrix[4][4], Surface * s) End_Surface(s); } -void printSurface(Surface * s) -{ - Curve *c; - int N = List_Nbr(s->Generatrices); - - Msg(DEBUG, "Surface %d, %d generatrices", s->Num, N); - for(int i = 0; i < N; i++) { - List_Read(s->Generatrices, i, &c); - printCurve(c); - } -} - void ApplicationOnShapes(double matrix[4][4], List_T * ListShapes) { int i; diff --git a/benchmarks/bugs/transfo_neg_curves.geo b/benchmarks/bugs/transfo_neg_curves.geo new file mode 100644 index 0000000000000000000000000000000000000000..cac181373c45e0e51ff907faff3acd8e2a7b8a0d --- /dev/null +++ b/benchmarks/bugs/transfo_neg_curves.geo @@ -0,0 +1,30 @@ +Point(1) = {2,5,0,0.1}; +Point(2) = {5,5,0,0.1}; +Point(3) = {2,10,0,0.1}; +Point(4) = {2,0,0,0.1}; +Point(5) = {7,5,0,0.1}; +Circle(3) = {4,1,5}; +Circle(4) = {5,1,3}; + +// this used to fail (due to the neg curves in the line loop) in +// gmsh <= 1.61 + +Ellipse(1) = {4,1,1,2}; +Ellipse(2) = {2,1,1,3}; +Line Loop(5) = {3,4,-2,-1}; +Plane Surface(6) = {5}; +Symmetry { 1.0,0.0,0.0,-2 } { Surface{6}; } +//Rotate { {0.0,0,1}, {2,5,0.0}, Pi/7 } { Surface{6}; } + + + +// this worked: +/* +Ellipse(1) = {2,1,1,4}; +Ellipse(2) = {3,1,1,2}; +Line Loop(5) = {3,4,2,1}; +Plane Surface(6) = {5}; +Symmetry { 1.0,0.0,0.0,-2 } { Surface{6}; } +//Rotate { {0.0,0,1}, {2,5,0.0}, Pi/7 } { Surface{6}; } + +*/