mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0024573: Wrong result of 2d-offset algorithm on customer's shape
Test cases for issue CR24573
This commit is contained in:
parent
e226a50679
commit
8a6db25a62
@ -808,7 +808,7 @@ void Bisector_BisecAna::Perform(const Handle(Geom2d_Curve)& afirstcurve ,
|
||||
// Bissectrice point - circle. +
|
||||
//=============================================================================
|
||||
case 1 : {
|
||||
GccAna_CircPnt2dBisec Bisector(circle,asecondpoint->Pnt2d());
|
||||
GccAna_CircPnt2dBisec Bisector(circle, asecondpoint->Pnt2d(), tolerance);
|
||||
Standard_Real distancemini = Precision::Infinite();
|
||||
if (Bisector.IsDone()) {
|
||||
Standard_Integer nbsolution = Bisector.NbSolutions();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
//=========================================================================
|
||||
// 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). +
|
||||
//=========================================================================
|
||||
DefineSolutions();
|
||||
}
|
||||
|
||||
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);
|
||||
|
32
tests/bugs/modalg_5/bug24573
Executable file
32
tests/bugs/modalg_5/bug24573
Executable file
@ -0,0 +1,32 @@
|
||||
puts "============"
|
||||
puts "OCC24573"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result of 2d-offset algorithm on customer's shape
|
||||
#######################################################################
|
||||
|
||||
set BugNumber OCC24573
|
||||
|
||||
puts "Load shape ..."
|
||||
restore [locate_data_file bug24573_Wire.brep] ww
|
||||
|
||||
if [catch { mkoffset resoffset ww 1 12.5 } ] {
|
||||
puts "Faulty ${BugNumber} : mkoffset is wrong"
|
||||
} else {
|
||||
renamevar resoffset_1 result
|
||||
|
||||
set length 178.54
|
||||
|
||||
set nb_v_good 10
|
||||
set nb_e_good 10
|
||||
set nb_w_good 1
|
||||
set nb_f_good 0
|
||||
set nb_sh_good 0
|
||||
set nb_sol_good 0
|
||||
set nb_compsol_good 0
|
||||
set nb_compound_good 0
|
||||
set nb_shape_good 21
|
||||
}
|
||||
|
||||
set 2dviewer 1
|
9
tests/offset/wire_closed_inside_0_005/B4
Normal file → Executable file
9
tests/offset/wire_closed_inside_0_005/B4
Normal file → Executable file
@ -1,5 +1,10 @@
|
||||
puts "TODO OCC23068 ALL: Error : big tolerance of shape result"
|
||||
puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_2"
|
||||
puts "TODO ?OCC23068 ALL: Error : big tolerance of shape result"
|
||||
puts "TODO ?OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
|
||||
puts "TODO OCC23068 ALL: Standard_Failure: BRepFill_OffsetWire::FixHoles"
|
||||
puts "TODO OCC23068 ALL: Error: Offset is not done"
|
||||
puts "TODO OCC23068 ALL: Error : The offset cannot be built"
|
||||
|
||||
restore [locate_data_file offset_wire_018.brep] s
|
||||
|
||||
set length 24.8301
|
||||
|
8
tests/offset/wire_closed_inside_0_025/B4
Normal file → Executable file
8
tests/offset/wire_closed_inside_0_025/B4
Normal file → Executable file
@ -1,5 +1,9 @@
|
||||
puts "TODO OCC23068 ALL: Error : big tolerance of shape result"
|
||||
puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_3"
|
||||
puts "TODO ?OCC23068 ALL: Error : big tolerance of shape result"
|
||||
puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO OCC23068 ALL: Error : result_1 is NOT a closed wire"
|
||||
puts "TODO OCC23068 ALL: Error : The length of the resulting shape is"
|
||||
puts "TODO OCC23068 ALL: Error : The resulting shape is WRONG because it must contain"
|
||||
|
||||
restore [locate_data_file offset_wire_018.brep] s
|
||||
|
||||
set length 23.8673
|
||||
|
4
tests/offset/wire_closed_inside_0_075/B4
Normal file → Executable file
4
tests/offset/wire_closed_inside_0_075/B4
Normal file → Executable file
@ -3,6 +3,10 @@ puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
|
||||
puts "TODO ?OCC23068 ALL: An exception was caught"
|
||||
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
|
||||
puts "TODO ?OCC23748 ALL: Error: Offset is not done."
|
||||
puts "TODO ?OCC23748 ALL: Error : result is NOT a closed wire"
|
||||
puts "TODO ?OCC23748 ALL: Faulty shapes in variables faulty_1 to faulty_"
|
||||
puts "TODO ?OCC23748 ALL: Error : The length of the resulting shape is"
|
||||
puts "TODO ?OCC23748 ALL: Error : The resulting shape is WRONG"
|
||||
|
||||
restore [locate_data_file offset_wire_018.brep] s
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user