mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0028784: [HLR] Crash while getting hidden lines for a compound
Method HLRBRep_PolyHLRToShape::InternalCompound is modified: avoid creation an edge with null length. Add testing Draw command.
This commit is contained in:
parent
5e3047fd4a
commit
1fae7cdaf1
@ -132,8 +132,13 @@ HLRBRep_PolyHLRToShape::InternalCompound (const Standard_Integer typ,
|
||||
if (todraw)
|
||||
if (!S.IsNull()) todraw = Map.Contains(BP.Shape());
|
||||
if (todraw) {
|
||||
B.Add(Result,BRepLib_MakeEdge2d(BP.P1(),BP.P2()));
|
||||
added = Standard_True;
|
||||
const gp_Pnt2d& FirstP2d = BP.P1();
|
||||
const gp_Pnt2d& LastP2d = BP.P2();
|
||||
if (FirstP2d.SquareDistance(LastP2d) > 1.e-20)
|
||||
{
|
||||
B.Add(Result,BRepLib_MakeEdge2d(BP.P1(),BP.P2()));
|
||||
added = Standard_True;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,7 +161,7 @@ HLRBRep_PolyHLRToShape::InternalCompound (const Standard_Integer typ,
|
||||
const gp_XY aSta2D(aSta.X(), aSta.Y());
|
||||
const gp_XY aEnd2D(aEnd.X(), aEnd.Y());
|
||||
const gp_XY aD = aEnd2D - aSta2D;
|
||||
if (aD.Modulus() > 1.e-10) {
|
||||
if (aD.SquareModulus() > 1.e-20) {
|
||||
B.Add(Result,BRepLib_MakeEdge2d(aSta2D, aEnd2D));
|
||||
added = Standard_True;
|
||||
}
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include <XCAFDoc_ShapeTool.hxx>
|
||||
|
||||
#include <HLRAppli_ReflectLines.hxx>
|
||||
#include <HLRBRep_PolyHLRToShape.hxx>
|
||||
#include <HLRBRep_PolyAlgo.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : SurfaceGenOCC26675_1
|
||||
@ -2305,6 +2307,32 @@ static Standard_Integer OCC28594(Draw_Interpretor& di, Standard_Integer argc, co
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer OCC28784(Draw_Interpretor&, Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc < 3)
|
||||
return 1;
|
||||
|
||||
TopoDS_Shape aShape = DBRep::Get(argv[2]);
|
||||
if (aShape.IsNull())
|
||||
return 1;
|
||||
|
||||
gp_Ax2 aPlane (gp::Origin(), gp::DX(), -gp::DZ());
|
||||
HLRAlgo_Projector aProjector(aPlane);
|
||||
|
||||
Handle(HLRBRep_PolyAlgo) aHLR = new HLRBRep_PolyAlgo(aShape);
|
||||
aHLR->Projector(aProjector);
|
||||
aHLR->Update();
|
||||
|
||||
HLRBRep_PolyHLRToShape aHLRtoShape;
|
||||
aHLRtoShape.Update(aHLR);
|
||||
|
||||
TopoDS_Shape aHidden = aHLRtoShape.HCompound();
|
||||
|
||||
DBRep::Set(argv[1], aHidden);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
const char *group = "QABugs";
|
||||
|
||||
@ -2326,6 +2354,7 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
theCommands.Add("OCC27875", "OCC27875 curve", __FILE__, OCC27875, group);
|
||||
theCommands.Add("OCC28389", "OCC28389", __FILE__, OCC28389, group);
|
||||
theCommands.Add("OCC28594", "OCC28594", __FILE__, OCC28594, group);
|
||||
theCommands.Add("OCC28784", "OCC28784 result shape", __FILE__, OCC28784, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
20
tests/bugs/modalg_7/bug28784
Executable file
20
tests/bugs/modalg_7/bug28784
Executable file
@ -0,0 +1,20 @@
|
||||
puts "========"
|
||||
puts "OCC28784"
|
||||
puts "========"
|
||||
puts ""
|
||||
#######################################################
|
||||
# [HLR] Crash while getting hidden lines for a compound
|
||||
#######################################################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
restore [locate_data_file bug28784_MHX_SKG_MS_Pos1_simplified.brep] a
|
||||
OCC28784 result a
|
||||
|
||||
checknbshapes result -edge 236
|
||||
|
||||
smallview
|
||||
top
|
||||
donly result
|
||||
fit
|
||||
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user