mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0025142: Visualization breaks triangulation on shared solids in composite solid model
Test case for 0025142: Visualization breaks triangulation on shared solids in composite solid model Do not clean the triangulation in StdPrs_ShadedShape::Tessellate() and let the triangulation tool process the sub-shapes properly. Treat triangulation consistently in all AIS classes (AIS_Shape, AIS_TexturedShape). Test cases for issue CR25142
This commit is contained in:
parent
ada5f62195
commit
50b830a09b
@ -423,23 +423,26 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AIS_Shaded:
|
case AIS_Shaded:
|
||||||
|
case 3: // texture mapping on triangulation
|
||||||
{
|
{
|
||||||
Standard_Real prevangle;
|
Standard_Real prevangle;
|
||||||
Standard_Real newangle;
|
Standard_Real newangle;
|
||||||
Standard_Real prevcoeff;
|
Standard_Real prevcoeff;
|
||||||
Standard_Real newcoeff;
|
Standard_Real newcoeff;
|
||||||
|
|
||||||
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle);
|
Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle);
|
||||||
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
|
Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
|
||||||
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
|
if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
|
||||||
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) {
|
((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) {
|
||||||
BRepTools::Clean (myshape);
|
BRepTools::Clean (myshape);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myshape.ShapeType() > TopAbs_FACE)
|
if (myshape.ShapeType() > TopAbs_FACE)
|
||||||
{
|
{
|
||||||
StdPrs_WFDeflectionShape::Add (thePrs, myshape, myDrawer);
|
StdPrs_WFDeflectionShape::Add (thePrs, myshape, myDrawer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
myDrawer->SetShadingAspectGlobal (Standard_False);
|
myDrawer->SetShadingAspectGlobal (Standard_False);
|
||||||
if (IsInfinite())
|
if (IsInfinite())
|
||||||
{
|
{
|
||||||
@ -449,7 +452,19 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
StdPrs_ShadedShape::Add (thePrs, myshape, myDrawer);
|
if (theMode == AIS_Shaded)
|
||||||
|
{
|
||||||
|
StdPrs_ShadedShape::Add (thePrs, myshape, myDrawer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StdPrs_ShadedShape::Add (thePrs, myshape, myDrawer,
|
||||||
|
Standard_True,
|
||||||
|
myIsCustomOrigin ? myUVOrigin : gp_Pnt2d (0.0, 0.0),
|
||||||
|
myUVRepeat,
|
||||||
|
myToScale ? myUVScale : gp_Pnt2d (1.0, 1.0));
|
||||||
|
updateAttributes (thePrs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Standard_Failure)
|
catch (Standard_Failure)
|
||||||
{
|
{
|
||||||
@ -470,27 +485,5 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: // texture mapping on triangulation
|
|
||||||
{
|
|
||||||
BRepTools::Clean (myshape);
|
|
||||||
BRepTools::Update (myshape);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
OCC_CATCH_SIGNALS
|
|
||||||
StdPrs_ShadedShape::Add (thePrs, myshape, myDrawer,
|
|
||||||
Standard_True,
|
|
||||||
myIsCustomOrigin ? myUVOrigin : gp_Pnt2d (0.0, 0.0),
|
|
||||||
myUVRepeat,
|
|
||||||
myToScale ? myUVScale : gp_Pnt2d (1.0, 1.0));
|
|
||||||
|
|
||||||
updateAttributes (thePrs);
|
|
||||||
}
|
|
||||||
catch (Standard_Failure)
|
|
||||||
{
|
|
||||||
std::cout << "AIS_TexturedShape::Compute() in ShadingMode failed\n";
|
|
||||||
StdPrs_WFShape::Add (thePrs, myshape, myDrawer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,6 @@ void StdPrs_ShadedShape::Tessellate (const TopoDS_Shape& theShape,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// retrieve meshing tool from Factory
|
// retrieve meshing tool from Factory
|
||||||
BRepTools::Clean (theShape);
|
|
||||||
Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape,
|
Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape,
|
||||||
aDeflection,
|
aDeflection,
|
||||||
theDrawer->HLRAngle());
|
theDrawer->HLRAngle());
|
||||||
|
47
tests/bugs/mesh/bug25142
Normal file
47
tests/bugs/mesh/bug25142
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "CR25142"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###################################################################################
|
||||||
|
# Visualization breaks triangulation on shared solids in composite solid model
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
# make two adjacent boxes share their common face
|
||||||
|
box b1 20 10 10
|
||||||
|
box b2 10 10 10
|
||||||
|
|
||||||
|
bclear
|
||||||
|
baddobjects b1 b2
|
||||||
|
bfillds
|
||||||
|
bbuild r
|
||||||
|
explode r
|
||||||
|
|
||||||
|
nbshapes r
|
||||||
|
|
||||||
|
# do all possible checks of validity
|
||||||
|
tolerance r
|
||||||
|
checkshape r
|
||||||
|
bopargcheck r #F
|
||||||
|
bopargcheck r_1 r_2 -F #F
|
||||||
|
|
||||||
|
# mesh one-by-one
|
||||||
|
incmesh r_1 0.1
|
||||||
|
tricheck r_1
|
||||||
|
|
||||||
|
# note it will be Ok if we use the same deflection here, and bad otherwise...
|
||||||
|
incmesh r_2 0.1
|
||||||
|
tricheck r_2
|
||||||
|
|
||||||
|
# now check again mesh on r_1
|
||||||
|
tricheck r_1
|
||||||
|
|
||||||
|
# now vdisplay solids separately causing their automatic re-mesh
|
||||||
|
tclean r
|
||||||
|
vinit View1
|
||||||
|
vsetdispmode 1
|
||||||
|
vdisplay r_1
|
||||||
|
vdisplay r_2
|
||||||
|
tricheck r_1
|
||||||
|
|
||||||
|
vfit
|
||||||
|
set only_screen 1
|
1
tests/bugs/mesh/parse.rules
Normal file
1
tests/bugs/mesh/parse.rules
Normal file
@ -0,0 +1 @@
|
|||||||
|
FAILED /Not connected mesh inside face/ disconnected mesh
|
@ -1,3 +1 @@
|
|||||||
set TheFileName shading_109.brep
|
set TheFileName shading_109.brep
|
||||||
set bug_cross "OCC22687"
|
|
||||||
set nbcross(All) 4
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user