1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0025935: Visualization, TKV3d, Exception when displaying shell in the viewer

Fixed processing of double precision numbers in Visual3d_View::MinMaxValues;
Test case for issue #25935.
This commit is contained in:
vpa 2015-03-30 12:28:26 +03:00 committed by bugmaster
parent 65360da3db
commit 53a701974a
4 changed files with 48 additions and 6 deletions

View File

@ -394,6 +394,7 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
} catch ( Standard_Failure ) {
// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
if ( aMode == 0 ) {
aSelection->Clear();
Bnd_Box B = BoundingBox();
Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);
Handle(Select3D_SensitiveBox) aSensitiveBox = new Select3D_SensitiveBox(aOwner,B);

View File

@ -72,9 +72,9 @@ inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_R
const Standard_Real theY,
const Standard_Real theZ)
{
return AddVertex (Standard_ShortReal (theX),
Standard_ShortReal (theY),
Standard_ShortReal (theZ));
return AddVertex (RealToShortReal (theX),
RealToShortReal (theY),
RealToShortReal (theZ));
}
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& theVertex,
@ -87,7 +87,7 @@ inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt& th
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
const Standard_Real theNX, const Standard_Real theNY, const Standard_Real theNZ)
{
return AddVertex (Standard_ShortReal (theX), Standard_ShortReal (theY), Standard_ShortReal (theZ),
return AddVertex (RealToShortReal (theX), RealToShortReal (theY), RealToShortReal (theZ),
Standard_ShortReal (theNX), Standard_ShortReal (theNY), Standard_ShortReal (theNZ));
}
@ -101,7 +101,7 @@ inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const gp_Pnt&
inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
const Standard_Real theTX, const Standard_Real theTY)
{
return AddVertex (Standard_ShortReal (theX), Standard_ShortReal (theY), Standard_ShortReal (theZ),
return AddVertex (RealToShortReal (theX), RealToShortReal (theY), RealToShortReal (theZ),
Standard_ShortReal (theTX), Standard_ShortReal (theTY));
}
@ -118,7 +118,7 @@ inline Standard_Integer Graphic3d_ArrayOfPrimitives::AddVertex (const Standard_R
const Standard_Real theNX, const Standard_Real theNY, const Standard_Real theNZ,
const Standard_Real theTX, const Standard_Real theTY)
{
return AddVertex (Standard_ShortReal (theX), Standard_ShortReal (theY), Standard_ShortReal (theZ),
return AddVertex (RealToShortReal (theX), RealToShortReal (theY), RealToShortReal (theZ),
Standard_ShortReal (theNX), Standard_ShortReal (theNY), Standard_ShortReal (theNZ),
Standard_ShortReal (theTX), Standard_ShortReal (theTY));
}

View File

@ -1714,6 +1714,18 @@ inline void addStructureBndBox (const Handle(Graphic3d_Structure)& theStruct,
// "FitAll" operation ignores object with transform persistence parameter
const Bnd_Box aBox = theStruct->MinMaxValues (theToIgnoreInfiniteFlag);
// To prevent float overflow at camera parameters calculation and further
// rendering, bounding boxes with at least one vertex coordinate out of
// float range are skipped by view fit algorithms
if (Abs (aBox.CornerMax().X()) >= ShortRealLast() ||
Abs (aBox.CornerMax().Y()) >= ShortRealLast() ||
Abs (aBox.CornerMax().Z()) >= ShortRealLast() ||
Abs (aBox.CornerMin().X()) >= ShortRealLast() ||
Abs (aBox.CornerMin().Y()) >= ShortRealLast() ||
Abs (aBox.CornerMin().Z()) >= ShortRealLast())
return;
theBndBox.Add (aBox);
}

29
tests/bugs/vis/bug25935 Normal file
View File

@ -0,0 +1,29 @@
puts "============"
puts "CR25935"
puts "Visualization, TKV3d, Exception when displaying shell in the viewer"
puts "============"
puts ""
pload VISUALIZATION MODELING
restore [locate_data_file bug25935.brep] aShape
explode aShape Sh
vinit
# check displaying and selection of a sub-shell of the shape
vdisplay aShape_3
vfit
vmoveto 214 200
checkcolor 214 200 0 1 1
vremove -all
# check displaying and selection of the whole shape
vdisplay aShape
vfit
vmoveto 192 211
vmoveto 213 191
vmoveto 205 205
vmoveto 197 194
checkcolor 205 205 0 1 1