Handle(Geom_ToroidalSurface)::DownCast(Surf);
gp_Torus Tr = TheElSurf->Torus();
- if (isUClosed) {
+ //
+ // if isUClosed = true and U trim does not coinside with first period of torus,
+ // method CheckAndSegment shifts position of U seam boundary of surface.
+ // probably bug? So, for this case we must build not periodic surface.
+ Standard_Boolean isUFirstPeriod = !(UFirst < 0. || ULast > 2.*M_PI);
+ Standard_Boolean isVFirstPeriod = !(VFirst < 0. || VLast > 2.*M_PI);
+ if (isUClosed && isUFirstPeriod) {
Convert_TorusToBSplineSurface Convert (Tr, VFirst, VLast,
Standard_False);
TheSurface = BSplineSurfaceBuilder (Convert);
TheSurface->CheckAndSegment(UFirst, ULast, VFirst, VLast);
}
}
- else if (Strim->IsVClosed()) {
+ else if (Strim->IsVClosed() && isVFirstPeriod) {
Convert_TorusToBSplineSurface Convert (Tr, UFirst, ULast);
TheSurface = BSplineSurfaceBuilder (Convert);
Standard_Integer aNbK = TheSurface->NbVKnots();
--- /dev/null
+puts "==========================================================="
+puts "0032842: Modeling Data - a regression in conversion of a face to bspline"
+puts "==========================================================="
+puts ""
+
+restore [locate_data_file bug32842.brep] s
+nurbsconvert bs s
+explode bs e
+pcurve pc2 bs_2 bs
+bounds pc2 t1 t2
+2dcvalue pc2 t1 x1 y1
+2dcvalue pc2 t2 x2 y2
+mksurface surf bs
+bounds surf u1 u2 v1 v2
+
+checkreal "U21" [dval (u2-x1)] 0 1.e-7 1.e-7
+checkreal "U22" [dval (u2-x2)] 0 1.e-7 1.e-7