]> OCCT Git - occt-copy.git/commitdiff
0027536: Visualization - incorrect behavior of zoom persisted objects
authoraba <aba@opencascade.com>
Wed, 1 Jun 2016 15:37:51 +0000 (18:37 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 9 Jun 2016 09:29:09 +0000 (12:29 +0300)
1) Zoom persistence mode now fixes object in pixel coordinates and  is independent on view size

2) Used gp_GTrsf instead of gp_Trsf SelectMgr_ViewerSelector to store  Graphic3d_Mat4d

3) Zoom persisted objects changed behavior (become bigger) therefore test cases were updated according to new state.

4) Corrected scale for rectangular frustum

Updated test for manipulator

44 files changed:
src/Graphic3d/Graphic3d_TransformPers.hxx
src/MeshVS/MeshVS_DummySensitiveEntity.cxx
src/MeshVS/MeshVS_DummySensitiveEntity.hxx
src/OpenGl/OpenGl_BVHClipPrimitiveTrsfPersSet.cxx
src/OpenGl/OpenGl_BVHClipPrimitiveTrsfPersSet.hxx
src/OpenGl/OpenGl_BVHTreeSelector.cxx
src/OpenGl/OpenGl_BVHTreeSelector.hxx
src/OpenGl/OpenGl_Layer.cxx
src/OpenGl/OpenGl_View_Redraw.cxx
src/PrsMgr/PrsMgr_PresentableObject.hxx
src/PrsMgr/PrsMgr_PresentableObject.lxx
src/Select3D/Select3D_SensitiveEntity.cxx
src/Select3D/Select3D_SensitiveEntity.hxx
src/Select3D/Select3D_SensitivePrimitiveArray.hxx
src/Select3D/Select3D_SensitiveTriangulation.cxx
src/Select3D/Select3D_SensitiveTriangulation.hxx
src/SelectBasics/SelectBasics_SensitiveEntity.hxx
src/SelectMgr/SelectMgr_BaseFrustum.cxx
src/SelectMgr/SelectMgr_BaseFrustum.hxx
src/SelectMgr/SelectMgr_FrustumBuilder.cxx
src/SelectMgr/SelectMgr_FrustumBuilder.hxx
src/SelectMgr/SelectMgr_RectangularFrustum.cxx
src/SelectMgr/SelectMgr_RectangularFrustum.hxx
src/SelectMgr/SelectMgr_SelectableObjectTrsfPersSet.cxx
src/SelectMgr/SelectMgr_SelectableObjectTrsfPersSet.hxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.cxx
src/SelectMgr/SelectMgr_SelectingVolumeManager.hxx
src/SelectMgr/SelectMgr_TriangularFrustum.cxx
src/SelectMgr/SelectMgr_TriangularFrustum.hxx
src/SelectMgr/SelectMgr_TriangularFrustumSet.cxx
src/SelectMgr/SelectMgr_TriangularFrustumSet.hxx
src/SelectMgr/SelectMgr_ViewerSelector.cxx
src/SelectMgr/SelectMgr_ViewerSelector.hxx
src/ViewerTest/ViewerTest.cxx
tests/bugs/vis/bug25867
tests/bugs/vis/bug26344
tests/bugs/vis/bug26719_1
tests/bugs/vis/bug26719_2
tests/bugs/vis/bug26792
tests/bugs/vis/bug27536 [new file with mode: 0644]
tests/v3d/manipulator/rotate
tests/v3d/manipulator/scale
tests/v3d/manipulator/translate
tests/v3d/manipulator/zoom_persistence

index 4f5d6ba62569fc0079cb5f3b1260f26fd66fbd62..a687fad656c3817e2196a14f79a767181c213174 100644 (file)
@@ -158,10 +158,22 @@ void Graphic3d_TransformPers::Apply (NCollection_Mat4<T>& theProjection,
     }
 
     // Prevent zooming.
-    if ((Flags & Graphic3d_TMF_ZoomPers) || (Flags == Graphic3d_TMF_TriedronPers))
+    if (Flags & Graphic3d_TMF_ZoomPers)
+    {
+      const T aDet00 = (2.0f / theViewportWidth) / theProjection.GetValue(0, 0);
+      const T aDet11 = (2.0f / theViewportHeight) / theProjection.GetValue(1, 1);
+      const T aDet2 = Max (aDet00, aDet11);
+
+      theProjection.ChangeValue(0, 0) *= aDet00;
+      theProjection.ChangeValue(1, 1) *= aDet11;
+      theProjection.ChangeValue(2, 2) *= aDet2;
+    }
+
+    if (Flags == Graphic3d_TMF_TriedronPers)
     {
       // Compute fixed-zoom multiplier. Actually function works ugly with TelPerspective!
       const T aDet2 = static_cast<T> (0.002) / Max (theProjection.GetValue (1, 1), theProjection.GetValue (0, 0));
+
       theProjection.ChangeValue (0, 0) *= aDet2;
       theProjection.ChangeValue (1, 1) *= aDet2;
       theProjection.ChangeValue (2, 2) *= aDet2;
index dcae01aaba65347b55750eb22b87a98b1ea40edb..ce81d39f06509825025201ed9f585c5ec0d29c6f 100644 (file)
@@ -85,7 +85,7 @@ Standard_Boolean MeshVS_DummySensitiveEntity::HasInitLocation() const
 //function : InvInitLocation
 //purpose  :
 //=======================================================================
-inline gp_Trsf MeshVS_DummySensitiveEntity::InvInitLocation() const
+inline gp_GTrsf MeshVS_DummySensitiveEntity::InvInitLocation() const
 {
-  return gp_Trsf();
+  return gp_GTrsf();
 }
index f2981598a9ec93b10d60519540d329fa7dd8f96c..1e2bba9fde0160de70a3dfdbc8b60ff0cc9fe8a1 100644 (file)
@@ -49,7 +49,7 @@ public:
 
   Standard_EXPORT virtual Standard_Boolean HasInitLocation() const Standard_OVERRIDE;
 
-  Standard_EXPORT virtual gp_Trsf InvInitLocation() const Standard_OVERRIDE;
+  Standard_EXPORT virtual gp_GTrsf InvInitLocation() const Standard_OVERRIDE;
 
   DEFINE_STANDARD_RTTIEXT(MeshVS_DummySensitiveEntity,SelectBasics_SensitiveEntity)
 };
index 3807bc82b8740f7aa4fe754db06627f84cb19eff..e351367c43a9cf09cc8013514a9ca8f76162d839 100644 (file)
@@ -135,6 +135,8 @@ const OpenGl_Structure* OpenGl_BVHClipPrimitiveTrsfPersSet::GetStructureById (St
 const NCollection_Handle<BVH_Tree<Standard_ShortReal, 4> >&
   OpenGl_BVHClipPrimitiveTrsfPersSet::BVH (const OpenGl_Mat4& theProjectionMatrix,
                                            const OpenGl_Mat4& theWorldViewMatrix,
+                                           const Standard_Integer theViewportWidth,
+                                           const Standard_Integer theViewportHeight,
                                            const Graphic3d_WorldViewProjState& theWVPState)
 {
   if (!myIsDirty
@@ -152,7 +154,7 @@ const NCollection_Handle<BVH_Tree<Standard_ShortReal, 4> >&
 
     HBndBox4f aBoundingBox = new Graphic3d_BndBox4f;
     *aBoundingBox = aStructure->BoundingBox();
-     aStructure->TransformPersistence.Apply (theProjectionMatrix, theWorldViewMatrix, 0, 0, *aBoundingBox);
+     aStructure->TransformPersistence.Apply (theProjectionMatrix, theWorldViewMatrix, theViewportWidth, theViewportHeight, *aBoundingBox);
 
     myStructBoxes.Add (aBoundingBox);
   }
index 563554d7082680a20c238f1f6fb73caa5c7635c9..d838a0e42c9651c5e2ec76265cad6c2d5fb6f912 100644 (file)
@@ -78,6 +78,8 @@ public:
   //! Returns BVH tree for the given world view projection (builds it if necessary).
   const NCollection_Handle<BVH_Tree<Standard_ShortReal, 4> >& BVH (const OpenGl_Mat4& theProjectionMatrix,
                                                                    const OpenGl_Mat4& theWorldViewMatrix,
+                                                                   const Standard_Integer theViewportWidth,
+                                                                   const Standard_Integer theViewportHeight,
                                                                    const Graphic3d_WorldViewProjState& theWVPState);
 
 private:
index 09298ea4cbb97894ffa7bc772948b8e9f48f56dd..06992867007f2ea99055b888a24fe55ada963120 100644 (file)
@@ -122,6 +122,17 @@ void OpenGl_BVHTreeSelector::SetViewVolume (const Handle(Graphic3d_Camera)& theC
   }
 }
 
+// =======================================================================
+// function : SetViewportSize
+// purpose  :
+// =======================================================================
+void OpenGl_BVHTreeSelector::SetViewportSize (const Standard_Integer theViewportWidth,
+                                              const Standard_Integer theViewportHeight)
+{
+  myViewportHeight = theViewportHeight;
+  myViewportWidth = theViewportWidth;
+}
+
 // =======================================================================
 // function : SignedPlanePointDistance
 // purpose  :
index c111c21233cd2cafda19db44867eda753cefe48d..4824ddadc4d85380c3e5e8a7f8bc3f17c251dcd1 100644 (file)
@@ -33,6 +33,8 @@ public:
   //! Retrieves view volume's planes equations and its vertices from projection and world-view matrices.
   Standard_EXPORT void SetViewVolume (const Handle(Graphic3d_Camera)& theCamera);
 
+  Standard_EXPORT void SetViewportSize (const Standard_Integer theViewportWidth, const Standard_Integer theViewportHeight);
+
   //! Detects if AABB overlaps view volume using separating axis theorem (SAT).
   //! @param theMinPt [in] maximum point of AABB.
   //! @param theMaxPt [in] minimum point of AABB.
@@ -56,6 +58,16 @@ public:
     return myWorldViewMat;
   }
 
+  Standard_Integer ViewportWidth() const
+  {
+    return myViewportWidth;
+  }
+
+  Standard_Integer ViewportHeight() const
+  {
+    return myViewportHeight;
+  }
+
   //! Returns state of current world view projection transformation matrices.
   const Graphic3d_WorldViewProjState& WorldViewProjState() const
   {
@@ -118,6 +130,9 @@ protected:
   OpenGl_Mat4 myProjectionMat;
   OpenGl_Mat4 myWorldViewMat;
 
+  Standard_Integer myViewportWidth;
+  Standard_Integer myViewportHeight;
+
   Graphic3d_WorldViewProjState myWorldViewProjState; //!< State of world view projection matrices.
 };
 
index 9a5c2de1a7c1b0df89ea3e7b6c7a3e2a590ed368..8b420d76d497e1873bf44220b3bd62946b53dae2 100644 (file)
@@ -489,7 +489,10 @@ void OpenGl_Layer::traverse (OpenGl_BVHTreeSelector& theSelector) const
       const OpenGl_Mat4& aProjection                = theSelector.ProjectionMatrix();
       const OpenGl_Mat4& aWorldView                 = theSelector.WorldViewMatrix();
       const Graphic3d_WorldViewProjState& aWVPState = theSelector.WorldViewProjState();
-      aBVHTree = myBVHPrimitivesTrsfPers.BVH (aProjection, aWorldView, aWVPState);
+      const Standard_Integer aViewportWidth         = theSelector.ViewportWidth();
+      const Standard_Integer aViewportHeight        = theSelector.ViewportHeight();
+
+      aBVHTree = myBVHPrimitivesTrsfPers.BVH (aProjection, aWorldView, aViewportWidth, aViewportHeight, aWVPState);
     }
     else
     {
index 2a0e2d371ec78b95b422b038af1ecdbfaa62c703..d46965f886cbf612de57570bc48d163e69e97e78 100644 (file)
@@ -779,6 +779,7 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
 
   // Update states of OpenGl_BVHTreeSelector (frustum culling algorithm).
   myBVHSelector.SetViewVolume (myCamera);
+  myBVHSelector.SetViewportSize (myWindow->Width(), myWindow->Height());
 
   const Handle(OpenGl_ShaderManager)& aManager   = aContext->ShaderManager();
   if (StateInfo (myCurrLightSourceState, aManager->LightSourceState().Index()) != myLastLightSourceState)
index e1b4db12d547cc14c31d1cf9ca7c5284b35b0b3d..3b25a15e7d165efa5b0727c987ef05b2db02211e 100644 (file)
@@ -26,6 +26,7 @@
 #include <Standard_Boolean.hxx>
 #include <Graphic3d_ZLayerId.hxx>
 #include <PrsMgr_PresentableObjectPointer.hxx>
+#include <gp_GTrsf.hxx>
 #include <gp_Trsf.hxx>
 #include <PrsMgr_ListOfPresentableObjects.hxx>
 #include <MMgt_TShared.hxx>
@@ -133,7 +134,7 @@ public:
   
     const gp_Trsf& Transformation() const;
   
-    const gp_Trsf& InversedTransformation() const;
+    const gp_GTrsf& InversedTransformation() const;
   
   //! resets local transformation to identity.
   Standard_EXPORT virtual void ResetTransformation();
@@ -288,7 +289,7 @@ private:
   PrsMgr_PresentableObjectPointer myParent;
   gp_Trsf myLocalTransformation;
   gp_Trsf myTransformation;
-  gp_Trsf myInvTransformation;
+  gp_GTrsf myInvTransformation;
   gp_Trsf myCombinedParentTransform;
   PrsMgr_ListOfPresentableObjects myChildren;
 
index 8cb9c0f9f1476532f6373574df27adeb530645b4..a3ea557eee9cb0c9011951d3b10e1125e4647e8f 100644 (file)
@@ -32,7 +32,7 @@ inline const gp_Trsf& PrsMgr_PresentableObject::Transformation() const
   return myTransformation;
 }
 
-inline const gp_Trsf& PrsMgr_PresentableObject::InversedTransformation() const
+inline const gp_GTrsf& PrsMgr_PresentableObject::InversedTransformation() const
 {
   return myInvTransformation;
 }
index f7387c33a214560543b9fc0c60cd2f83eccb8406..697b81eec988a656c7345abe194e0db27d67097a 100644 (file)
@@ -85,7 +85,7 @@ Standard_Boolean Select3D_SensitiveEntity::HasInitLocation() const
 // purpose  : Returns inversed location transformation matrix if the shape corresponding
 //            to this entity has init location set. Otherwise, returns identity matrix.
 //=======================================================================
-gp_Trsf Select3D_SensitiveEntity::InvInitLocation() const
+gp_GTrsf Select3D_SensitiveEntity::InvInitLocation() const
 {
-  return gp_Trsf();
+  return gp_GTrsf();
 }
index b3fd8bdd38432d9d6215a04966ab6d67fd4726a1..7265e36fdc63347187750605f2cc21d9f8eaaa1c 100644 (file)
@@ -83,7 +83,7 @@ public:
 
   //! Returns inversed location transformation matrix if the shape corresponding
   //! to this entity has init location set. Otherwise, returns identity matrix.
-  Standard_EXPORT virtual gp_Trsf InvInitLocation() const Standard_OVERRIDE;
+  Standard_EXPORT virtual gp_GTrsf InvInitLocation() const Standard_OVERRIDE;
 
   DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveEntity,SelectBasics_SensitiveEntity)
 
index 4e858efe181ea93866e5f507cde0a2152899de15..0c3402efb310ebdad6e3611bcb8cc3d570db2ea1 100644 (file)
@@ -208,7 +208,7 @@ public:
 
   //! Returns inversed location transformation matrix if the shape corresponding
   //! to this entity has init location set. Otherwise, returns identity matrix.
-  virtual gp_Trsf InvInitLocation() const Standard_OVERRIDE
+  virtual gp_GTrsf InvInitLocation() const Standard_OVERRIDE
   {
     return myInvInitLocation;
   }
@@ -261,7 +261,7 @@ private:
   gp_Pnt                           myCDG3D;              //!< Center of the whole triangulation
   Select3D_BVHIndexBuffer          myBvhIndices;         //!< Indexes of edges or triangles for BVH tree
   mutable Select3D_BndBox3d        myBndBox;             //!< Bounding box of the whole triangulation
-  gp_Trsf                          myInvInitLocation;
+  gp_GTrsf                         myInvInitLocation;
   Standard_Real                    myMinDepthElem;       //!< the depth of nearest detected element
   Standard_Real                    myMinDepthNode;       //!< the depth of nearest detected node
   Standard_Real                    myMinDepthEdge;       //!< the depth of nearest detected edge
index 3341f742998dc0c629fd42e239d4b2e4bdb0664c..88543d5ecd3b86dbbda8a608c1ffbf254ff858e6 100644 (file)
@@ -429,7 +429,7 @@ Standard_Boolean Select3D_SensitiveTriangulation::HasInitLocation() const
 //function : InvInitLocation
 //purpose  :
 //=======================================================================
-gp_Trsf Select3D_SensitiveTriangulation::InvInitLocation() const
+gp_GTrsf Select3D_SensitiveTriangulation::InvInitLocation() const
 {
   return myInvInitLocation;
 }
index fd1f6a34510e7a1b7f5adf0e1d0735efa15090b6..5f212cdd541355b62a222f95008c2e9672941181 100644 (file)
@@ -106,7 +106,7 @@ public:
 
   //! Returns inversed location transformation matrix if the shape corresponding
   //! to this entity has init location set. Otherwise, returns identity matrix.
-  Standard_EXPORT virtual gp_Trsf InvInitLocation() const Standard_OVERRIDE;
+  Standard_EXPORT virtual gp_GTrsf InvInitLocation() const Standard_OVERRIDE;
 
   inline const TopLoc_Location& GetInitLocation() const;
 
@@ -144,7 +144,7 @@ private:
   Standard_Integer                 myPrimitivesNb;       //!< Amount of free edges or triangles depending on sensitivity type
   Handle(TColStd_HArray1OfInteger) myBVHPrimIndexes;     //!< Indexes of edges or triangles for BVH build
   mutable Select3D_BndBox3d        myBndBox;             //!< Bounding box of the whole triangulation
-  gp_Trsf                          myInvInitLocation;
+  gp_GTrsf                         myInvInitLocation;
 };
 
 DEFINE_STANDARD_HANDLE(Select3D_SensitiveTriangulation, Select3D_SensitiveSet)
index 9d6da1db66f483ca250dce1d0a683e7794a642a6..d4d14310744681838a0d2d8446a6d13aa48e0697 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef _SelectBasics_SensitiveEntity_HeaderFile
 #define _SelectBasics_SensitiveEntity_HeaderFile
 
+#include <gp_GTrsf.hxx>
 #include <gp_Trsf.hxx>
 
 #include <Standard.hxx>
@@ -83,7 +84,7 @@ public:
 
   //! Returns inversed location transformation matrix if the shape corresponding
   //! to this entity has init location set. Otherwise, returns identity matrix.
-  virtual gp_Trsf InvInitLocation() const = 0;
+  virtual gp_GTrsf InvInitLocation() const = 0;
 
   DEFINE_STANDARD_RTTIEXT(SelectBasics_SensitiveEntity,MMgt_TShared)
 
index 3508da72b1749b708ff65b3e0c68f3418c8cf587..cf1066390f8d5d38897298a741a64933ac3e2c8d 100644 (file)
@@ -117,6 +117,16 @@ void SelectMgr_BaseFrustum::SetWindowSize (const Standard_Integer theWidth, cons
   myBuilder->SetWindowSize (theWidth, theHeight);
 }
 
+//=======================================================================
+// function : WindowSize
+// purpose  :
+//=======================================================================
+void SelectMgr_BaseFrustum::WindowSize (Standard_Integer& theWidth,
+                                        Standard_Integer& theHeight)
+{
+  myBuilder->WindowSize (theWidth, theHeight);
+}
+
 //=======================================================================
 // function : SetBuilder
 // purpose  :
index 62e7de617dcb2bb2750814c1301f5ea0d4f3cdfc..5855c6db1ed553e36e9d649f410792fc2700b3a2 100644 (file)
@@ -16,6 +16,7 @@
 #ifndef _SelectMgr_BaseFrustum_HeaderFile
 #define _SelectMgr_BaseFrustum_HeaderFile
 
+#include <gp_GTrsf.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Pln.hxx>
 
@@ -70,6 +71,9 @@ public:
   Standard_EXPORT void SetWindowSize (const Standard_Integer theWidth, 
                                       const Standard_Integer theHeight);
 
+  Standard_EXPORT void WindowSize (Standard_Integer& theWidth,
+                                   Standard_Integer& theHeight);
+
   //! Passes viewport parameters to builder
   Standard_EXPORT void SetViewport (const Standard_Real theX,
                                     const Standard_Real theY,
@@ -102,8 +106,8 @@ public:
   //! There are no default parameters, but in case if:
   //!    - transformation only is needed: @theScaleFactor must be initialized as any negative value;
   //!    - scale only is needed: @theTrsf must be set to gp_Identity.
-  virtual NCollection_Handle<SelectMgr_BaseFrustum> ScaleAndTransform (const Standard_Integer /*theScaleFactor*/,
-                                                                       const gp_Trsf& /*theTrsf*/) { return NULL; }
+  Standard_EXPORT virtual NCollection_Handle<SelectMgr_BaseFrustum> ScaleAndTransform (const Standard_Integer /*theScaleFactor*/,
+                                                                                       const gp_GTrsf& /*theTrsf*/) { return NULL; }
 
   //! SAT intersection test between defined volume and given axis-aligned box
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theBoxMin,
index 26138fcb947b62f143544b9df348654426558d9f..75447a823da3ee98a719b99c7066db8c38aab64d 100644 (file)
@@ -114,6 +114,17 @@ void SelectMgr_FrustumBuilder::SetViewport (const Standard_Real theX,
   myIsViewportSet = Standard_True;
 }
 
+//=======================================================================
+// function : WindowSize
+// purpose  :
+//=======================================================================
+void SelectMgr_FrustumBuilder::WindowSize (Standard_Integer& theWidth,
+                                           Standard_Integer& theHeight)
+{
+  theWidth = myWidth;
+  theHeight = myHeight;
+}
+
 //=======================================================================
 // function : InvalidateViewport
 // purpose  :
index c4708acea116713c92047a9dbeda4d386ac488f9..c490aad4f17b87a7bdfd9f365ea9cdf880f1ecb3 100644 (file)
@@ -62,6 +62,9 @@ public:
 
   Standard_EXPORT void InvalidateViewport();
 
+  Standard_EXPORT void WindowSize (Standard_Integer& theWidth,
+                                   Standard_Integer& theHeight);
+
   //! Calculates signed distance between plane with equation
   //! theEq and point thePnt
   Standard_EXPORT Standard_Real SignedPlanePntDist (const SelectMgr_Vec3& theEq,
index 664d3d43875bbb42a3cab855554a9defa10a97a5..fe2c835c65e0bdf3bc1e7a18ef4e43590060b481 100644 (file)
@@ -323,7 +323,7 @@ void SelectMgr_RectangularFrustum::Build (const gp_Pnt2d& theMinPnt,
 //                - scale only is needed: @theTrsf must be set to gp_Identity.
 // =======================================================================
 NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_RectangularFrustum::ScaleAndTransform (const Standard_Integer theScaleFactor,
-                                                                                           const gp_Trsf& theTrsf)
+                                                                                           const gp_GTrsf& theTrsf)
 {
   Standard_ASSERT_RAISE (theScaleFactor > 0,
     "Error! Pixel tolerance for selection should be greater than zero");
@@ -357,26 +357,24 @@ NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_RectangularFrustum::ScaleAnd
 
   if (isToTrsf)
   {
-    aRes->myNearPickedPnt = aRef->myNearPickedPnt.Transformed (theTrsf);
-    aRes->myFarPickedPnt  = aRef->myFarPickedPnt.Transformed (theTrsf);
+    const Standard_Real aRefScale = aRef->myFarPickedPnt.SquareDistance (aRef->myNearPickedPnt);
+
+    gp_Pnt aPoint = aRef->myNearPickedPnt;
+    theTrsf.Transforms (aPoint.ChangeCoord());
+    aRes->myNearPickedPnt = aPoint;
+
+    aPoint.SetXYZ (aRef->myFarPickedPnt.XYZ());
+    theTrsf.Transforms (aPoint.ChangeCoord());
+    aRes->myFarPickedPnt = aPoint;
+
     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);
+    for (Standard_Integer anIt = 0; anIt < 8; anIt++)
+    {
+      aPoint = aRef->myVertices[anIt];
+      theTrsf.Transforms (aPoint.ChangeCoord());
+      aRes->myVertices[anIt] = aPoint;
+    }
 
     // Horizontal
     aRes->myEdgeDirs[0] = aRes->myVertices[4].XYZ() - aRes->myVertices[0].XYZ();
@@ -391,7 +389,8 @@ NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_RectangularFrustum::ScaleAnd
     // RightUpper
     aRes->myEdgeDirs[5] = aRes->myVertices[4].XYZ() - aRes->myVertices[5].XYZ();
 
-    aRes->myScale = 1.0 / theTrsf.ScaleFactor();
+    // Compute scale to transform depth from local coordinate system to world coordinate system
+    aRes->myScale = Sqrt (aRefScale / aRes->myFarPickedPnt.SquareDistance (aRes->myNearPickedPnt));
   }
 
   // compute frustum normals
index 9cf9c121731f95ee17b2a3814759374eb6888f9d..de30a13fa81dfa385c6a16e837143f4d108e327a 100644 (file)
@@ -51,7 +51,7 @@ public:
   //!    - transformation only is needed: @theScaleFactor must be initialized as any negative value;
   //!    - scale only is needed: @theTrsf must be set to gp_Identity.
   Standard_EXPORT virtual NCollection_Handle<SelectMgr_BaseFrustum> ScaleAndTransform (const Standard_Integer theScaleFactor,
-                                                                                       const gp_Trsf& theTrsf) Standard_OVERRIDE;
+                                                                                       const gp_GTrsf& theTrsf) Standard_OVERRIDE;
 
 
   // SAT Tests for different objects
index facee7e9053ddafa5fa2a879a2aa51d3d98649ba..47faa725df0f6e44d57880329febeea853384317 100644 (file)
@@ -119,6 +119,8 @@ Standard_Boolean SelectMgr_SelectableObjectTrsfPersSet::Remove (const Handle(Sel
 const NCollection_Handle<BVH_Tree<Standard_Real, 3> >&
   SelectMgr_SelectableObjectTrsfPersSet::BVH (const Graphic3d_Mat4d& theProjectionMatrix,
                                               const Graphic3d_Mat4d& theWorldViewMatrix,
+                                              const Standard_Integer theViewportWidth,
+                                              const Standard_Integer theViewportHeight,
                                               const Graphic3d_WorldViewProjState& theWVPState)
 {
   if (!myIsDirty && (myObjectBoxesState.IsValid() && !myObjectBoxesState.IsChanged(theWVPState)))
@@ -139,7 +141,7 @@ const NCollection_Handle<BVH_Tree<Standard_Real, 3> >&
       anObject->BoundingBox (aBoundingBox);
       if (!aBoundingBox.IsVoid())
       {
-        anObject->TransformPersistence().Apply (theProjectionMatrix, theWorldViewMatrix, 0, 0, aBoundingBox);
+        anObject->TransformPersistence().Apply (theProjectionMatrix, theWorldViewMatrix, theViewportWidth, theViewportHeight, aBoundingBox);
       }
     }
 
index 5c3aa43bffce093714dab386c27db95e1cedb2b4..94ccfc9e6d774a65686350fbec5e6931d1c80396 100644 (file)
@@ -87,6 +87,8 @@ public:
   //! Returns BVH tree for the given world view projection (builds it if necessary).
   Standard_EXPORT const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& BVH (const Graphic3d_Mat4d& theProjectionMatrix,
                                                                               const Graphic3d_Mat4d& theWorldViewMatrix,
+                                                                              const Standard_Integer theViewportWidth,
+                                                                              const Standard_Integer theViewportHeight,
                                                                               const Graphic3d_WorldViewProjState& theWVPState);
 
 private:
index 658900ed6f60b15960ac02994d5272dc6a21f238..8e975930d58bce3ae041c43c20d6b260f6edf2ed 100644 (file)
@@ -44,7 +44,7 @@ SelectMgr_SelectingVolumeManager::SelectMgr_SelectingVolumeManager (Standard_Boo
 //                - scale only is needed: @theTrsf must be set to gp_Identity.
 //=======================================================================
 SelectMgr_SelectingVolumeManager SelectMgr_SelectingVolumeManager::ScaleAndTransform (const Standard_Integer theScaleFactor,
-                                                                                      const gp_Trsf& theTrsf)
+                                                                                      const gp_GTrsf& theTrsf)
 {
   SelectMgr_SelectingVolumeManager aMgr (Standard_False);
 
@@ -137,6 +137,15 @@ const Graphic3d_WorldViewProjState& SelectMgr_SelectingVolumeManager::WorldViewP
   return mySelectingVolumes[Frustum]->WorldViewProjState();
 }
 
+//=======================================================================
+// function : WindowSize
+// purpose  :
+//=======================================================================
+void SelectMgr_SelectingVolumeManager::WindowSize (Standard_Integer& theWidth, Standard_Integer& theHeight)
+{
+  mySelectingVolumes[Frustum]->WindowSize (theWidth, theHeight);
+}
+
 //=======================================================================
 // function : SetCamera
 // purpose  : Updates viewport in all selecting volumes
index ac018e6fedf9a7d616dda01abe22c62663c0c24e..2900186a5f20dd02dceb2f03eb7448cea88df2fc 100644 (file)
@@ -47,7 +47,7 @@ public:
   //!    - transformation only is needed: @theScaleFactor must be initialized as any negative value;
   //!    - scale only is needed: @theTrsf must be set to gp_Identity.
   Standard_EXPORT virtual SelectMgr_SelectingVolumeManager ScaleAndTransform (const Standard_Integer theScaleFactor,
-                                                                              const gp_Trsf& theTrsf);
+                                                                              const gp_GTrsf& theTrsf);
 
   Standard_EXPORT virtual Standard_Integer GetActiveSelectionType() const Standard_OVERRIDE;
 
@@ -68,6 +68,8 @@ public:
   //! @return current world view transformation common for all selecting volumes
   Standard_EXPORT const Graphic3d_Mat4d& WorldViewMatrix() const;
 
+  Standard_EXPORT void WindowSize (Standard_Integer& theWidth, Standard_Integer& theHeight);
+
   //! @return current camera world view projection transformation state common for all selecting volumes
   Standard_EXPORT const Graphic3d_WorldViewProjState& WorldViewProjState() const;
 
index 79b02a1fc6dfe543eccde4f3ed6f4f1ca2b6a437..d67f7c788c6fca7cdff5745788ccff389d892271 100644 (file)
@@ -129,22 +129,16 @@ void SelectMgr_TriangularFrustum::Build (const gp_Pnt2d& theP1,
 //                - scale only is needed: @theTrsf must be set to gp_Identity.
 //=======================================================================
 NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_TriangularFrustum::ScaleAndTransform (const Standard_Integer /*theScale*/,
-                                                                                          const gp_Trsf& theTrsf)
+                                                                                          const gp_GTrsf& theTrsf)
 {
   SelectMgr_TriangularFrustum* aRes = new SelectMgr_TriangularFrustum();
 
-  // V0_Near
-  aRes->myVertices[0] = myVertices[0].Transformed (theTrsf);
-  // V1_Near
-  aRes->myVertices[1] = myVertices[1].Transformed (theTrsf);
-  // V2_Near
-  aRes->myVertices[2] = myVertices[2].Transformed (theTrsf);
-  // V0_Far
-  aRes->myVertices[3] = myVertices[3].Transformed (theTrsf);
-  // V1_Far
-  aRes->myVertices[4] = myVertices[4].Transformed (theTrsf);
-  // V2_Far
-  aRes->myVertices[5] = myVertices[5].Transformed (theTrsf);
+  for (Standard_Integer anIt = 0; anIt < 6; anIt++)
+  {
+    gp_Pnt aPoint = myVertices[anIt];
+    theTrsf.Transforms (aPoint.ChangeCoord());
+    aRes->myVertices[anIt] = aPoint;
+  }
 
   aRes->myIsOrthographic = myIsOrthographic;
 
index ceb104f378da4f742a968891b05c26483a035160..3e6c8da7b1c387d78813da3af5e5cb56153a3eb6 100644 (file)
@@ -41,7 +41,7 @@ public:
 
   //! Returns a copy of the frustum transformed according to the matrix given
   Standard_EXPORT virtual NCollection_Handle<SelectMgr_BaseFrustum> ScaleAndTransform (const Standard_Integer theScale,
-                                                                                       const gp_Trsf& theTrsf) Standard_OVERRIDE;
+                                                                                       const gp_GTrsf& theTrsf) Standard_OVERRIDE;
 
   // SAT Tests for different objects
 
index c5d8c9fb9dd02a754a53391c8b41d31d983506aa..efce1f80dd7a50f1a38f0ce6bdcf0bc510116ef6 100644 (file)
@@ -109,7 +109,7 @@ void SelectMgr_TriangularFrustumSet::Build (const TColgp_Array1OfPnt2d& thePoint
 //                - scale only is needed: @theTrsf must be set to gp_Identity.
 // =======================================================================
 NCollection_Handle<SelectMgr_BaseFrustum> SelectMgr_TriangularFrustumSet::ScaleAndTransform (const Standard_Integer theScale,
-                                                                                             const gp_Trsf& theTrsf)
+                                                                                             const gp_GTrsf& theTrsf)
 {
   SelectMgr_TriangularFrustumSet* aRes = new SelectMgr_TriangularFrustumSet();
 
index baad601daf1def049eb94be44edc72b1eeda8093..474bb355fa45d4bc70bb83a083088583764c4db6 100644 (file)
@@ -48,7 +48,7 @@ public:
 
   //! Returns a copy of the frustum with all sub-volumes transformed according to the matrix given
   Standard_EXPORT virtual NCollection_Handle<SelectMgr_BaseFrustum> ScaleAndTransform (const Standard_Integer theScale,
-                                                                                       const gp_Trsf& theTrsf) Standard_OVERRIDE;
+                                                                                       const gp_GTrsf& theTrsf) Standard_OVERRIDE;
 
   Standard_EXPORT virtual Standard_Boolean Overlaps (const SelectMgr_Vec3& theMinPnt,
                                                      const SelectMgr_Vec3& theMaxPnt,
index 1e2d3d9e2b99e9c11036e14075d24db1b458a72b..ecc735b00416e9189fad739227fe128ce9540106 100644 (file)
@@ -19,6 +19,7 @@
 //              AGV OCT/23/03 : Optimize the method SortResult() (OCC4201)
 
 #include <BVH_Tree.hxx>
+#include <gp_GTrsf.hxx>
 #include <gp_Pnt.hxx>
 #include <OSD_Environment.hxx>
 #include <Precision.hxx>
@@ -267,12 +268,12 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(SelectBasics_Sensitive
 //           necessary calculations
 //=======================================================================
 void SelectMgr_ViewerSelector::computeFrustum (const Handle(SelectBasics_SensitiveEntity)& theEnt,
-                                               const gp_Trsf&                              theInvTrsf,
+                                               const gp_GTrsf&                             theInvTrsf,
                                                SelectMgr_FrustumCache&                     theCachedMgrs,
                                                SelectMgr_SelectingVolumeManager&           theResMgr)
 {
   Standard_Integer aScale = isToScaleFrustum (theEnt) ? sensitivity (theEnt) : 1;
-  const gp_Trsf aTrsfMtr = theEnt->HasInitLocation() ? theEnt->InvInitLocation() * theInvTrsf : theInvTrsf;
+  const gp_GTrsf aTrsfMtr = theEnt->HasInitLocation() ? theEnt->InvInitLocation() * theInvTrsf : theInvTrsf;
   const Standard_Boolean toScale = aScale != 1;
   const Standard_Boolean toTransform = aTrsfMtr.Form() != gp_Identity;
   if (toScale && toTransform)
@@ -309,7 +310,7 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
 
   const NCollection_Handle<BVH_Tree<Standard_Real, 3> >& aSensitivesTree = anEntitySet->BVH();
 
-  gp_Trsf aInversedTrsf;
+  gp_GTrsf aInversedTrsf;
 
   if (theObject->HasTransformation() || theObject->TransformPersistence().Flags)
   {
@@ -321,14 +322,24 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
     {
       const Graphic3d_Mat4d& aProjection = mySelectingVolumeMgr.ProjectionMatrix();
       const Graphic3d_Mat4d& aWorldView  = mySelectingVolumeMgr.WorldViewMatrix();
-
-      gp_Trsf aTPers;
-      Graphic3d_Mat4d aMat = theObject->TransformPersistence().Compute (aProjection, aWorldView, 0, 0);
-      aTPers.SetValues (aMat.GetValue (0, 0), aMat.GetValue (0, 1), aMat.GetValue (0, 2), aMat.GetValue (0, 3),
-                        aMat.GetValue (1, 0), aMat.GetValue (1, 1), aMat.GetValue (1, 2), aMat.GetValue (1, 3),
-                        aMat.GetValue (2, 0), aMat.GetValue (2, 1), aMat.GetValue (2, 2), aMat.GetValue (2, 3));
-
-      aInversedTrsf = (aTPers * theObject->Transformation()).Inverted();
+      Standard_Integer aViewportWidth;
+      Standard_Integer aViewportHeight;
+      mySelectingVolumeMgr.WindowSize (aViewportWidth, aViewportHeight);
+
+      gp_GTrsf aTPers;
+      Graphic3d_Mat4d aMat = theObject->TransformPersistence().Compute (aProjection, aWorldView, aViewportWidth, aViewportHeight);
+      aTPers.SetValue (1, 1, aMat.GetValue (0, 0));
+      aTPers.SetValue (1, 2, aMat.GetValue (0, 1));
+      aTPers.SetValue (1, 3, aMat.GetValue (0, 2));
+      aTPers.SetValue (2, 1, aMat.GetValue (1, 0));
+      aTPers.SetValue (2, 2, aMat.GetValue (1, 1));
+      aTPers.SetValue (2, 3, aMat.GetValue (1, 2));
+      aTPers.SetValue (3, 1, aMat.GetValue (2, 0));
+      aTPers.SetValue (3, 2, aMat.GetValue (2, 1));
+      aTPers.SetValue (3, 3, aMat.GetValue (2, 2));
+      aTPers.SetTranslationPart (gp_XYZ (aMat.GetValue (0, 3), aMat.GetValue (1, 3), aMat.GetValue (2, 3)));
+
+      aInversedTrsf = (aTPers * gp_GTrsf (theObject->Transformation())).Inverted();
     }
   }
 
@@ -429,7 +440,10 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
       const Graphic3d_Mat4d& aProjection            = mySelectingVolumeMgr.ProjectionMatrix();
       const Graphic3d_Mat4d& aWorldView             = mySelectingVolumeMgr.WorldViewMatrix();
       const Graphic3d_WorldViewProjState& aWVPState = mySelectingVolumeMgr.WorldViewProjState();
-      aBVHTree = mySelectableObjectsTrsfPers.BVH (aProjection, aWorldView, aWVPState);
+      Standard_Integer aViewportWidth;
+      Standard_Integer aViewportHeight;
+      mySelectingVolumeMgr.WindowSize (aViewportWidth, aViewportHeight);
+      aBVHTree = mySelectableObjectsTrsfPers.BVH (aProjection, aWorldView, aViewportWidth, aViewportHeight, aWVPState);
     }
     else
     {
@@ -842,9 +856,12 @@ void SelectMgr_ViewerSelector::RebuildObjectsTree (const Standard_Boolean theIsF
     const Graphic3d_Mat4d& aProjection            = mySelectingVolumeMgr.ProjectionMatrix();
     const Graphic3d_Mat4d& aWorldView             = mySelectingVolumeMgr.WorldViewMatrix();
     const Graphic3d_WorldViewProjState& aWVPState = mySelectingVolumeMgr.WorldViewProjState();
+    Standard_Integer aViewportWidth;
+    Standard_Integer aViewportHeight;
+    mySelectingVolumeMgr.WindowSize (aViewportWidth, aViewportHeight);
 
     mySelectableObjects.BVH();
-    mySelectableObjectsTrsfPers.BVH (aProjection, aWorldView, aWVPState);
+    mySelectableObjectsTrsfPers.BVH (aProjection, aWorldView, aViewportWidth, aViewportHeight, aWVPState);
   }
 }
 
index 15a42716fef9678bd704eed00fe6a3322d01dc6c..c7ff4f4fd0a4ad04f5fc82a6acd2661e23cd1d4b 100644 (file)
@@ -310,10 +310,11 @@ private:
   //! needs to be scaled and transformed for the entity and performs
   //! necessary calculations
   void computeFrustum (const Handle(SelectBasics_SensitiveEntity)& theEnt,
-                       const gp_Trsf&                              theInvTrsf,
+                       const gp_GTrsf&                             theInvTrsf,
                        SelectMgr_FrustumCache&                     theCachedMgrs,
                        SelectMgr_SelectingVolumeManager&           theResMgr);
 
+
 protected:
 
   Standard_Boolean                              preferclosest;
index af89e21f50f0442c4044ff2390738468a3d708b4..a216866317af480e97557fe7fb452e9ebc14bdd1 100644 (file)
@@ -4449,16 +4449,27 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
       const Handle(SelectBasics_SensitiveEntity)& anEntity = aSelector->DetectedEntity();
       Handle(SelectMgr_EntityOwner) anOwner    = Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
       Handle(AIS_InteractiveObject) anObj      = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
-      gp_Trsf anInvTrsf;
+      gp_GTrsf anInvTrsf;
       if (anObj->TransformPersistence().Flags)
       {
         const Graphic3d_Mat4d& aProjection = aMgr.ProjectionMatrix();
         const Graphic3d_Mat4d& aWorldView  = aMgr.WorldViewMatrix();
-
-        Graphic3d_Mat4d aMat = anObj->TransformPersistence().Compute (aProjection, aWorldView, 0, 0);
-        anInvTrsf.SetValues (aMat.GetValue (0, 0), aMat.GetValue (0, 1), aMat.GetValue (0, 2), aMat.GetValue (0, 3),
-          aMat.GetValue (1, 0), aMat.GetValue (1, 1), aMat.GetValue (1, 2), aMat.GetValue (1, 3),
-          aMat.GetValue (2, 0), aMat.GetValue (2, 1), aMat.GetValue (2, 2), aMat.GetValue (2, 3));
+        Standard_Integer aViewportWidth = 0;
+        Standard_Integer aViewportHeight = 0;
+        aMgr.WindowSize (aViewportWidth, aViewportHeight);
+
+        Graphic3d_Mat4d aMat = anObj->TransformPersistence().Compute (aProjection, aWorldView, aViewportWidth, aViewportHeight);
+
+        anInvTrsf.SetValue (1, 1, aMat.GetValue (0, 0));
+        anInvTrsf.SetValue (1, 2, aMat.GetValue (0, 1));
+        anInvTrsf.SetValue (1, 3, aMat.GetValue (0, 2));
+        anInvTrsf.SetValue (2, 1, aMat.GetValue (1, 0));
+        anInvTrsf.SetValue (2, 2, aMat.GetValue (1, 1));
+        anInvTrsf.SetValue (2, 3, aMat.GetValue (1, 2));
+        anInvTrsf.SetValue (3, 1, aMat.GetValue (2, 0));
+        anInvTrsf.SetValue (3, 2, aMat.GetValue (2, 1));
+        anInvTrsf.SetValue (3, 3, aMat.GetValue (2, 2));
+        anInvTrsf.SetTranslationPart (gp_XYZ(aMat.GetValue (0, 3), aMat.GetValue (1, 3), aMat.GetValue (2, 3)));
         anInvTrsf.Invert();
       }
       if (anObj->HasTransformation())
@@ -4477,8 +4488,13 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
                               : aMgr;
       SelectBasics_PickResult aResult;
       anEntity->Matches (anEntMgr, aResult);
-      gp_Pnt aDetectedPnt = anInvTrsf.Form() == gp_Identity ?
-        anEntMgr.DetectedPoint (aResult.Depth()) : anEntMgr.DetectedPoint (aResult.Depth()).Transformed (anInvTrsf.Inverted());
+
+      gp_Pnt aDetectedPnt = anEntMgr.DetectedPoint (aResult.Depth());
+
+      if (anInvTrsf.Form() != gp_Identity)
+      {
+        anInvTrsf.Inverted().Transforms (aDetectedPnt.ChangeCoord());
+      }
 
       TCollection_AsciiString aName = GetMapOfAIS().Find1 (anObj);
       aName.LeftJustify (20, ' ');
index 1b022d0fc0173665245b54cd0e2310333e89aff8..23e0be8823569865e4228a63b53823cd2dbe28ac 100644 (file)
@@ -10,7 +10,7 @@ set anImage1 $imagedir/${casename}_1.png
 set anImage2 $imagedir/${casename}_2.png
 vinit
 box b1 -1 -1 -1 3 3 3
-box b2 4 4 4 30 20 20
+box b2 4 4 4 15 10 10
 vdisplay b1
 vdisplay b2 -trsfPers zoom -trsfPersPos 0 0 0
 vfit
index 3f7acd38b4ed2813d0cc5c1445e0a887896a8e78..8b7ddd40d8f23c47cd56b804598f797b800c9453 100644 (file)
@@ -11,8 +11,8 @@ vinit View1 w=409 h=409
 vtrihedron tri
 vpan 50 50
 
-box b1 50 50 50
-box b2 50 50 50
+box b1 25 25 25
+box b2 25 25 25
 box b3 100 100 100
 box b4 100 100 100
 box b5 100 100 100
@@ -22,7 +22,7 @@ vpoint p1 200 200 200
 
 vdisplay b1 -trsfPers zoom -trsfPersPos 200 200 200
 vdisplay b2 -trsfPers zoom -trsfPersPos 200 200 200
-vsetlocation b2 -50 -50 -50
+vsetlocation b2 -25 -25 -25
 
 vmoveto 384 78
 if { ![checkcolor 384 78 0 1 1] } {
index 00c5afd0512951aa9dc84f27304e367d09ae21d8..6a8b01f7244f0fa1e211a7112af6890fb2e1b187 100644 (file)
@@ -14,7 +14,7 @@ vsetdispmode 1
 
 restore [locate_data_file face1.brep] f
 vdisplay f
-box b1 50 50 50
+box b1 25 25 25
 vdisplay b1 -trsfPers zoom -trsfPersPos 0 0 0
 
 vviewparams -scale 588.7 -proj 0.69 -0.64 -0.38
@@ -25,7 +25,7 @@ vviewparams -eye 0.7 -1.14 -0.17
 # with dynamic highlight color, check that the face is
 # not highlighted
 vmoveto 280 290
-if {[vreadpixel 290 297 name] != "CYAN1 1"} {
+if {[vreadpixel 297 297 name] != "CYAN1 1"} {
   puts "ERROR: zoom persistent box is not highlighted dynamically!"
 }
 if {[vreadpixel 372 210 name] != "GOLDENROD1 1"} {
@@ -45,7 +45,8 @@ vviewparams -eye 0.96 1.053 0.31
 # move to a point on the box and check if it
 # will be highlighted dynamically
 vmoveto 264 135
-if {[vreadpixel 276 142 name] != "CYAN1 1"} {
+
+if {[vreadpixel 275 142 name] != "CYAN1 1"} {
   puts "ERROR: zoom persistent box is not highlighted dynamically in precision test!"
 }
 if {[vreadpixel 243 123 name] != "LIGHTGOLDENROD1 1"} {
@@ -56,8 +57,8 @@ vmoveto 0 0
 
 # move to a point on the face and check if it
 # will be highlighted dynamically
-vmoveto 263 135
-if {[vreadpixel 276 142 name] != "GOLDENROD2 1"} {
+vmoveto 259 135
+if {[vreadpixel 275 142 name] != "GOLDENROD3 1"} {
   puts "ERROR: zoom persistent box is highlighted instead in precision test!"
 }
 if {[vreadpixel 243 123 name] != "CYAN1 1"} {
index 8e8de971a7ceadf23e4803c09434ddcdd499cfb8..b4fa9ef8be40db67ea9550fdc9236ce0c67a7c76 100644 (file)
@@ -37,15 +37,15 @@ vinit
 vtrihedron tri
 vpan 50 50
 
-box b1 50 50 50
-box b2 50 50 50
+box b1 20.3 20.3 20.3
+box b2 20.3 20.3 20.3
 box b3 150 150 150 100 100 100
 
 vpoint p1 200 200 200
 
 vdisplay b1 -trsfPers zoom -trsfPersPos 200 200 200
 vdisplay b2 -trsfPers zoom -trsfPersPos 200 200 200
-vsetlocation b2 -50 -50 -50
+vsetlocation b2 -20.3 -20.3 -20.3
 vdisplay b3
 
 vsetdispmode 1
index 3e0b208ca7b38a75890642eab7bc4c3e84cc995d..c8614a3a51789d9b727d920960a9639f9a55cdde 100644 (file)
@@ -8,14 +8,14 @@ vinit
 vclear
 vaxo
 
-box b 100 100 100
+box b 50 50 50
 vdisplay b -trsfPers zoom
 vzoom 0.01
 vzfit
 
 checkcolor 204 184 1.0 1.0 0.0
-checkcolor 232 205 1.0 1.0 0.0
-checkcolor 262 182 1.0 1.0 0.0
-checkcolor 233 184 1.0 1.0 0.0
+checkcolor 238 205 1.0 1.0 0.0
+checkcolor 275 182 1.0 1.0 0.0
+checkcolor 239 184 1.0 1.0 0.0
 
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/vis/bug27536 b/tests/bugs/vis/bug27536
new file mode 100644 (file)
index 0000000..aee57ff
--- /dev/null
@@ -0,0 +1,30 @@
+puts "========"
+puts "OCC27536"
+puts "========"
+puts ""
+##################################################################
+puts "Visualization - incorrect behavior of zoom persisted objects"
+##################################################################
+
+set anImage1 $imagedir/${casename}_1.png
+set anImage2 $imagedir/${casename}_2.png
+
+vinit
+vclear
+vaxo
+
+box b -50 -50 -50 100 100 100
+vdisplay b -trsfPers zoom -trsfPersPos 0 0 0 -dispmode 1
+
+vdump $anImage1
+
+vinit View2 w=200 h=400
+vaxo
+vfit
+
+# Check that box was't resized in small view
+if {[vreadpixel 165 200 name] != "DARKGOLDENROD3 1"} {
+  puts "ERROR: zoom persistent box is resized on view sizes changed!"
+}
+
+vdump $anImage2
index 92f67fdbb275f5f82c60fd6f43432b1a99404cd8..d99535f2b532ecd456ee662e0c845c6c30bf1655 100644 (file)
@@ -37,7 +37,7 @@ vfit
 # attach manipulator
 # ------------------
 
-vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1
+vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40
 
 # ----------------------------------------------------
 # test rotation around x axis (object reference frame)
@@ -104,7 +104,7 @@ vsetdispmode 1
 vaxo
 vfit
 
-vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1
+vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40
 vmanipulator m -followRotation 0
 
 # ---------------------------------------------------
index 85ddaa1c9807215d72e44e35ca224ffbfd14c07e..1447c255dc9f6f32e3fb7fa6ea3f6a34ddb7fb73 100644 (file)
@@ -34,7 +34,7 @@ vfit
 # attach manipulator
 # ------------------
 
-vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1
+vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40
 
 # --------------------------
 # test hilight and detection
index 159651ee9def7a11080a81278d851109ca93059d..b116ec69097ed84d7161d41f9f56e41ea5bd88c0 100644 (file)
@@ -33,7 +33,7 @@ vfit
 # attach manipulator
 # ------------------
 
-vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1
+vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40
 vmanipulator m -followRotation 1
 vmanipulator m -followTranslation 1
 
@@ -100,7 +100,7 @@ vfit
 # attach manipulator and rotate around z axis
 # -------------------------------------------
 
-vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1
+vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40
 vmanipulator m -followRotation 1
 vmanipulator m -followTranslation 1
 
index 31bc3562fd54236cc892f1a7c459086dcf658067..22f53c0bf0ceff190ee98482d8f050f287ac94cd 100644 (file)
@@ -58,7 +58,7 @@ vdump $anImage3
 
 vfit
 
-vmanipulator m2 -attach b2 -adjustPosition 1 -adjustSize 0 -enableModes 1 -zoomable 0 -size 100
+vmanipulator m2 -attach b2 -adjustPosition 1 -adjustSize 0 -enableModes 1 -zoomable 0 -size 40
 
 set mouse_pick_1 {341 283}
 set mouse_pick_2 {277 246}