1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026185: BRepOffsetAPI_MakeOffset: regressions on some customer's cases

Minor correction.

Test-cases for issue #26185

Modifications in test-cases according to developer's notes
This commit is contained in:
jgv
2015-05-28 15:25:42 +03:00
committed by bugmaster
parent a2ab27029b
commit 9eb68d382f
16 changed files with 230 additions and 77 deletions

View File

@@ -45,20 +45,22 @@ uses
Point from Geom2d ,
Pnt2d from gp ,
Vec2d from gp ,
Integer from Standard
Integer from Standard,
JoinType from GeomAbs
is
Create returns Bisec from Bisector;
Perform(me : in out ;
Cu1 : Curve from Geom2d ;
Cu2 : Curve from Geom2d ;
P : Pnt2d from gp ;
V1 : Vec2d from gp ;
V2 : Vec2d from gp ;
Sense : Real from Standard ;
Tolerance : Real from Standard ;
oncurve : Boolean from Standard = Standard_True );
Cu1 : Curve from Geom2d ;
Cu2 : Curve from Geom2d ;
P : Pnt2d from gp ;
V1 : Vec2d from gp ;
V2 : Vec2d from gp ;
Sense : Real from Standard ;
ajointype : JoinType from GeomAbs ;
Tolerance : Real from Standard ;
oncurve : Boolean from Standard = Standard_True );
--- Purpose : Performs the bisecting line between the curves
-- <Cu1> and <Cu2>.

View File

@@ -73,13 +73,14 @@ Bisector_Bisec::Bisector_Bisec()
//===========================================================================
void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
const Handle(Geom2d_Curve)& asecondcurve ,
const gp_Pnt2d& apoint ,
const gp_Vec2d& afirstvector ,
const gp_Vec2d& asecondvector ,
const Standard_Real adirection ,
const Standard_Real tolerance ,
const Standard_Boolean oncurve )
const Handle(Geom2d_Curve)& asecondcurve ,
const gp_Pnt2d& apoint ,
const gp_Vec2d& afirstvector ,
const gp_Vec2d& asecondvector ,
const Standard_Real adirection ,
const GeomAbs_JoinType ajointype ,
const Standard_Real tolerance ,
const Standard_Boolean oncurve )
{
Handle(Standard_Type) Type1 = afirstcurve ->DynamicType();
Handle(Standard_Type) Type2 = asecondcurve->DynamicType();
@@ -149,18 +150,19 @@ void Bisector_Bisec::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
//------------------------------------------------------------------
// Analytic Bissectrice.
//------------------------------------------------------------------
Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna();
BisAna->Perform(afirstcurve1 ,
asecondcurve1 ,
apoint ,
afirstvector ,
asecondvector ,
adirection ,
tolerance ,
oncurve );
UFirst = BisAna->ParameterOfStartPoint();
ULast = BisAna->ParameterOfEndPoint();
Bis = BisAna;
Handle(Bisector_BisecAna) BisAna = new Bisector_BisecAna();
BisAna->Perform(afirstcurve1 ,
asecondcurve1 ,
apoint ,
afirstvector ,
asecondvector ,
adirection ,
ajointype ,
tolerance ,
oncurve );
UFirst = BisAna->ParameterOfStartPoint();
ULast = BisAna->ParameterOfEndPoint();
Bis = BisAna;
}
else {
Standard_Boolean IsLine = Standard_False;

View File

@@ -27,6 +27,7 @@ inherits
uses
Shape from GeomAbs,
CurveType from GeomAbs,
JoinType from GeomAbs,
Curve from Geom2d,
Geometry from Geom2d,
TrimmedCurve from Geom2d,
@@ -43,14 +44,15 @@ is
Create returns BisecAna;
Perform(me : mutable ;
Cu1 : Curve from Geom2d ;
Cu2 : Curve from Geom2d ;
P : Pnt2d from gp ;
V1 : Vec2d from gp ;
V2 : Vec2d from gp ;
Sense : Real from Standard ;
Tolerance : Real from Standard ;
oncurve : Boolean from Standard = Standard_True );
Cu1 : Curve from Geom2d ;
Cu2 : Curve from Geom2d ;
P : Pnt2d from gp ;
V1 : Vec2d from gp ;
V2 : Vec2d from gp ;
Sense : Real from Standard ;
jointype : JoinType from GeomAbs ;
Tolerance : Real from Standard ;
oncurve : Boolean from Standard = Standard_True );
--- Purpose : Performs the bisecting line between the curves
-- <Cu1> and <Cu2>.
@@ -125,7 +127,8 @@ is
Sense : Real from Standard ;
U : out Real from Standard ;
sense : out Boolean from Standard ;
ok : out Boolean from Standard )
ok : out Boolean from Standard ;
IsBisecOfTwoLines : Boolean from Standard = Standard_False)
--- Purpose : Returns the distance between the point <P> and
-- the bisecting <Bis>.

View File

@@ -76,7 +76,8 @@ Standard_Real Bisector_BisecAna::Distance (
const Standard_Real adirection,
Standard_Real& aparameter,
Standard_Boolean& asense,
Standard_Boolean& astatus)
Standard_Boolean& astatus,
Standard_Boolean IsBisecOfTwoLines)
{
astatus = Standard_True;
@@ -153,30 +154,36 @@ Standard_Real Bisector_BisecAna::Distance (
else {
asense = Standard_True;
// Modified by Sergey KHROMOV - Tue Oct 22 16:35:51 2002 Begin
// Replacement of -1.E-8 for a tolerance 1.e-4
Standard_Real aTol = 1.e-4;
if ((afirstdir^secdirrev)*adirection < -0.1) { // input
if((afirstdir^tangdir)*adirection < aTol &&
(secdirrev^tangdir)*adirection < aTol) asense = Standard_False;
}
else if((afirstdir^secdirrev)*adirection > 0.1) { // output
if((afirstdir^tangdir)*adirection < aTol ||
(secdirrev^tangdir)*adirection < aTol) asense = Standard_False;
}
else { // flat
if (afirstdir.Dot(secdirrev) > 0.) { // tangent
if ((afirstdir^tangdir)*adirection < 0.) asense = Standard_False;
if (!IsBisecOfTwoLines)
{
// Modified by Sergey KHROMOV - Tue Oct 22 16:35:51 2002 Begin
// Replacement of -1.E-8 for a tolerance 1.e-4
Standard_Real aTol = 1.e-4;
if ((afirstdir^secdirrev)*adirection < -0.1) { // input
if((afirstdir^tangdir)*adirection < aTol &&
(secdirrev^tangdir)*adirection < aTol)
asense = Standard_False;
}
else{ // turn back
// Modified by Sergey KHROMOV - Thu Oct 31 14:16:53 2002
// if ((afirstdir.Dot(tangdir))*adirection > 0.) asense = Standard_False;
if (afirstdir.Dot(tangdir) < 0.) asense = Standard_False;
// Modified by Sergey KHROMOV - Thu Oct 31 14:16:54 2002
else if((afirstdir^secdirrev)*adirection > 0.1) { // output
if((afirstdir^tangdir)*adirection < aTol ||
(secdirrev^tangdir)*adirection < aTol)
asense = Standard_False;
}
else { // flat
if (afirstdir.Dot(secdirrev) > 0.) { // tangent
if ((afirstdir^tangdir)*adirection < 0.)
asense = Standard_False;
}
else{ // turn back
// Modified by Sergey KHROMOV - Thu Oct 31 14:16:53 2002
// if ((afirstdir.Dot(tangdir))*adirection > 0.) asense = Standard_False;
if (afirstdir.Dot(tangdir) < 0.) asense = Standard_False;
// Modified by Sergey KHROMOV - Thu Oct 31 14:16:54 2002
}
}
// Modified by Sergey KHROMOV - Tue Oct 22 16:35:51 2002 End
}
// Modified by Sergey KHROMOV - Tue Oct 22 16:35:51 2002 End
}
return distance;
}
@@ -198,6 +205,7 @@ void Bisector_BisecAna::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
const gp_Vec2d& afirstvector ,
const gp_Vec2d& asecondvector ,
const Standard_Real adirection ,
const GeomAbs_JoinType ajointype ,
const Standard_Real tolerance ,
const Standard_Boolean oncurve )
{
@@ -625,14 +633,26 @@ void Bisector_BisecAna::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
}
else if (type == GccInt_Par) {
bisectorcurve = new Geom2d_Parabola(TheSol->Parabola());
Standard_Real FocalLength = ((Handle(Geom2d_Parabola)&)bisectorcurve)->Focal();
Standard_Real secondparameter = Precision::Infinite();
if (!thesense)
{
if (ajointype == GeomAbs_Intersection &&
4.*FocalLength < firstparameter) //first parameter is too far from peak of parabola
secondparameter = 0.;
thebisector = new Geom2d_TrimmedCurve(bisectorcurve,
firstparameter,
- Precision::Infinite());
-secondparameter);
}
else
{
if (ajointype == GeomAbs_Intersection &&
firstparameter < -4.*FocalLength) //first parameter is too far from peak of parabola
secondparameter = 0.;
thebisector = new Geom2d_TrimmedCurve(bisectorcurve,
firstparameter,
Precision::Infinite());
secondparameter);
}
}
}
}
@@ -714,7 +734,7 @@ void Bisector_BisecAna::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
else
distanceptsol = Distance(apoint,solution,
afirstvector,asecondvector,
adirection,parameter,sense,ok);
adirection,parameter,sense,ok, Standard_True);
// Modified by skv - Tue Feb 15 17:51:29 2005 Integration End
if (ok || !oncurve) {
thesense = sense;