OpenCASCADE 6.9.1(估計從6.9.0開始),使用新的屏幕選擇算法,我使用6.8開發的程序,升級到6.9.1之后,使用IVTK部分模型無法選中幾何元素,經過調試發現6.9.1代碼有BUG,導致數據丟失,無法判斷選中的元素是否在選擇范圍,BUG出現的文件為SelectMgr_RectangularFrustum.cxx中的函數ScaleAndTransform
NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_RectangularFrustum::ScaleAndTransform (const Standard_Integer theScaleFactor,
                                                                                           const gp_Trsf& theTrsf)
{
  Standard_ASSERT_RAISE (theScaleFactor > 0,
    "Error! Pixel tolerance for selection should be greater than zero");
  SelectMgr_RectangularFrustum* aRes = new SelectMgr_RectangularFrustum();
  const Standard_Boolean isToScale = theScaleFactor != 1;
  const Standard_Boolean isToTrsf  = theTrsf.Form() != gp_Identity;
  if (!isToScale && !isToTrsf)
return aRes ;//這里,當部分模型滿足該條件,返回一個空的數據,使用該數據無法判斷模型是否在區域
  aRes->myIsOrthographic = myIsOrthographic;
  SelectMgr_RectangularFrustum* aRef = this;
  if (isToScale)
  {
    aRes->myNearPickedPnt = myNearPickedPnt;
    aRes->myFarPickedPnt  = myFarPickedPnt;
    aRes->myViewRayDir    = myViewRayDir;
    const gp_Pnt2d aMinPnt (myMousePos.X() - theScaleFactor * 0.5,
                            myMousePos.Y() - theScaleFactor * 0.5);
    const gp_Pnt2d aMaxPnt (myMousePos.X() + theScaleFactor * 0.5,
                            myMousePos.Y() + theScaleFactor * 0.5);
    // recompute base frustum characteristics from scratch
    computeFrustum (aMinPnt, aMaxPnt, myBuilder, aRes->myVertices, aRes->myEdgeDirs);
    aRef = aRes;
  }
  if (isToTrsf)
  {
    aRes->myNearPickedPnt = aRef->myNearPickedPnt.Transformed (theTrsf);
    aRes->myFarPickedPnt  = aRef->myFarPickedPnt.Transformed (theTrsf);
    aRes->myViewRayDir    = aRes->myFarPickedPnt.XYZ() - aRes->myNearPickedPnt.XYZ();
      // LeftTopNear
    aRes->myVertices[0] = aRef->myVertices[0].Transformed (theTrsf);
    // LeftTopFar
    aRes->myVertices[1] = aRef->myVertices[1].Transformed (theTrsf);
    // LeftBottomNear
    aRes->myVertices[2] = aRef->myVertices[2].Transformed (theTrsf);
    // LeftBottomFar
    aRes->myVertices[3] = aRef->myVertices[3].Transformed (theTrsf);
    // RightTopNear
    aRes->myVertices[4] = aRef->myVertices[4].Transformed (theTrsf);
    // RightTopFar
    aRes->myVertices[5] = aRef->myVertices[5].Transformed (theTrsf);
    // RightBottomNear
    aRes->myVertices[6] = aRef->myVertices[6].Transformed (theTrsf);
    // RightBottomFar
    aRes->myVertices[7] = aRef->myVertices[7].Transformed (theTrsf);
    // Horizontal
    aRes->myEdgeDirs[0] = aRes->myVertices[4].XYZ() - aRes->myVertices[0].XYZ();
    // Vertical
    aRes->myEdgeDirs[1] = aRes->myVertices[2].XYZ() - aRes->myVertices[0].XYZ();
    // LeftLower
    aRes->myEdgeDirs[2] = aRes->myVertices[2].XYZ() - aRes->myVertices[3].XYZ();
    // RightLower
    aRes->myEdgeDirs[3] = aRes->myVertices[6].XYZ() - aRes->myVertices[7].XYZ();
    // LeftUpper
    aRes->myEdgeDirs[4] = aRes->myVertices[0].XYZ() - aRes->myVertices[1].XYZ();
    // RightUpper
    aRes->myEdgeDirs[5] = aRes->myVertices[4].XYZ() - aRes->myVertices[5].XYZ();
  }
  // compute frustum normals
  computeNormals (aRes->myEdgeDirs, aRes->myPlanes);
  cacheVertexProjections (aRes);
  return NCollection_Handle<SelectMgr_BaseFrustum> (aRes);
}
修改辦法:
  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);
  }