if (fabs(Dstmin - sqrt(Ext.SquareDistance(ii))) < Eps)
{
Pt = Ext.Point(ii);
- if (TRI_SOLUTION(SeqSol2, Pt))
+ // Pt - point on the curve pCurvOther/Eother, but
+ // if iE == 0 -> Eother correspond to edge S2
+ // and to edge S1 in the opposite case.
+ // Therefore we should search Pt through previous solution points on Other curve (edge):
+ // if iE == 0 - on edge S2, namely through SeqSol2,
+ // else - on edge S1, namely through SeqSol1.
+ const bool triSolutionResult = (iE == 0) ? TRI_SOLUTION(SeqSol2, Pt) : TRI_SOLUTION(SeqSol1, Pt);
+ if (triSolutionResult)
{
// Check if the parameter does not correspond to a vertex
const Standard_Real t = Ext.Parameter(ii);
if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty())
{
- theSeqSolShape1.Append(seqSol1);
- theSeqSolShape2.Append(seqSol2);
- myModif = Standard_True;
+ BRepExtrema_SeqOfSolution::iterator anIt1 = seqSol1.begin();
+ BRepExtrema_SeqOfSolution::iterator anIt2 = seqSol2.begin();
+ for (; anIt1 != seqSol1.end() && anIt2 != seqSol2.end(); anIt1++, anIt2++)
+ {
+ gp_Pnt Pt1 = anIt1->Point();
+ gp_Pnt Pt2 = anIt2->Point();
+ if (TRI_SOLUTION(theSeqSolShape1, Pt1) || TRI_SOLUTION(theSeqSolShape2, Pt2))
+ {
+ theSeqSolShape1.Append(*anIt1);
+ theSeqSolShape2.Append(*anIt2);
+ myModif = Standard_True;
+ }
+ }
}
}
--- /dev/null
+puts "========"
+puts "OCC32934"
+puts "========"
+puts ""
+###############################################################################################
+# BRepExtrema_DistShapeShape BRepExtrema_DistShapeShape returns two solutions instead of one.
+###############################################################################################
+
+pload ALL
+restore [locate_data_file bug32934.brep] edges
+explode edges E
+
+distmini di edges_1 edges_2
+if { ([isdraw di2]) } {
+ puts "Error : result of distmini is wrong"
+} else {
+ checknbshapes di -vertex 1 -edge 0
+}
+
+distmini dii edges_2 edges_1
+if { ([isdraw dii2]) } {
+ puts "Error : result of distmini is wrong"
+} else {
+ checknbshapes dii -vertex 1 -edge 0
+}