mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-07 18:30:55 +03:00
0024107: BRepAlgo::ConcatenateWireC0 method doesn't work on a translated wire
Adding test case for issue CR24107 Correction test case for issue CR24107
This commit is contained in:
parent
1d47d8d066
commit
6f005d2afc
@ -43,6 +43,7 @@
|
|||||||
#include <TColGeom_SequenceOfCurve.hxx>
|
#include <TColGeom_SequenceOfCurve.hxx>
|
||||||
#include <TopTools_SequenceOfShape.hxx>
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
#include <TColStd_SequenceOfReal.hxx>
|
#include <TColStd_SequenceOfReal.hxx>
|
||||||
|
#include <TColStd_SequenceOfBoolean.hxx>
|
||||||
#include <GeomAbs_CurveType.hxx>
|
#include <GeomAbs_CurveType.hxx>
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
#include <BRepAdaptor_Curve.hxx>
|
||||||
#include <ElCLib.hxx>
|
#include <ElCLib.hxx>
|
||||||
@ -250,248 +251,226 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
|||||||
theWire = TopoDS::Wire(Fixer->Shape());
|
theWire = TopoDS::Wire(Fixer->Shape());
|
||||||
|
|
||||||
TColGeom_SequenceOfCurve CurveSeq;
|
TColGeom_SequenceOfCurve CurveSeq;
|
||||||
TopTools_SequenceOfShape LocSeq;
|
|
||||||
TColStd_SequenceOfReal FparSeq;
|
TColStd_SequenceOfReal FparSeq;
|
||||||
TColStd_SequenceOfReal LparSeq;
|
TColStd_SequenceOfReal LparSeq;
|
||||||
TColStd_SequenceOfReal TolSeq;
|
TColStd_SequenceOfReal TolSeq;
|
||||||
|
TColStd_SequenceOfBoolean IsFwdSeq;
|
||||||
GeomAbs_CurveType CurType = GeomAbs_OtherCurve;
|
GeomAbs_CurveType CurType = GeomAbs_OtherCurve;
|
||||||
TopoDS_Vertex FirstVertex, LastVertex;
|
TopoDS_Vertex FirstVertex, LastVertex;
|
||||||
Standard_Boolean FinalReverse = Standard_False;
|
|
||||||
|
|
||||||
BRepTools_WireExplorer wexp(theWire);
|
BRepTools_WireExplorer wexp(theWire);
|
||||||
for (; wexp.More(); wexp.Next())
|
|
||||||
{
|
for (; wexp.More(); wexp.Next()) {
|
||||||
TopoDS_Edge anEdge = wexp.Current();
|
TopoDS_Edge anEdge = wexp.Current();
|
||||||
Standard_Real fpar, lpar;
|
Standard_Real fpar, lpar;
|
||||||
TopLoc_Location aLoc;
|
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
|
||||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, fpar, lpar);
|
|
||||||
if (aCurve.IsNull())
|
if (aCurve.IsNull())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BRepAdaptor_Curve BAcurve(anEdge);
|
GeomAdaptor_Curve aGACurve(aCurve);
|
||||||
GeomAbs_CurveType aType = BAcurve.GetType();
|
GeomAbs_CurveType aType = aGACurve.GetType();
|
||||||
|
Handle(Geom_Curve) aBasisCurve = aGACurve.Curve();
|
||||||
|
Standard_Boolean isFwd = (wexp.Orientation() != TopAbs_REVERSED);
|
||||||
|
|
||||||
Handle(Geom_Curve) aBasisCurve = BAcurve.Curve().Curve();
|
if (aBasisCurve->IsPeriodic()) {
|
||||||
|
ElCLib::AdjustPeriodic
|
||||||
if (aBasisCurve->IsPeriodic())
|
(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
|
||||||
ElCLib::AdjustPeriodic(aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(),
|
|
||||||
Precision::PConfusion(), fpar, lpar);
|
Precision::PConfusion(), fpar, lpar);
|
||||||
|
|
||||||
if (CurveSeq.IsEmpty())
|
|
||||||
{
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CurveSeq.IsEmpty()) {
|
||||||
CurveSeq.Append(aCurve);
|
CurveSeq.Append(aCurve);
|
||||||
TopoDS_Shape aLocShape;
|
|
||||||
aLocShape.Location(aLoc);
|
|
||||||
aLocShape.Orientation(wexp.Orientation());
|
|
||||||
LocSeq.Append(aLocShape);
|
|
||||||
FparSeq.Append(fpar);
|
FparSeq.Append(fpar);
|
||||||
LparSeq.Append(lpar);
|
LparSeq.Append(lpar);
|
||||||
|
IsFwdSeq.Append(isFwd);
|
||||||
CurType = aType;
|
CurType = aType;
|
||||||
FirstVertex = wexp.CurrentVertex();
|
FirstVertex = wexp.CurrentVertex();
|
||||||
if (anEdge.Orientation() == TopAbs_REVERSED)
|
} else {
|
||||||
FinalReverse = Standard_True;
|
Standard_Boolean isSameCurve = Standard_False;
|
||||||
}
|
Standard_Real NewFpar, NewLpar;
|
||||||
else
|
|
||||||
{
|
|
||||||
Standard_Boolean Done = Standard_False;
|
|
||||||
Standard_Real NewFpar = 0., NewLpar = 0.;
|
|
||||||
GeomAdaptor_Curve GAprevcurve(CurveSeq.Last());
|
GeomAdaptor_Curve GAprevcurve(CurveSeq.Last());
|
||||||
TopoDS_Vertex CurVertex = wexp.CurrentVertex();
|
|
||||||
TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge);
|
if (aCurve == CurveSeq.Last()) {
|
||||||
TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED;
|
|
||||||
if (aCurve == CurveSeq.Last())
|
|
||||||
{
|
|
||||||
NewFpar = fpar;
|
NewFpar = fpar;
|
||||||
NewLpar = lpar;
|
NewLpar = lpar;
|
||||||
if (aBasisCurve->IsPeriodic())
|
isSameCurve = Standard_True;
|
||||||
{
|
} else if (aType == CurType &&
|
||||||
if (NewLpar < NewFpar)
|
|
||||||
NewLpar += aBasisCurve->Period();
|
|
||||||
if (ConnectByOrigin == TopAbs_FORWARD)
|
|
||||||
ElCLib::AdjustPeriodic(FparSeq.Last(),
|
|
||||||
FparSeq.Last() + aBasisCurve->Period(),
|
|
||||||
Precision::PConfusion(), NewFpar, NewLpar);
|
|
||||||
else
|
|
||||||
ElCLib::AdjustPeriodic(FparSeq.Last() - aBasisCurve->Period(),
|
|
||||||
FparSeq.Last(),
|
|
||||||
Precision::PConfusion(), NewFpar, NewLpar);
|
|
||||||
}
|
|
||||||
Done = Standard_True;
|
|
||||||
}
|
|
||||||
else if (aType == CurType &&
|
|
||||||
aType != GeomAbs_BezierCurve &&
|
aType != GeomAbs_BezierCurve &&
|
||||||
aType != GeomAbs_BSplineCurve &&
|
aType != GeomAbs_BSplineCurve &&
|
||||||
aType != GeomAbs_OtherCurve)
|
aType != GeomAbs_OtherCurve) {
|
||||||
switch (aType)
|
switch (aType) {
|
||||||
{
|
|
||||||
case GeomAbs_Line:
|
case GeomAbs_Line:
|
||||||
{
|
{
|
||||||
gp_Lin aLine = BAcurve.Line();
|
gp_Lin aLine = aGACurve.Line();
|
||||||
gp_Lin PrevLine = GAprevcurve.Line();
|
gp_Lin PrevLine = GAprevcurve.Line();
|
||||||
|
|
||||||
if (aLine.Contains(PrevLine.Location(), LinTol) &&
|
if (aLine.Contains(PrevLine.Location(), LinTol) &&
|
||||||
aLine.Direction().IsParallel(PrevLine.Direction(), AngTol))
|
aLine.Direction().IsParallel(PrevLine.Direction(), AngTol)) {
|
||||||
{
|
|
||||||
gp_Pnt P1 = ElCLib::Value(fpar, aLine);
|
gp_Pnt P1 = ElCLib::Value(fpar, aLine);
|
||||||
gp_Pnt P2 = ElCLib::Value(lpar, aLine);
|
gp_Pnt P2 = ElCLib::Value(lpar, aLine);
|
||||||
|
|
||||||
NewFpar = ElCLib::Parameter(PrevLine, P1);
|
NewFpar = ElCLib::Parameter(PrevLine, P1);
|
||||||
NewLpar = ElCLib::Parameter(PrevLine, P2);
|
NewLpar = ElCLib::Parameter(PrevLine, P2);
|
||||||
if (NewLpar < NewFpar)
|
isSameCurve = Standard_True;
|
||||||
{
|
|
||||||
Standard_Real MemNewFpar = NewFpar;
|
|
||||||
NewFpar = NewLpar;
|
|
||||||
NewLpar = MemNewFpar;
|
|
||||||
ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
|
|
||||||
}
|
|
||||||
Done = Standard_True;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GeomAbs_Circle:
|
case GeomAbs_Circle:
|
||||||
{
|
{
|
||||||
gp_Circ aCircle = BAcurve.Circle();
|
gp_Circ aCircle = aGACurve.Circle();
|
||||||
gp_Circ PrevCircle = GAprevcurve.Circle();
|
gp_Circ PrevCircle = GAprevcurve.Circle();
|
||||||
|
|
||||||
if (aCircle.Location().Distance(PrevCircle.Location()) <= LinTol &&
|
if (aCircle.Location().Distance(PrevCircle.Location()) <= LinTol &&
|
||||||
Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol &&
|
Abs(aCircle.Radius() - PrevCircle.Radius()) <= LinTol &&
|
||||||
aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol))
|
aCircle.Axis().IsParallel(PrevCircle.Axis(), AngTol)) {
|
||||||
{
|
|
||||||
if (aCircle.Axis().Direction() * PrevCircle.Axis().Direction() < 0.)
|
|
||||||
{
|
|
||||||
Standard_Real memfpar = fpar;
|
|
||||||
fpar = lpar;
|
|
||||||
lpar = memfpar;
|
|
||||||
ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
|
|
||||||
}
|
|
||||||
gp_Pnt P1 = ElCLib::Value(fpar, aCircle);
|
gp_Pnt P1 = ElCLib::Value(fpar, aCircle);
|
||||||
gp_Pnt P2 = ElCLib::Value(lpar, aCircle);
|
gp_Pnt P2 = ElCLib::Value(lpar, aCircle);
|
||||||
|
|
||||||
NewFpar = ElCLib::Parameter(PrevCircle, P1);
|
NewFpar = ElCLib::Parameter(PrevCircle, P1);
|
||||||
NewLpar = ElCLib::Parameter(PrevCircle, P2);
|
NewLpar = ElCLib::Parameter(PrevCircle, P2);
|
||||||
if (NewLpar < NewFpar)
|
isSameCurve = Standard_True;
|
||||||
NewLpar += 2.*M_PI;
|
|
||||||
//Standard_Real MemNewFpar = NewFpar, MemNewLpar = NewLpar;
|
|
||||||
if (ConnectByOrigin == TopAbs_FORWARD)
|
|
||||||
ElCLib::AdjustPeriodic(FparSeq.Last(),
|
|
||||||
FparSeq.Last() + 2.*M_PI,
|
|
||||||
Precision::PConfusion(), NewFpar, NewLpar);
|
|
||||||
else
|
|
||||||
ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
|
|
||||||
FparSeq.Last(),
|
|
||||||
Precision::PConfusion(), NewFpar, NewLpar);
|
|
||||||
Done = Standard_True;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GeomAbs_Ellipse:
|
case GeomAbs_Ellipse:
|
||||||
{
|
{
|
||||||
gp_Elips anEllipse = BAcurve.Ellipse();
|
gp_Elips anEllipse = aGACurve.Ellipse();
|
||||||
gp_Elips PrevEllipse = GAprevcurve.Ellipse();
|
gp_Elips PrevEllipse = GAprevcurve.Ellipse();
|
||||||
|
|
||||||
if (anEllipse.Focus1().Distance(PrevEllipse.Focus1()) <= LinTol &&
|
if (anEllipse.Focus1().Distance(PrevEllipse.Focus1()) <= LinTol &&
|
||||||
anEllipse.Focus2().Distance(PrevEllipse.Focus2()) <= LinTol &&
|
anEllipse.Focus2().Distance(PrevEllipse.Focus2()) <= LinTol &&
|
||||||
Abs(anEllipse.MajorRadius() - PrevEllipse.MajorRadius()) <= LinTol &&
|
Abs(anEllipse.MajorRadius() - PrevEllipse.MajorRadius()) <= LinTol &&
|
||||||
Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol &&
|
Abs(anEllipse.MinorRadius() - PrevEllipse.MinorRadius()) <= LinTol &&
|
||||||
anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol))
|
anEllipse.Axis().IsParallel(PrevEllipse.Axis(), AngTol)) {
|
||||||
{
|
|
||||||
if (anEllipse.Axis().Direction() * PrevEllipse.Axis().Direction() < 0.)
|
|
||||||
{
|
|
||||||
Standard_Real memfpar = fpar;
|
|
||||||
fpar = lpar;
|
|
||||||
lpar = memfpar;
|
|
||||||
ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
|
|
||||||
}
|
|
||||||
gp_Pnt P1 = ElCLib::Value(fpar, anEllipse);
|
gp_Pnt P1 = ElCLib::Value(fpar, anEllipse);
|
||||||
gp_Pnt P2 = ElCLib::Value(lpar, anEllipse);
|
gp_Pnt P2 = ElCLib::Value(lpar, anEllipse);
|
||||||
|
|
||||||
NewFpar = ElCLib::Parameter(PrevEllipse, P1);
|
NewFpar = ElCLib::Parameter(PrevEllipse, P1);
|
||||||
NewLpar = ElCLib::Parameter(PrevEllipse, P2);
|
NewLpar = ElCLib::Parameter(PrevEllipse, P2);
|
||||||
if (NewLpar < NewFpar)
|
isSameCurve = Standard_True;
|
||||||
NewLpar += 2.*M_PI;
|
|
||||||
if (ConnectByOrigin == TopAbs_FORWARD)
|
|
||||||
ElCLib::AdjustPeriodic(FparSeq.Last(),
|
|
||||||
FparSeq.Last() + 2.*M_PI,
|
|
||||||
Precision::PConfusion(), NewFpar, NewLpar);
|
|
||||||
else
|
|
||||||
ElCLib::AdjustPeriodic(FparSeq.Last() - 2.*M_PI,
|
|
||||||
FparSeq.Last(),
|
|
||||||
Precision::PConfusion(), NewFpar, NewLpar);
|
|
||||||
Done = Standard_True;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GeomAbs_Hyperbola:
|
case GeomAbs_Hyperbola:
|
||||||
{
|
{
|
||||||
gp_Hypr aHypr = BAcurve.Hyperbola();
|
gp_Hypr aHypr = aGACurve.Hyperbola();
|
||||||
gp_Hypr PrevHypr = GAprevcurve.Hyperbola();
|
gp_Hypr PrevHypr = GAprevcurve.Hyperbola();
|
||||||
|
|
||||||
if (aHypr.Focus1().Distance(PrevHypr.Focus1()) <= LinTol &&
|
if (aHypr.Focus1().Distance(PrevHypr.Focus1()) <= LinTol &&
|
||||||
aHypr.Focus2().Distance(PrevHypr.Focus2()) <= LinTol &&
|
aHypr.Focus2().Distance(PrevHypr.Focus2()) <= LinTol &&
|
||||||
Abs(aHypr.MajorRadius() - PrevHypr.MajorRadius()) <= LinTol &&
|
Abs(aHypr.MajorRadius() - PrevHypr.MajorRadius()) <= LinTol &&
|
||||||
Abs(aHypr.MinorRadius() - PrevHypr.MinorRadius()) <= LinTol &&
|
Abs(aHypr.MinorRadius() - PrevHypr.MinorRadius()) <= LinTol &&
|
||||||
aHypr.Axis().IsParallel(PrevHypr.Axis(), AngTol))
|
aHypr.Axis().IsParallel(PrevHypr.Axis(), AngTol)) {
|
||||||
{
|
|
||||||
gp_Pnt P1 = ElCLib::Value(fpar, aHypr);
|
gp_Pnt P1 = ElCLib::Value(fpar, aHypr);
|
||||||
gp_Pnt P2 = ElCLib::Value(lpar, aHypr);
|
gp_Pnt P2 = ElCLib::Value(lpar, aHypr);
|
||||||
|
|
||||||
NewFpar = ElCLib::Parameter(PrevHypr, P1);
|
NewFpar = ElCLib::Parameter(PrevHypr, P1);
|
||||||
NewLpar = ElCLib::Parameter(PrevHypr, P2);
|
NewLpar = ElCLib::Parameter(PrevHypr, P2);
|
||||||
if (NewLpar < NewFpar)
|
isSameCurve = Standard_True;
|
||||||
{
|
|
||||||
Standard_Real MemNewFpar = NewFpar;
|
|
||||||
NewFpar = NewLpar;
|
|
||||||
NewLpar = MemNewFpar;
|
|
||||||
ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
|
|
||||||
}
|
|
||||||
Done = Standard_True;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GeomAbs_Parabola:
|
case GeomAbs_Parabola:
|
||||||
{
|
{
|
||||||
gp_Parab aParab = BAcurve.Parabola();
|
gp_Parab aParab = aGACurve.Parabola();
|
||||||
gp_Parab PrevParab = GAprevcurve.Parabola();
|
gp_Parab PrevParab = GAprevcurve.Parabola();
|
||||||
|
|
||||||
if (aParab.Location().Distance(PrevParab.Location()) <= LinTol &&
|
if (aParab.Location().Distance(PrevParab.Location()) <= LinTol &&
|
||||||
aParab.Focus().Distance(PrevParab.Focus()) <= LinTol &&
|
aParab.Focus().Distance(PrevParab.Focus()) <= LinTol &&
|
||||||
Abs(aParab.Focal() - PrevParab.Focal()) <= LinTol &&
|
Abs(aParab.Focal() - PrevParab.Focal()) <= LinTol &&
|
||||||
aParab.Axis().IsParallel(PrevParab.Axis(), AngTol))
|
aParab.Axis().IsParallel(PrevParab.Axis(), AngTol)) {
|
||||||
{
|
|
||||||
gp_Pnt P1 = ElCLib::Value(fpar, aParab);
|
gp_Pnt P1 = ElCLib::Value(fpar, aParab);
|
||||||
gp_Pnt P2 = ElCLib::Value(lpar, aParab);
|
gp_Pnt P2 = ElCLib::Value(lpar, aParab);
|
||||||
|
|
||||||
NewFpar = ElCLib::Parameter(PrevParab, P1);
|
NewFpar = ElCLib::Parameter(PrevParab, P1);
|
||||||
NewLpar = ElCLib::Parameter(PrevParab, P2);
|
NewLpar = ElCLib::Parameter(PrevParab, P2);
|
||||||
if (NewLpar < NewFpar)
|
isSameCurve = Standard_True;
|
||||||
{
|
|
||||||
Standard_Real MemNewFpar = NewFpar;
|
|
||||||
NewFpar = NewLpar;
|
|
||||||
NewLpar = MemNewFpar;
|
|
||||||
ConnectByOrigin = TopAbs::Reverse(ConnectByOrigin);
|
|
||||||
}
|
|
||||||
Done = Standard_True;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} //end of switch and else
|
default:
|
||||||
if (Done)
|
break;
|
||||||
{
|
} //end of switch
|
||||||
if (NewFpar < FparSeq.Last())
|
} //end of else
|
||||||
FparSeq(FparSeq.Length()) = NewFpar;
|
|
||||||
else
|
if (isSameCurve) {
|
||||||
LparSeq(LparSeq.Length()) = NewLpar;
|
const Standard_Boolean isSameDir = (isFwd == IsFwdSeq.Last());
|
||||||
|
|
||||||
|
if (aBasisCurve->IsPeriodic()) {
|
||||||
|
// Treat periodic curves.
|
||||||
|
const Standard_Real aPeriod = aBasisCurve->Period();
|
||||||
|
|
||||||
|
if (isSameDir) {
|
||||||
|
// Check if first parameter is greater then the last one.
|
||||||
|
while (NewFpar > NewLpar) {
|
||||||
|
NewFpar -= aPeriod;
|
||||||
}
|
}
|
||||||
else
|
} else { // !isSameDir
|
||||||
{
|
// Check if last parameter is greater then the first one.
|
||||||
|
while (NewLpar > NewFpar) {
|
||||||
|
NewLpar -= aPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change parameters
|
||||||
|
const Standard_Real aTmpPar = NewLpar;
|
||||||
|
|
||||||
|
NewLpar = NewFpar;
|
||||||
|
NewFpar = aTmpPar;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Udjust parameters on periodic curves.
|
||||||
|
if (IsFwdSeq.Last()) {
|
||||||
|
// The current curve should be after the previous one.
|
||||||
|
ElCLib::AdjustPeriodic(LparSeq.Last(), LparSeq.Last() + aPeriod,
|
||||||
|
Precision::PConfusion(), NewFpar, NewLpar);
|
||||||
|
} else {
|
||||||
|
// The current curve should be before the previous one.
|
||||||
|
ElCLib::AdjustPeriodic(FparSeq.Last() - aPeriod, FparSeq.Last(),
|
||||||
|
Precision::PConfusion(), NewFpar, NewLpar);
|
||||||
|
}
|
||||||
|
} else if (!isSameDir) {
|
||||||
|
// Not periodic curves. Opposite dirs.
|
||||||
|
const Standard_Real aTmpPar = NewLpar;
|
||||||
|
|
||||||
|
NewLpar = NewFpar;
|
||||||
|
NewFpar = aTmpPar;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsFwdSeq.Last()) {
|
||||||
|
// Update last parameter
|
||||||
|
LparSeq(LparSeq.Length()) = NewLpar;
|
||||||
|
} else {
|
||||||
|
// Update first parameter
|
||||||
|
FparSeq(FparSeq.Length()) = NewFpar;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Add new curve.
|
||||||
CurveSeq.Append(aCurve);
|
CurveSeq.Append(aCurve);
|
||||||
TopoDS_Shape aLocShape;
|
|
||||||
aLocShape.Location(aLoc);
|
|
||||||
aLocShape.Orientation(wexp.Orientation());
|
|
||||||
LocSeq.Append(aLocShape);
|
|
||||||
FparSeq.Append(fpar);
|
FparSeq.Append(fpar);
|
||||||
LparSeq.Append(lpar);
|
LparSeq.Append(lpar);
|
||||||
TolSeq.Append(BRep_Tool::Tolerance(CurVertex));
|
IsFwdSeq.Append(isFwd);
|
||||||
|
TolSeq.Append(BRep_Tool::Tolerance(wexp.CurrentVertex()));
|
||||||
CurType = aType;
|
CurType = aType;
|
||||||
}
|
}
|
||||||
} //end of else (not first time)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LastVertex = wexp.CurrentVertex();
|
LastVertex = wexp.CurrentVertex();
|
||||||
TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
|
TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
|
||||||
|
|
||||||
TopoDS_Vertex FirstVtx_final = (FinalReverse)? LastVertex : FirstVertex;
|
Standard_Boolean isReverse = Standard_False;
|
||||||
|
|
||||||
|
if (!IsFwdSeq.IsEmpty()) {
|
||||||
|
isReverse = !IsFwdSeq(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TopoDS_Vertex FirstVtx_final = (isReverse)? LastVertex : FirstVertex;
|
||||||
FirstVtx_final.Orientation(TopAbs_FORWARD);
|
FirstVtx_final.Orientation(TopAbs_FORWARD);
|
||||||
TopoDS_Vertex LastVtx_final = (FinalReverse)? FirstVertex : LastVertex;
|
TopoDS_Vertex LastVtx_final = (isReverse)? FirstVertex : LastVertex;
|
||||||
LastVtx_final.Orientation(TopAbs_REVERSED);
|
LastVtx_final.Orientation(TopAbs_REVERSED);
|
||||||
|
|
||||||
if (CurveSeq.IsEmpty())
|
if (CurveSeq.IsEmpty())
|
||||||
@ -512,10 +491,11 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
|||||||
|
|
||||||
Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i));
|
Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i));
|
||||||
tab(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
|
tab(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
|
||||||
tab(i-1)->Transform(LocSeq(i).Location().Transformation());
|
|
||||||
GeomConvert::C0BSplineToC1BSplineCurve(tab(i-1), Precision::Confusion());
|
GeomConvert::C0BSplineToC1BSplineCurve(tab(i-1), Precision::Confusion());
|
||||||
if (LocSeq(i).Orientation() == TopAbs_REVERSED)
|
|
||||||
|
if (!IsFwdSeq(i)) {
|
||||||
tab(i-1)->Reverse();
|
tab(i-1)->Reverse();
|
||||||
|
}
|
||||||
|
|
||||||
//Temporary
|
//Temporary
|
||||||
//char* name = new char[100];
|
//char* name = new char[100];
|
||||||
@ -574,13 +554,15 @@ TopoDS_Edge BRepAlgo::ConcatenateWireC0(const TopoDS_Wire& aWire)
|
|||||||
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
|
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
|
||||||
CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve();
|
CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve();
|
||||||
|
|
||||||
CurveSeq(1)->Transform(LocSeq(1).Location().Transformation());
|
Handle(Geom_Curve) aCopyCurve =
|
||||||
ResEdge = BRepLib_MakeEdge(CurveSeq(1),
|
Handle(Geom_Curve)::DownCast(CurveSeq(1)->Copy());
|
||||||
|
|
||||||
|
ResEdge = BRepLib_MakeEdge(aCopyCurve,
|
||||||
FirstVtx_final, LastVtx_final,
|
FirstVtx_final, LastVtx_final,
|
||||||
FparSeq(1), LparSeq(1));
|
FparSeq(1), LparSeq(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FinalReverse)
|
if (isReverse)
|
||||||
ResEdge.Reverse();
|
ResEdge.Reverse();
|
||||||
|
|
||||||
return ResEdge;
|
return ResEdge;
|
||||||
|
23
tests/bugs/modalg_5/bug24107
Executable file
23
tests/bugs/modalg_5/bug24107
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "OCC24107"
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# BRepAlgo::ConcatenateWireC0 method doesn't work on a translated wire
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug24107_wire.brep] w
|
||||||
|
|
||||||
|
concatC0wire result w
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
set tolmax_w [tolmax w]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmax_w} full CMP_TOL
|
||||||
|
|
||||||
|
set tolmax_result [tolmax result]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmax_result} full MaxTolerance
|
||||||
|
|
||||||
|
if { ${MaxTolerance} > [expr 2 * ${CMP_TOL}] } {
|
||||||
|
puts "Error: invalid tolerance of result wire"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user