Handling of trimmed analytical surfaces added in extrema PS.
New draw-command and test case for issue CR25861
Correction of test case for issue CR25861
Standard_Real U, V;
PS.Parameter(U, V);
if (myS->IsUPeriodic()) {
- U = ElCLib::InPeriod(U, myuinf, myuinf+myS->UPeriod());
+ U = ElCLib::InPeriod(U, myuinf, myuinf + myS->UPeriod());
+
+ // Handle trimmed surfaces.
+ if (U > myusup + mytolu)
+ U -= myS->UPeriod();
+ if (U < myuinf - mytolu)
+ U += myS->UPeriod();
}
if (myS->IsVPeriodic()) {
- V = ElCLib::InPeriod(V, myvinf, myvinf+myS->VPeriod());
+ V = ElCLib::InPeriod(V, myvinf, myvinf + myS->VPeriod());
+
+ // Handle trimmed surfaces.
+ if (V > myvsup + mytolv)
+ V -= myS->VPeriod();
+ if (V < myvinf - mytolv)
+ V += myS->VPeriod();
}
if ((myuinf-U) <= mytolu && (U-myusup) <= mytolu &&
(myvinf-V) <= mytolv && (V-myvsup) <= mytolv) {
return 0;
}
+#include <IntTools_Context.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+
+//=======================================================================
+//function : xprojponf
+//purpose :
+//=======================================================================
+Standard_Integer xprojponf (Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n!=3) {
+ di<<" use xprojponf p f \n";
+ return 0;
+ }
+ //
+ gp_Pnt aP, aPS;
+ TopoDS_Shape aS;
+ TopoDS_Face aF;
+ Handle(IntTools_Context) aCtx;
+ //
+ DrawTrSurf::GetPoint(a[1], aP);
+ aS=DBRep::Get(a[2]);
+ //
+ if (aS.IsNull()) {
+ di<<" null shape is not allowed\n";
+ return 0;
+ }
+ //
+ if (aS.ShapeType()!=TopAbs_FACE) {
+ di << a[2] << " not a face\n";
+ return 0;
+ }
+ //
+ aCtx=new IntTools_Context;
+ //
+ aF=TopoDS::Face(aS);
+ GeomAPI_ProjectPointOnSurf& aPPS=aCtx->ProjPS(aF);
+ //
+ aPPS.Perform(aP);
+ if (!aPPS.IsDone()) {
+ di<<" projection failed\n";
+ return 0;
+ }
+ //
+ aPS=aPPS.NearestPoint();
+ di<< " point px " << aPS.X() << " " << aPS.Y() << " " << aPS.Z() << "\n";
+ //
+ return 0;
+}
+
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
__FILE__, OCC25545, group);
theCommands.Add ("OCC25547", "OCC25547", __FILE__, OCC25547, group);
theCommands.Add ("OCC24881", "OCC24881 shape", __FILE__, OCC24881, group);
+ theCommands.Add ("xprojponf", "xprojponf p f", __FILE__, xprojponf, group);
return;
}
--- /dev/null
+puts "================"
+puts "OCC25861"
+puts "================"
+puts ""
+#######################################################################
+# Wrong result obtained by projection algorithm.
+#######################################################################
+
+pload QAcommands
+
+restore [locate_data_file bug25861_f3.brep] f3
+
+point p 6.9184976310066668 -24.127668568051799 8.6427835999999978
+
+set info [xprojponf p f3]
+
+if { [regexp {point px +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} ${info} string x2 y2 z2] != 1 } {
+ puts "Error: Wrong result obtained by projection algorithm"
+} else {
+ puts "OK: Good result obtained by projection algorithm"
+
+ vertex v1 p
+ vertex v2 ${x2} ${y2} ${z2}
+
+ set CMP_TOL 1.0e-7
+ distmini res v1 v2
+ set distmin [dval res_val]
+ if { [expr abs(${distmin})] > ${CMP_TOL} } {
+ puts "Error: Wrong projection point"
+ } else {
+ puts "OK: Good projection point"
+ }
+
+}