(pntproj, Surf->Surface(), U0, V0, TolU, TolV) ;
if (aLocateExtPS.IsDone())
- if (aLocateExtPS.SquareDistance() < DistTol3d * DistTol3d) { //OCC217
- //if (aLocateExtPS.SquareDistance() < Tol3d * Tol3d) {
+ {
+ if (aLocateExtPS.SquareDistance() < DistTol3d * DistTol3d)
+ { //OCC217
+ //if (aLocateExtPS.SquareDistance() < Tol3d * Tol3d) {
(aLocateExtPS.Point()).Parameter(U0,V0);
U1 = U0 + usens*uperiod;
V1 = V0 + vsens*vperiod;
Pts2d(i).SetCoord(U1,V1);
myProjIsDone = Standard_True;
}
+ else
+ {
+ Extrema_ExtPS aGlobalExtr(pntproj, Surf->Surface(), TolU, TolV);
+ if (aGlobalExtr.IsDone())
+ {
+ Standard_Real LocalMinSqDist = RealLast();
+ Standard_Integer imin = 0;
+ for (Standard_Integer isol = 1; isol <= aGlobalExtr.NbExt(); isol++)
+ {
+ Standard_Real aSqDist = aGlobalExtr.SquareDistance(isol);
+ if (aSqDist < LocalMinSqDist)
+ {
+ LocalMinSqDist = aSqDist;
+ imin = isol;
+ }
+ }
+ if (LocalMinSqDist < DistTol3d * DistTol3d)
+ {
+ Standard_Real LocalU, LocalV;
+ aGlobalExtr.Point(imin).Parameter(LocalU, LocalV);
+ if (uperiod > 0. && Abs(U0 - LocalU) >= uperiod/2.)
+ {
+ if (LocalU > U0)
+ usens = -1;
+ else
+ usens = 1;
+ }
+ if (vperiod > 0. && Abs(V0 - LocalV) >= vperiod/2.)
+ {
+ if (LocalV > V0)
+ vsens = -1;
+ else
+ vsens = 1;
+ }
+ U0 = LocalU; V0 = LocalV;
+ U1 = U0 + usens*uperiod;
+ V1 = V0 + vsens*vperiod;
+ Pts2d(i).SetCoord(U1,V1);
+ myProjIsDone = Standard_True;
+ }
+ }
+ }
+ }
if(!myProjIsDone && uperiod) {
Standard_Real Uinf, Usup, Uaux;
Uinf = Surf->Surface().FirstUParameter();
--- /dev/null
+puts "============"
+puts "OCC24633"
+puts "============"
+puts ""
+#######################################################################
+# Incorrect projection of a curve on a surface
+#######################################################################
+
+restore [locate_data_file bug24633_comp_49.brep] a
+
+explode a
+mkcurve c a_1
+mksurface s a_2
+pcurve a_2
+
+project prj c s
+
+set prj_length [lindex [length prj] end]
+
+set good_length 7.2662499016218058
+checkreal "prj_length" ${prj_length} ${good_length} 0.01 0.01
+
+#v2d2
+view 1 -2D- 728 20 400 400
+
+2dfit
+set only_screen_axo 1
--- /dev/null
+puts "============"
+puts "OCC24633"
+puts "============"
+puts ""
+#######################################################################
+# Incorrect projection of a curve on a surface
+#######################################################################
+
+restore [locate_data_file bug24633_comp_50.brep] a
+
+explode a
+mkcurve c a_1
+mksurface s a_2
+pcurve a_2
+
+project prj c s
+
+set prj_length [lindex [length prj] end]
+
+set good_length 7.2662499016218058
+checkreal "prj_length" ${prj_length} ${good_length} 0.01 0.01
+
+#v2d2
+view 1 -2D- 728 20 400 400
+
+2dfit
+set only_screen_axo 1