theList[i] = theList2[j];
}
+static TopoDS_Edge ReplaceVertex(
+ const TopoDS_Edge& theEdge, Standard_Integer theVertexIndex)
+{
+ TopoDS_Vertex aVertices[] =
+ {TopExp::FirstVertex(theEdge), TopExp::LastVertex(theEdge)};
+ const TopAbs_Orientation aOrient = theEdge.Orientation();
+ if (aOrient == TopAbs_REVERSED)
+ {
+ theVertexIndex ^= 1;
+ }
+ aVertices[theVertexIndex].EmptyCopy();
+ aVertices[0].Orientation(TopAbs_FORWARD);
+ aVertices[1].Orientation(TopAbs_REVERSED);
+ TopoDS_Edge aFE = TopoDS::Edge(theEdge.Oriented(TopAbs_FORWARD));
+ TopoDS_Edge aNewEdge =
+ ShapeBuild_Edge().CopyReplaceVertices(aFE, aVertices[0], aVertices[1]);
+ return TopoDS::Edge(aNewEdge.Oriented(aOrient));
+}
+
static Standard_Boolean WireToCurve(
const TopoDS_Wire& theWire,
NCollection_Vector<TopoDS_Edge>& theEdges,
aParamI ^= 1;
}
+ NCollection_Vector<TopoDS_Edge>* aEdges = &theEdges2;
const Standard_Integer aECount = theEdges.Size();
if (aParamI == 0)
{
- NCollection_Vector<TopoDS_Edge>* aEdges = (theEdgeIndex != 0) ? &theEdges1 : &theEdges2;
- for (Standard_Integer aEI = theEdgeIndex; aEI < aECount; ++aEI)
- {
- aEdges->Append(theEdges(aEI));
- }
+ aEdges = (theEdgeIndex == 0) ? &theEdges1 : &theEdges2;
+ aEdges->Append(ReplaceVertex(aEdge, 0));
}
else if (aParamI == 1)
{
- theEdges1.Append(aEdge);
- for (Standard_Integer aEI = theEdgeIndex; aEI < aECount; ++aEI)
- {
- theEdges2.Append(theEdges(aEI));
- }
+ theEdges1.Append(ReplaceVertex(aEdge, 1));
}
else
{
aSplitV1, aCurve.Value(theParameter), Precision::Confusion());
BRep_Builder().MakeVertex(
aSplitV2, aCurve.Value(theParameter), Precision::Confusion());
-
TopoDS_Edge aEParts[] = {
ShapeBuild_Edge().CopyReplaceVertices(aFE, TopoDS_Vertex(),
TopoDS::Vertex(aSplitV1.Oriented(TopAbs_REVERSED))),
const Standard_Integer aFirstPI = (aOrient != TopAbs_REVERSED) ? 0 : 1;
theEdges1.Append(aEParts[aFirstPI]);
theEdges2.Append(aEParts[1 - aFirstPI]);
-
- for (Standard_Integer aEI = theEdgeIndex + 1; aEI < aECount; ++aEI)
- {
- theEdges2.Append(theEdges(aEI));
- }
+ }
+ for (Standard_Integer aEI = theEdgeIndex + 1; aEI < aECount; ++aEI)
+ {
+ aEdges->Append(theEdges(aEI));
}
}