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

0024573: Wrong result of 2d-offset algorithm on customer's shape

Test cases for issue CR24573
This commit is contained in:
jgv
2014-01-30 16:07:12 +04:00
committed by bugmaster
parent e226a50679
commit 8a6db25a62
7 changed files with 107 additions and 38 deletions

View File

@@ -46,6 +46,18 @@ Create(Circle1 : Circ2d from gp;
---Purpose: Constructs bisecting curves between the circle Circle1 and the point Point2.
Create(Circle1 : Circ2d from gp;
Point2 : Pnt2d from gp;
Tolerance : Real from Standard) returns CircPnt2dBisec;
---Purpose: Constructs bisecting curves between the circle Circle1 and the point Point2.
-- Tolerance is used.
DefineSolutions(me: in out)
is private;
---Purpose: Defines the number and the type of solutions
-- depending on input data
IsDone(me) returns Boolean from Standard
is static;
---Purpose: Returns true (this construction algorithm never fails).
@@ -84,4 +96,6 @@ fields
-- theposition = 0 when the point is on the circle.
-- theposition = -1 when the point is inside the circle.
myTolerance : Real from Standard;
end CircPnt2dBisec;

View File

@@ -36,39 +36,49 @@
GccAna_CircPnt2dBisec::
GccAna_CircPnt2dBisec (const gp_Circ2d& Circle ,
const gp_Pnt2d& Point ):
const gp_Pnt2d& Point )
{
circle = Circle;
point = Point;
myTolerance = 1.e-10;
DefineSolutions();
}
circle(Circle),
point(Point) {
GccAna_CircPnt2dBisec::
GccAna_CircPnt2dBisec (const gp_Circ2d& Circle ,
const gp_Pnt2d& Point,
const Standard_Real Tolerance)
{
circle = Circle;
point = Point;
myTolerance = 1.e-10;
if (myTolerance < Tolerance)
myTolerance = Tolerance;
DefineSolutions();
}
//=========================================================================
// Initialization of fields : +
// - circle ( first argument.) +
// - line ( second argument.) +
// - theposition (Integer showing the position of Point +
// correspondingly to Circle.) +
// - NbrSol (Integer showing the number of solutions.) +
// - WellDone (Booleen showing the success or failure of the algorithm). +
//=========================================================================
Standard_Real dist = Circle.Radius()-Point.Distance(Circle.Location());
// if (Abs(dist) < gp::Resolution())
if (Abs(dist) < 1.E-10)
{
theposition = 0;
NbrSol = 1;
}
else if (dist > 0.0)
{
theposition = -1;
NbrSol = 1;
}
else {
theposition = 1;
NbrSol = 2;
}
WellDone = Standard_True;
}
void GccAna_CircPnt2dBisec::DefineSolutions()
{
Standard_Real dist = circle.Radius() - point.Distance(circle.Location());
if (Abs(dist) < myTolerance)
{
theposition = 0;
NbrSol = 1;
}
else if (dist > 0.0)
{
theposition = -1;
NbrSol = 1;
}
else {
theposition = 1;
NbrSol = 2;
}
WellDone = Standard_True;
}
//=========================================================================
// Processing. +
@@ -99,8 +109,8 @@ Handle(GccInt_Bisec) GccAna_CircPnt2dBisec::
Standard_Real ycencir = circle.Location().Y();
Standard_Real R1 = circle.Radius();
Standard_Real dist = point.Distance(circle.Location());
// if (dist < gp::Resolution())
if (dist < 1.E-10)
if (dist < myTolerance)
{
gp_Circ2d biscirpnt1(gp_Ax2d(point,gp_Dir2d(1.0,0.0)),R1/2.);
bissol = new GccInt_BCirc(biscirpnt1);