mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027848: Visualization - sensitivity of lines is too high
Improved objects sorting by depth. The sensitivity calculation for the manipulator has been changed. Now the sensitivity of the elements of the manipulator depends on its size. Also fixed the problem of erroneous selection of unfilled circles (SelectMgr_Frustum<N>::hasCircleOverlap() function). Test case vselect/bugs/bug27848 added.
This commit is contained in:
@@ -869,32 +869,27 @@ Standard_Boolean SelectMgr_Frustum<N>::hasCircleOverlap (const Standard_Real the
|
||||
const gp_Pnt aCenterProject (aCoefA * aTCenter,
|
||||
aCoefB * aTCenter,
|
||||
aCoefC * aTCenter);
|
||||
if (isDotInside (aCenterProject, aVertices))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Standard_Boolean isInside = true;
|
||||
const Standard_Boolean isCenterInside = isDotInside (aCenterProject, aVertices);
|
||||
|
||||
Standard_Boolean isInside = false;
|
||||
for (Standard_Integer anIdx = aVertices.Lower(); anIdx <= aVertices.Upper(); anIdx++)
|
||||
{
|
||||
if (aVertices.Value (anIdx).Distance (aCenterProject) > theRadius)
|
||||
{
|
||||
isInside = false;
|
||||
isInside = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (theInside != NULL)
|
||||
{
|
||||
*theInside = false;
|
||||
*theInside = isInside && isCenterInside;
|
||||
}
|
||||
|
||||
if (!theIsFilled && isInside)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return isInside;
|
||||
return theIsFilled
|
||||
? !isInside || (isCenterInside && isInside)
|
||||
: isInside && isCenterInside;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -58,12 +58,33 @@ public:
|
||||
return ZLayerPosition > theOther.ZLayerPosition;
|
||||
}
|
||||
|
||||
// closest object is selected unless difference is within tolerance
|
||||
if (Abs (Depth - theOther.Depth) > (Tolerance + theOther.Tolerance))
|
||||
// closest object is selected if their depths are not equal within tolerance
|
||||
if (Abs (Depth - theOther.Depth) > Tolerance + theOther.Tolerance)
|
||||
{
|
||||
return Depth < theOther.Depth;
|
||||
}
|
||||
|
||||
Standard_Real aCos = 1.0;
|
||||
if (Normal.Modulus() > 0 && theOther.Normal.Modulus() > 0)
|
||||
{
|
||||
gp_Dir aNormal (Normal.x(), Normal.y(), Normal.z());
|
||||
gp_Dir anOtherNormal (theOther.Normal.x(), theOther.Normal.y(), theOther.Normal.z());
|
||||
aCos = Abs (Cos (aNormal.Angle (anOtherNormal)));
|
||||
}
|
||||
|
||||
Standard_Real aDepth = Depth - Tolerance;
|
||||
Standard_Real anOtherDepth = theOther.Depth - theOther.Tolerance;
|
||||
// Comparison depths taking into account tolerances occurs when the surfaces are parallel
|
||||
// or have the same sensitivity and the angle between them is less than 60 degrees.
|
||||
if (Abs (aDepth - anOtherDepth) > Precision::Confusion())
|
||||
{
|
||||
if ((aCos > 0.5 && Abs (Tolerance - theOther.Tolerance) < Precision::Confusion())
|
||||
|| Abs (aCos - 1.0) < Precision::Confusion())
|
||||
{
|
||||
return aDepth < anOtherDepth;
|
||||
}
|
||||
}
|
||||
|
||||
// if two objects have similar depth, select the one with higher priority
|
||||
if (Priority > theOther.Priority)
|
||||
{
|
||||
|
@@ -284,9 +284,9 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEnti
|
||||
aCriterion.NbOwnerMatches = aPrevCriterion->NbOwnerMatches;
|
||||
if (theMgr.GetActiveSelectionType() != SelectMgr_SelectionType_Box)
|
||||
{
|
||||
updatePoint3d (aCriterion, aPickResult, theEntity, theInversedTrsf, theMgr);
|
||||
if (aCriterion.IsCloserDepth (*aPrevCriterion))
|
||||
{
|
||||
updatePoint3d (aCriterion, aPickResult, theEntity, theInversedTrsf, theMgr);
|
||||
*aPrevCriterion = aCriterion;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user