1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0027891: Visualization - FPE due to use of DBL_MAX in SelectMgr_SelectingVolumeManager::DetectedPoint()

This commit is contained in:
kgv 2016-09-23 15:33:40 +03:00
parent 8e5fb5eabc
commit 949c9b7f28
6 changed files with 14 additions and 6 deletions

View File

@ -380,7 +380,9 @@ Standard_Real SelectMgr_SelectingVolumeManager::DistToGeometryCenter (const gp_P
gp_Pnt SelectMgr_SelectingVolumeManager::DetectedPoint (const Standard_Real theDepth) const gp_Pnt SelectMgr_SelectingVolumeManager::DetectedPoint (const Standard_Real theDepth) const
{ {
if (myActiveSelectionType != Point) if (myActiveSelectionType != Point)
return gp_Pnt (RealLast(), RealLast(), RealLast()); {
Standard_ProgramError::Raise ("SelectMgr_SelectingVolumeManager::DetectedPoint() should be called only for Point selection type");
}
return mySelectingVolumes[Frustum]->DetectedPoint (theDepth); return mySelectingVolumes[Frustum]->DetectedPoint (theDepth);
} }

View File

@ -154,8 +154,8 @@ public:
//! screen point and given point theCOG //! screen point and given point theCOG
Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE; Standard_EXPORT virtual Standard_Real DistToGeometryCenter (const gp_Pnt& theCOG) Standard_OVERRIDE;
//! Calculates the point on a view ray that was detected during the run of selection algo by given depth. Is valid for point //! Calculates the point on a view ray that was detected during the run of selection algo by given depth.
//! selection only //! Throws exception if active selection type is not Point.
Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE; Standard_EXPORT virtual gp_Pnt DetectedPoint (const Standard_Real theDepth) const Standard_OVERRIDE;
//! Checks if the point of sensitive in which selection was detected belongs //! Checks if the point of sensitive in which selection was detected belongs

View File

@ -64,6 +64,11 @@ namespace {
const gp_GTrsf& theInversedTrsf, const gp_GTrsf& theInversedTrsf,
SelectMgr_SelectingVolumeManager& theMgr) SelectMgr_SelectingVolumeManager& theMgr)
{ {
if (theMgr.GetActiveSelectionType() != SelectMgr_SelectingVolumeManager::Point)
{
return;
}
theCriterion.Point = theMgr.DetectedPoint (theCriterion.Depth); theCriterion.Point = theMgr.DetectedPoint (theCriterion.Depth);
gp_GTrsf anInvTrsf = theInversedTrsf; gp_GTrsf anInvTrsf = theInversedTrsf;
if (theCriterion.Entity->HasInitLocation()) if (theCriterion.Entity->HasInitLocation())

View File

@ -4530,7 +4530,7 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
aName.LeftJustify (20, ' '); aName.LeftJustify (20, ' ');
char anInfoStr[512]; char anInfoStr[512];
Sprintf (anInfoStr, Sprintf (anInfoStr,
" Depth: %+.3f Distance: %+.3f Point: %+.3f %+.3f %+.3f", " Depth: %g Distance: %g Point: %g %g %g",
aPickData.Depth, aPickData.Depth,
aPickData.MinDist, aPickData.MinDist,
aPickData.Point.X(), aPickData.Point.Y(), aPickData.Point.Z()); aPickData.Point.X(), aPickData.Point.Y(), aPickData.Point.Z());

View File

@ -71,5 +71,6 @@ vselect 50 223 235 395
if { [vreadpixel 132 300 rgb name] != "GRAY66" } { puts "Error selecting trihedron persistence object" } if { [vreadpixel 132 300 rgb name] != "GRAY66" } { puts "Error selecting trihedron persistence object" }
vselect 50 380 400 50 vselect 50 380 400 50
vstate -entities
checkview -screenshot -3d -path ${imagedir}/${test_image}.png checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -11,7 +11,7 @@ proc check_output {theInfo} {
for {set i 0} {$i < $aSize} {incr i} { for {set i 0} {$i < $aSize} {incr i} {
if {[string equal [lindex $theInfo $i] "Depth:"]} { if {[string equal [lindex $theInfo $i] "Depth:"]} {
set aDepth [lindex $theInfo [expr $i + 1]] set aDepth [lindex $theInfo [expr $i + 1]]
if {[string equal $aDepth "+17.569"]} { if {[string equal $aDepth "17.5691"]} {
return 1 return 1
} else { } else {
return $aDepth return $aDepth
@ -38,7 +38,7 @@ set aResult [check_output $anInfo]
if {$aResult == 1} { if {$aResult == 1} {
puts "OK" puts "OK"
} else { } else {
puts "ERROR: the depth value is incorrect: should be +17.569, but is equal to:" puts "ERROR: the depth value is incorrect: should be 17.5691, but is equal to:"
puts $aResult puts $aResult
} }