// Construction of vertices on edges parallel to the spine.
//-----------------------------------------------------------
- Trim.IntersectWith(E [0], E [1], myJoinType, Params);
+ Trim.IntersectWith(E[0], E[1], S[0], S[1], Ends[0], Ends[1],
+ myJoinType, myIsOpenResult, Params);
for (Standard_Integer s = 1; s <= Params.Length(); s++) {
TopoDS_Vertex VC;
const BRepFill_TrimEdgeTool& Trim) const
{
Standard_Integer ii = 1;
- Standard_Real U1,U2;
- TopoDS_Vertex V1,V2;
- Handle(Geom2d_Curve) Bis (Bisec.Value());
-
- U1 = Bis->FirstParameter();
-
- if (SOnE) {
- // the first point of the bissectrice is on the offset
- V1 = TopoDS::Vertex(Vertices.Value(ii));
- ii++;
- }
-
- while (ii <= Vertices.Length()) {
- U2 = Params.Value(ii).X();
- V2 = TopoDS::Vertex(Vertices.Value(ii));
-
- gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);
- Standard_Boolean IsP_inside = Standard_True;
- if ((myJoinType != GeomAbs_Intersection) || EOnE)
- IsP_inside = Trim.IsInside(P);
- if (!IsP_inside) {
- if (!V1.IsNull()) {
- Detromp(Shape1).Append(V1);
- Detromp(Shape2).Append(V1);
- }
- Detromp(Shape1).Append(V2);
- Detromp(Shape2).Append(V2);
- }
- U1 = U2;
- V1 = V2;
- ii ++;
- }
-
- // test medium point between the last parameter and the end of the bissectrice.
- U2 = Bis->LastParameter();
- if (!EOnE) {
- if (!Precision::IsInfinite(U2)) {
- gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);
- Standard_Boolean IsP_inside = Standard_False;
- if (myJoinType == GeomAbs_Arc)
- IsP_inside = Trim.IsInside(P);
- if (!IsP_inside) {
+ if (myJoinType == GeomAbs_Intersection)
+ {
+ for (; ii <= Vertices.Length(); ii++)
+ {
+ const TopoDS_Vertex& aVertex = TopoDS::Vertex(Vertices.Value(ii));
+ Detromp(Shape1).Append(aVertex);
+ Detromp(Shape2).Append(aVertex);
+ }
+ }
+ else //myJoinType == GeomAbs_Arc
+ {
+ Standard_Real U1,U2;
+ TopoDS_Vertex V1,V2;
+
+ const Handle(Geom2d_Curve)& Bis = Bisec.Value();
+
+ U1 = Bis->FirstParameter();
+
+ if (SOnE) {
+ // the first point of the bissectrice is on the offset
+ V1 = TopoDS::Vertex(Vertices.Value(ii));
+ ii++;
+ }
+
+ while (ii <= Vertices.Length()) {
+ U2 = Params.Value(ii).X();
+ V2 = TopoDS::Vertex(Vertices.Value(ii));
+
+ gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);
+ if (!Trim.IsInside(P)) {
if (!V1.IsNull()) {
Detromp(Shape1).Append(V1);
Detromp(Shape2).Append(V1);
}
+ Detromp(Shape1).Append(V2);
+ Detromp(Shape2).Append(V2);
}
+ U1 = U2;
+ V1 = V2;
+ ii ++;
}
- else {
- if (!V1.IsNull()) {
- Detromp(Shape1).Append(V1);
- Detromp(Shape2).Append(V1);
+
+ // test medium point between the last parameter and the end of the bissectrice.
+ U2 = Bis->LastParameter();
+ if (!EOnE) {
+ if (!Precision::IsInfinite(U2)) {
+ gp_Pnt2d P = Bis->Value((U2 + U1)*0.5);
+ if (!Trim.IsInside(P)) {
+ if (!V1.IsNull()) {
+ Detromp(Shape1).Append(V1);
+ Detromp(Shape2).Append(V1);
+ }
+ }
}
- }
- }
- //else if(myJoinType != GeomAbs_Arc)
- //{
- // if (!V1.IsNull()) {
- // Detromp(Shape1).Append(V1);
- // Detromp(Shape2).Append(V1);
- // }
- //}
+ else {
+ if (!V1.IsNull()) {
+ Detromp(Shape1).Append(V1);
+ Detromp(Shape2).Append(V1);
+ }
+ }
+ }
+ //else if(myJoinType != GeomAbs_Arc)
+ //{
+ // if (!V1.IsNull()) {
+ // Detromp(Shape1).Append(V1);
+ // Detromp(Shape2).Append(V1);
+ // }
+ //}
+ } //end of else (myJoinType==GeomAbs_Arc)
}
//=======================================================================
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopExp.hxx>
+#include <BRepAdaptor_Curve.hxx>
#ifdef OCCT_DEBUG
//#define DRAW
void BRepFill_TrimEdgeTool::IntersectWith(const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
+ const TopoDS_Shape& InitShape1,
+ const TopoDS_Shape& InitShape2,
+ const TopoDS_Vertex& End1,
+ const TopoDS_Vertex& End2,
const GeomAbs_JoinType theJoinType,
+ const Standard_Boolean IsOpenResult,
TColgp_SequenceOfPnt& Params)
{
Params.Clear();
NbPoints = Params.Length();
- if (NbPoints > 0 && theJoinType == GeomAbs_Intersection)
+ //Now we define: if there are more than one point of intersection
+ //is it Ok ?
+ Standard_Real init_fpar = RealFirst(), init_lpar = RealLast();
+ if (NbPoints > 1 &&
+ theJoinType == GeomAbs_Intersection &&
+ InitShape1.ShapeType() != TopAbs_VERTEX &&
+ InitShape2.ShapeType() != TopAbs_VERTEX)
+ {
+ //definition of initial first and last parameters:
+ //this is inverse procedure to extension of parameters
+ //(see BRepFill_OffsetWire, function MakeOffset, case of Circle)
+ const TopoDS_Edge& InitEdge1 = TopoDS::Edge(InitShape1);
+ Standard_Boolean ToExtendFirstPar = Standard_True;
+ Standard_Boolean ToExtendLastPar = Standard_True;
+ if (IsOpenResult)
+ {
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(InitEdge1, V1, V2);
+ if (V1.IsSame(End1) ||
+ V1.IsSame(End2))
+ ToExtendFirstPar = Standard_False;
+ if (V2.IsSame(End1) ||
+ V2.IsSame(End2))
+ ToExtendLastPar = Standard_False;
+ }
+ BRepAdaptor_Curve IC1(InitEdge1);
+ if (IC1.GetType() == GeomAbs_Circle)
+ {
+ Standard_Real Delta = 2*M_PI - IC1.LastParameter() + IC1.FirstParameter();
+ if (ToExtendFirstPar && ToExtendLastPar)
+ init_fpar = AC1.FirstParameter() + Delta/2;
+ else if (ToExtendFirstPar)
+ init_fpar = AC1.FirstParameter() + Delta;
+ else if (ToExtendLastPar)
+ init_fpar = AC1.FirstParameter();
+ init_lpar = init_fpar + IC1.LastParameter() - IC1.FirstParameter();
+ }
+ }
+
+
+ if (NbPoints > 1 && theJoinType == GeomAbs_Intersection)
{
//Remove all vertices with non-minimal parameter
+ //if they are out of initial range
Standard_Integer imin = 1;
for (i = 2; i <= NbPoints; i++)
if (Params(i).X() < Params(imin).X())
imin = i;
+
+ TColgp_SequenceOfPnt ParamsCopy = Params;
+ TColgp_SequenceOfPnt Points2Copy = Points2;
+ Params.Clear();
+ Points2.Clear();
+ for (i = 1; i <= ParamsCopy.Length(); i++)
+ if (imin == i ||
+ (ParamsCopy(i).Y() >= init_fpar && ParamsCopy(i).Y() <= init_lpar))
+ {
+ Params.Append(ParamsCopy(i));
+ Points2.Append(Points2Copy(i));
+ }
+
+ /*
gp_Pnt Pnt1 = Params(imin);
gp_Pnt Pnt2 = Points2(imin);
Params.Clear();
Points2.Clear();
Params.Append(Pnt1);
Points2.Append(Pnt2);
+ */
}
NbPoints = Params.Length();
class Bisector_Bisec;
class Geom2d_Geometry;
class TopoDS_Edge;
+class TopoDS_Shape;
+class TopoDS_Vertex;
class gp_Pnt2d;
Standard_EXPORT BRepFill_TrimEdgeTool(const Bisector_Bisec& Bisec, const Handle(Geom2d_Geometry)& S1, const Handle(Geom2d_Geometry)& S2, const Standard_Real Offset);
- Standard_EXPORT void IntersectWith (const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const GeomAbs_JoinType theJoinType, TColgp_SequenceOfPnt& Params);
+ Standard_EXPORT void IntersectWith (const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const TopoDS_Shape& InitShape1, const TopoDS_Shape& InitShape2, const TopoDS_Vertex& End1, const TopoDS_Vertex& End2, const GeomAbs_JoinType theJoinType, const Standard_Boolean IsOpenResult, TColgp_SequenceOfPnt& Params) ;
Standard_EXPORT void AddOrConfuse (const Standard_Boolean Start, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, TColgp_SequenceOfPnt& Params) const;
--- /dev/null
+puts "============"
+puts "OCC26736"
+puts "============"
+puts ""
+##################################
+# Errors in BRepOffsetAPI_MakeOffset: overlapping arcs are processed incorrect in mode GeomAbs_Intersection
+##################################
+
+smallview
+
+restore [locate_data_file bug26736_arc1.brep] a
+wire ww a
+donly ww
+fit
+mkoffset result ww 10 8 i
+fit
+
+set only_screen_axo 1
--- /dev/null
+puts "============"
+puts "OCC26736"
+puts "============"
+puts ""
+##################################
+# Errors in BRepOffsetAPI_MakeOffset: overlapping arcs are processed incorrect in mode GeomAbs_Intersection
+##################################
+
+circle c1 7 0 0 5
+circle c2 -7 0 0 0 0 1 0 1 0 5
+trim c1 c1 pi/2 3*pi/2
+trim c2 c2 pi 2*pi
+mkedge e1 c1
+mkedge e2 c2
+polyline pp1 -7 5 0 -7 30 0 7 30 0 7 5 0
+polyline pp2 7 -5 0 7 -30 0 -7 -30 0 -7 -5 0
+wire ww pp1 e1 pp2 e2
+
+smallview
+donly ww
+fit
+
+mkoffset result ww 1 -3. i
+fit
+
+set only_screen_axo 1