Archived issue #0027011
SelectMgr_RectangularFrustum bug cause select face failed
Description
VIS module use SelectMgr_RectangularFrustum to dective shape,but when change to select face,OBB data failed,so select none face.To fix it,should rewrite blew function
NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_RectangularFrustum::ScaleAndTransform (const Standard_Integer theScaleFactor,
const gp_Trsf& theTrsf)
here
if (!isToScale && !isToTrsf)
return aRes ;//return a empty data,so test failed
I think fixed it
if (!isToScale && !isToTrsf)
{
aRes->myPixelTolerance=myPixelTolerance;
aRes->myIsOrthographic=myIsOrthographic;
aRes->myBuilder= myBuilder;
aRes->myIsOrthographic = myIsOrthographic;
aRes->myNearPickedPnt = myNearPickedPnt;
aRes->myFarPickedPnt = myFarPickedPnt;
aRes->myViewRayDir = myViewRayDir;
aRes->myMousePos = myMousePos;
for (int i = 0; i <6;++i)
{
aRes->myPlanes[i] = myPlanes[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myVertices[i] = myVertices[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myMaxVertsProjections[i] = myMaxVertsProjections[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myMinVertsProjections[i] = myMinVertsProjections[i];
}
for (int i = 0; i <3; ++i)
{
aRes->myMaxOrthoVertsProjections[i] = myMaxOrthoVertsProjections[i];
}
for (int i = 0; i <3; ++i)
{
aRes->myMinOrthoVertsProjections[i] = myMinOrthoVertsProjections[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myEdgeDirs[i] = myEdgeDirs[i];
}
return NCollection_Handle<SelectMgr_BaseFrustum>(aRes);
}
any good idea?
NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_RectangularFrustum::ScaleAndTransform (const Standard_Integer theScaleFactor,
const gp_Trsf& theTrsf)
here
if (!isToScale && !isToTrsf)
return aRes ;//return a empty data,so test failed
I think fixed it
if (!isToScale && !isToTrsf)
{
aRes->myPixelTolerance=myPixelTolerance;
aRes->myIsOrthographic=myIsOrthographic;
aRes->myBuilder= myBuilder;
aRes->myIsOrthographic = myIsOrthographic;
aRes->myNearPickedPnt = myNearPickedPnt;
aRes->myFarPickedPnt = myFarPickedPnt;
aRes->myViewRayDir = myViewRayDir;
aRes->myMousePos = myMousePos;
for (int i = 0; i <6;++i)
{
aRes->myPlanes[i] = myPlanes[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myVertices[i] = myVertices[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myMaxVertsProjections[i] = myMaxVertsProjections[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myMinVertsProjections[i] = myMinVertsProjections[i];
}
for (int i = 0; i <3; ++i)
{
aRes->myMaxOrthoVertsProjections[i] = myMaxOrthoVertsProjections[i];
}
for (int i = 0; i <3; ++i)
{
aRes->myMinOrthoVertsProjections[i] = myMinOrthoVertsProjections[i];
}
for (int i = 0; i < 6; ++i)
{
aRes->myEdgeDirs[i] = myEdgeDirs[i];
}
return NCollection_Handle<SelectMgr_BaseFrustum>(aRes);
}
any good idea?
Public activity
7 archived notes
Participants are labeled by their role within this record.
Hello Author,
maybe you can share Draw test script or sequence of OCCT API function calls here to reproduce the issue?
maybe you can share Draw test script or sequence of OCCT API function calls here to reproduce the issue?
My application use VTK,lately add OCC to build geometry,so data render with VTK,include selected shape.My first OCC version is 6.7.0,then update to 6.9.1,then I found that detecting face failed,and found the problem where occurred via debugging.
First call IVtkTools_ShapePicker::SetSelectionMode(GetDrawActor(), SM_Face, Standard_True)
then using mouse to pick shape via class IVtkDraw_Interactor,whne mouse moving,highlight the target shape via function
void IVtkDraw_Interactor::MoveTo (Standard_Integer theX, Standard_Integer theY)
the call stack likes blew
SelectMgr_RectangularFrustum::ScaleAndTransform line 327 C++
SelectMgr_SelectingVolumeManager::ScaleAndTransform line 57 C++
SelectMgr_ViewerSelector::computeFrustume line 279 C++
SelectMgr_ViewerSelector::traverseObject line 369 C++
SelectMgr_ViewerSelector::TraverseSensitives line 448 C++
IVtkOCC_ViewerSelector::Pick line 74 C++
IVtkOCC_ShapePickerAlgo::Pick line 208 C++
IVTKTools_ShapePicker::doPickImpl line 185 C++
IVTKTools_ShapePicker::pick line 156 C++
IVTKTools_ShapePicker::Pick line 107 C++
IVtkDraw_Interactor::MoveTo line 231 C++
IVtkDraw_Interactor::OnMouseMove line 941 C++
the bug only accurred when I load a file(STEP IGES or BREP),don't occur when I build a shape by parameters.
Function ScaleAndTransform return an empty SelectMgr_RectangularFrustum,this cause SelectMgr_ViewerSelector::checkOverlap
if (theEntity->Matches (theMgr, aPickResult)) not true,dective failed.
Is my misused or a bug?
First call IVtkTools_ShapePicker::SetSelectionMode(GetDrawActor(), SM_Face, Standard_True)
then using mouse to pick shape via class IVtkDraw_Interactor,whne mouse moving,highlight the target shape via function
void IVtkDraw_Interactor::MoveTo (Standard_Integer theX, Standard_Integer theY)
the call stack likes blew
SelectMgr_RectangularFrustum::ScaleAndTransform line 327 C++
SelectMgr_SelectingVolumeManager::ScaleAndTransform line 57 C++
SelectMgr_ViewerSelector::computeFrustume line 279 C++
SelectMgr_ViewerSelector::traverseObject line 369 C++
SelectMgr_ViewerSelector::TraverseSensitives line 448 C++
IVtkOCC_ViewerSelector::Pick line 74 C++
IVtkOCC_ShapePickerAlgo::Pick line 208 C++
IVTKTools_ShapePicker::doPickImpl line 185 C++
IVTKTools_ShapePicker::pick line 156 C++
IVTKTools_ShapePicker::Pick line 107 C++
IVtkDraw_Interactor::MoveTo line 231 C++
IVtkDraw_Interactor::OnMouseMove line 941 C++
the bug only accurred when I load a file(STEP IGES or BREP),don't occur when I build a shape by parameters.
Function ScaleAndTransform return an empty SelectMgr_RectangularFrustum,this cause SelectMgr_ViewerSelector::checkOverlap
if (theEntity->Matches (theMgr, aPickResult)) not true,dective failed.
Is my misused or a bug?
Dear Author,
I have tried different BREP shapes from standard OCCT dataset, but still can not reproduce the bug using the following Draw script on both OCCT v6.9.1 and current master:
pload ALL VIS
ivtkinit
restore $env(CASROOT)/data/occ/Bottom.brep b
ivtkdisplay b
ivtkfit
ivtkmoveto 200 200
ivtkmoveto 0 0
ivtksetselmode b 4 1
ivtkmoveto 200 200
It would be great if you can share problematic shape or/and add missing details to the test case.
In case if the shape is private, please give more details on following:
- are you customizing sensitivity factor of entities using SelectBasics_SensitiveEntity::SetSensitivityFactor or AIS_InteractiveContext::SetPixelTolerance?
- does problematic shape has any location transformations set?
I have tried different BREP shapes from standard OCCT dataset, but still can not reproduce the bug using the following Draw script on both OCCT v6.9.1 and current master:
pload ALL VIS
ivtkinit
restore $env(CASROOT)/data/occ/Bottom.brep b
ivtkdisplay b
ivtkfit
ivtkmoveto 200 200
ivtkmoveto 0 0
ivtksetselmode b 4 1
ivtkmoveto 200 200
It would be great if you can share problematic shape or/and add missing details to the test case.
In case if the shape is private, please give more details on following:
- are you customizing sensitivity factor of entities using SelectBasics_SensitiveEntity::SetSensitivityFactor or AIS_InteractiveContext::SetPixelTolerance?
- does problematic shape has any location transformations set?
I Debug again,the loaded file(for example brep file etc),the function of SelectBasics_SensitiveEntitystruct,HasInitLocation return true,it means the shape has TopLoc_Location data,then in file SelectMgr_RectangularFrustum.cxx,function ScaleAndTransform,line 324,
const Standard_Boolean isToScale = theScaleFactor != 1;
const Standard_Boolean isToTrsf = theTrsf.Form() != gp_Identity;
the result isToScale==1,and isToTrsf==1,then this function return an empty SelectMgr_RectangularFrustum,cause pick failed.
const Standard_Boolean isToScale = theScaleFactor != 1;
const Standard_Boolean isToTrsf = theTrsf.Form() != gp_Identity;
the result isToScale==1,and isToTrsf==1,then this function return an empty SelectMgr_RectangularFrustum,cause pick failed.
Dear Author,
please provide complete reproducible test case, either for Draw Harness (preferable) or C++ code with all referred models available.
please provide complete reproducible test case, either for Draw Harness (preferable) or C++ code with all referred models available.
May be It'a mis report,Just Close It.Sorry
Dear Commenter 1,
please close the bug.
please close the bug.