1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0024413: Visualization - get rid of projection shift from orthographic camera definition

From now on, the panning behavior of V3d_View completely corresponds to equal operations with camera. There is no more confusing "Center" property and "ProjectionShift" which were used to introduce composite panning, while respecting view referential points: At, Eye unchanged. The V3d_View::FitAll approach has been rewritten to do "fit all" geometrically, operating with frustum, to make it working for both orthographic and perspective projections.

1) Getting rid of ProjectionShift and Center property:
- Removed ProjectionShift property of Graphic3d_Camera.
- Removed confusing Center property of V3d_View (related to projection shift).
- Removed redundant code related to the Center property of V3d_View.
- Removed WindowLimit method of Graphic3d_Camera - no more used.

2) Improvements of fit all and selector:
- Improved FitAll operation of V3d_View and reused it in NIS_View - the perspective projection is now handled correctly.
- Revised code of Select3D_Projector class - can be defined with any given projection and model-view matrices.
- Modified StdSelect_ViewerSelector3d and ensured that panning, zooming and going into the view do not lead to unwanted re-projection of sensitives. The handling of perspective selection is revised.
- Take into account graphical boundaries of infinite structure on ZFitAll.

3) Improvements of camera:
- Introduced new z range scale parameter for V3d_View::AutoZFit. See, V3d_View::AutoZFitMode.
- Allow negative ZNear, ZFar for orthographic camera to avoid clipping of viewed model.
- Moved camera ZNear, ZFar validity checks to V3d_View level.
- Use more meaningful Standard_ShortReal relative precision for ZNear, ZFar ranges computed by ZFitAll.
- Use Standard_Real type for camera projection and orientation matrices.
- Extended camera to generate both Standard_Real and Standard_ShortReal transformation matrices using the same matrix evaluation methods and converted input parameters.

Correcting picking tests for perspective view

Modify v3d face test cases for 1px changes in face picking

Modified test cases for new arguments of vviewparams DRAWEXE command
This commit is contained in:
apl
2014-03-06 15:15:53 +04:00
committed by abv
parent e618b52683
commit 197ac94e72
780 changed files with 5417 additions and 4305 deletions

View File

@@ -14,14 +14,11 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- Modified by rob jun 25 98 : Add Method : Reactivate projector...
-- Modified by rob jun 25 98 : Add Method : Reactivate projector...
class ViewerSelector3d from StdSelect inherits ViewerSelector from SelectMgr
---Purpose: Selector Usable by Viewers from V3d
--
---Purpose: Selector Usable by Viewers from V3d
uses
View from V3d,
@@ -34,119 +31,108 @@ uses
Array1OfReal from TColStd,
Array1OfPnt2d from TColgp,
SensitivityMode from StdSelect,
Lin from gp
Lin from gp,
Pnt from gp,
Dir from gp,
XYZ from gp
is
Create returns mutable ViewerSelector3d from StdSelect;
---Purpose: Constructs an empty 3D selector object.
Create(aProj : Projector from Select3D) returns mutable ViewerSelector3d from StdSelect;
---Purpose: Constructs a 3D selector object defined by the projector aProj.
---Purpose: Constructs an empty 3D selector object.
Convert(me:mutable;aSelection:mutable Selection from SelectMgr)
Create (theProj : Projector from Select3D) returns mutable ViewerSelector3d from StdSelect;
---Purpose: Constructs a 3D selector object defined by the projector <theProj>.
Convert (me : mutable; theSel : mutable Selection from SelectMgr)
is redefined static;
---Level: Public
---Purpose: Processes the projection of the sensitive primitives
-- in the active view ; to be done before the selection action...
---Level: Public
---Purpose: Processes the projection of the sensitive primitives
-- in the active view ; to be done before the selection action...
Set (me : mutable; theProj : Projector from Select3D) is static;
---Purpose: Sets the new projector <theProj> to replace the one used at construction time.
Set(me:mutable; aProj: Projector from Select3D) is static;
---Purpose: Sets the new projector aProj to replace the one used at construction time.
SetSensitivityMode(me : mutable;
aMode : SensitivityMode from StdSelect) is static;
SetSensitivityMode (me : mutable;
theMode : SensitivityMode from StdSelect) is static;
---Purpose: Sets the selection sensitivity mode. SM_WINDOW mode
-- uses the specified pixel tolerance to compute the sensitivity
-- value, SM_VIEW mode allows to define the sensitivity manually.
SensitivityMode(me) returns SensitivityMode from StdSelect;
SensitivityMode (me) returns SensitivityMode from StdSelect;
---C++: inline
---Purpose: Returns the selection sensitivity mode.
SetPixelTolerance(me : mutable;
aTolerance : Integer) is static;
---Purpose: Sets the pixel tolerance aTolerance.
SetPixelTolerance (me : mutable;
theTolerance : Integer) is static;
---Purpose: Sets the pixel tolerance <theTolerance>.
PixelTolerance(me) returns Integer from Standard;
PixelTolerance (me) returns Integer from Standard;
---C++: inline
---Purpose: Returns the pixel tolerance.
Pick (me : mutable; theXPix, theYPix : Integer;
theView : View from V3d) is static;
---Level: Public
---Purpose: Picks the sensitive entity at the pixel coordinates of
-- the mouse <theXPix> and <theYPix>. The selector looks for touched areas and owners.
Pick (me : mutable;XPix,YPix:Integer;
aView : View from V3d) is static;
---Level: Public
---Purpose: Picks the sensitive entity at the pixel coordinates of
-- the mouse Xpix and Ypix. The selector looks for touched areas and owners.
Pick (me:mutable;XPMin,YPMin,XPMax,YPMax:Integer;aView:View from V3d) is static;
---Purpose: Picks the sensitive entity according to the minimum
-- and maximum pixel values XPMin, YPMin, XPMax
-- and YPMax defining a 2D area for selection in the 3D view aView.
Pick (me:mutable;Polyline:Array1OfPnt2d from TColgp;aView:View from V3d) is static;
---Level: Public
---Purpose: pick action - input pixel values for polyline selection for selection.
Pick (me : mutable; theXPMin, theYPMin, theXPMax, theYPMax : Integer; theView : View from V3d) is static;
---Purpose: Picks the sensitive entity according to the minimum
-- and maximum pixel values <theXPMin>, <theYPMin>, <theXPMax>
-- and <theYPMax> defining a 2D area for selection in the 3D view aView.
Pick (me : mutable; thePolyline : Array1OfPnt2d from TColgp; theView : View from V3d) is static;
---Level: Public
---Purpose: pick action - input pixel values for polyline selection for selection.
---Category: Inquire Methods
Projector (me) returns Projector from Select3D;
---Level: Public
---Purpose: Returns the current Projector.
---C++: inline
---C++: return const&
---Level: Public
---Purpose: Returns the current Projector.
---C++: inline
---C++: return const&
---Category: Internal Methods
-- -----------------
UpdateProj(me :mutable;
aView: View from V3d) returns Boolean is static private;
---Level: Internal
UpdateProj (me : mutable;
theView : View from V3d) returns Boolean is static private;
---Level: Internal
DisplayAreas (me : mutable;
theView : View from V3d) is static;
---Purpose: Displays sensitive areas found in the view <theView>.
DisplayAreas(me :mutable;
aView: View from V3d) is static;
---Purpose: Displays sensitive areas found in the view aView.
ClearAreas (me : mutable;
theView : View from V3d) is static;
---Purpose: Clears the view aView of sensitive areas found in it.
ClearAreas (me :mutable;
aView: View from V3d) is static;
---Purpose: Clears the view aView of sensitive areas found in it.
DisplaySensitive(me:mutable;aView : View from V3d) is static;
--- Purpose: Displays the selection aSel found in the view aView.
ClearSensitive(me:mutable;aView:View from V3d) is static;
DisplaySensitive (me : mutable; theView : View from V3d) is static;
--- Purpose: Displays sensitives in view <theView>.
ClearSensitive (me : mutable; theView : View from V3d) is static;
DisplaySensitive(me:mutable;
aSel : Selection from SelectMgr;
aView : View from V3d;
ClearOthers : Boolean from Standard = Standard_True)
DisplaySensitive (me : mutable;
theSel : Selection from SelectMgr;
theView : View from V3d;
theToClearOthers : Boolean from Standard = Standard_True)
is static;
DisplayAreas(me:mutable;
aSel :Selection from SelectMgr;
aView : View from V3d;
ClearOthers : Boolean from Standard = Standard_True)
DisplayAreas (me : mutable;
theSel : Selection from SelectMgr;
theView : View from V3d;
theToClearOthers : Boolean from Standard = Standard_True)
is static;
ComputeSensitivePrs(me:mutable;aSel: Selection from SelectMgr)
ComputeSensitivePrs (me : mutable; theSel: Selection from SelectMgr)
is static private;
---Level: Internal
---Level: Internal
ComputeAreasPrs(me:mutable;aSel:Selection from SelectMgr)
is static private;
---Level: Internal
ComputeAreasPrs (me : mutable; theSel : Selection from SelectMgr)
is static private;
---Level: Internal
SetClipping (me : mutable; thePlanes : SequenceOfHClipPlane from Graphic3d) is protected;
---Level: Internal
@@ -190,18 +176,19 @@ is
fields
myprj : Projector from Select3D;
mycoeff : Real from Standard[14];
myprevcoeff : Real from Standard[14];
mycenter : Real from Standard[2];
myprevcenter : Real from Standard[2];
mylastzoom : Real from Standard;
mysensmode : SensitivityMode from StdSelect;
mypixtol : Integer ;
myupdatetol : Boolean;
--areas verification...
myProjector : Projector from Select3D;
myPrevAt : Real from Standard[3];
myPrevUp : Real from Standard[3];
myPrevProj : Real from Standard[3];
myPrevAxialScale : Real from Standard[3];
myPrevFOV : Real from Standard;
myPrevScale : Real from Standard;
myPrevOrthographic : Boolean from Standard;
mySensMode : SensitivityMode from StdSelect;
myPixelTolerance : Integer from Standard;
myToUpdateTolerance : Boolean from Standard;
--areas verification...
myareagroup : Group from Graphic3d;
mysensgroup : Group from Graphic3d;

File diff suppressed because it is too large Load Diff

View File

@@ -14,15 +14,15 @@
inline StdSelect_SensitivityMode StdSelect_ViewerSelector3d::SensitivityMode() const
{
return mysensmode;
return mySensMode;
}
inline Standard_Integer StdSelect_ViewerSelector3d::PixelTolerance() const
{
return mypixtol;
return myPixelTolerance;
}
inline const Handle(Select3D_Projector)& StdSelect_ViewerSelector3d::Projector() const
{
return myprj;
return myProjector;
}