View Issue Details

IDProjectCategoryView StatusLast Update
0002618CommunityOCCT:Visualizationpublic2019-08-27 18:53
Reporterbugmaster Assigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
OSAll 
Target Version7.4.0Fixed in Version7.4.0 
Summary0002618: Visualization - choose better center of gravity for camera rotation operations
DescriptionBug from Open CASCADE community
Bug has been registered by François Lauzon

http://www.opencascade.org/forumorg/bug.php?bug_id=125&f=8


There is a bug in the method Gravity (which is used by StartRotation when we
start a rotation). If you see the whole model, the Gravity is set ok and the
rotation work ok, but if you zoom a small part of the model, the Gravity returns
0,0,0 and then the rotation is done by this new center and we "lost" the model.
This will append when all Graphic3d_Structure Bounding Box are outside the view.
Maybe use another way to compute gravity to set the center of rotation...
Additional information
and documentation updates
Documentation remark, added by apl 2011-07-26 11:55:53:

Improvements:
Two new approaches has been developed for rotating the model in the view. In
addition to the older algorithm when the displayed model in the view was
rotated around its gravity point, the new algorithms take for rotation more
appropriate point that provides more convenient method, similar to turning the
camera. There are two new methods: first calculates rotation point depending on
the objects displayed inside of the view that are visible, and the second
calculates rotation point in the same manner with priority of the closest
object in center of the view providing the rotation of the model around this
object. These methods calculate rotation point not the same as the gravity
point, thus the model could go out of front and back view planes (ZSize), but
this solution provides an option that enables automated recalculation of the
view planes for such rotations.

The mathematical part of solution is developed as an utility tool, which could
be reused with any viewer that could provide information on displayed objects
such as bounding boxes and its viewing volume geometrical properties.

You might need to revise code of your application to enable use of these new
approaches. The gravity point will be selected by default as point of rotating
the model when porting your application.
Changes:
Gravity point calculation has been fixed, in the case when the zoomed object
inside of the view the gravity point is taken as the object's center. Two new
approaches to calculate model rotation point has been added: these approaches
project the model on the ray that goes from the center of the view in front
direction, and find average point on it. New enumeration
Aspect_ViewRotationType has been added to define the rotation point calculation
algorithms. The rotation type and option to automatically recompute front and
back view planes (ZSize) is specified for the V3d view in the method
StartRotation that calculates the point of model rotation.

There are changes in the following packages:
Aspect package:
1) New enumeration Aspect_ViewRotationType has been added

Bnd package:
Bnd_Box class:
1) New methods has been added to Bnd_Box class: project its bounding points on
the line (Bnd_Box::ProjectedPoints (const gp_Lin& theLine)), find intersection
points of the line with bounding box (Bnd_Box::IntersectionPoints (const
gp_Lin& theLine))

TColgp package:
1) TColgp_Array1OfPln class has been defined in cdl.

V3d package:
V3d_View class:
1) Gravity method has been corrected;
2) StartRotation method now has two new arguments: theViewRotationType and
FitZSize to provide services of new approaches for calculating the rotation
point and automatically ZSize calculation;
3) FrustumPlanes method has been added, this method calculates view volume
planes of the view, normals of planes are oriented outside the viewing volume;
4) PointOfRotation method has been added, this method uses utility tool to
compute the point of model rotation depending on the bounding boxes and view
volume.

Viewer package:
Viewer_ViewRotationTool class:
1) New class Viewer_ViewRotationTool has been added, this class provides
services for interactive rotation point calculation. This class could be reused
with other viewers.

ViewerTest package:
1) ViewerTest_ViewerCommands.cxx: new command vsetrotationtype has been added
to switch between rotation point calculation methods; this command manipulates
variables that are passed to the StartRotation command on mouse move and right
button click.
Modified entities:
Aspect.cdl - New enumeration Aspect_ViewRotationType has been added.
Bnd_Box.cdl - Two methods ProjectedPoints, IntersectionPoints has been added.
TColgp.cdl - New class TColgp_Array1OfPln has been added.
V3d_View.cdl - New methods FrustumPlanes and PointOfRotation has been added.
Viewer_ViewRotationTool.cxx - new class has been added.
ViewerTest_ViewerCommands.cxx - new method VSetRotationType has been added.
TagsNo tags attached.
Test case numberNot needed

Attached Files

  • OCC2618.txt (3,537 bytes)
  • apl-OCC2618-v1.tar.gz (103,381 bytes)

Relationships

related to 0022520 closedatp Community Update Visualization Users Guide 
related to 0030507 closedbugmaster Open CASCADE Visualization - introduce AIS_ViewController 
has duplicate 0006784 closedbugmaster Open CASCADE Non predicted position of rotation center in View 3d 
related to 0024617 closedbugmaster Open CASCADE Axial scale of view is ignored when computing rotation Gravity point 
related to 0025723 closedbugmaster Open CASCADE Visualization, TKV3d - the center of rotation should be calculated taking into account structure visibility and selection flags 

Activities

2003-05-16 06:48

 

OCC2618.txt (3,537 bytes)

2011-07-08 12:57

 

apl-OCC2618-v1.tar.gz (103,381 bytes)

san

2011-09-13 17:27

developer   ~0018140

Hello,

Here are some remarks concerning the source code, all of "Code style" and "Comments" type.

1. V3d_View.cdl, StartRotation() method - documentation should be updated

2. V3d_View.cxx, line 3175 - here some explanations expected to mention why the code for orthographic projection only is implemented

3. V3d_View.cxx, all changed code fragments - opening braces "{" should be on the same line as corresponding statement(if, else, for), similarly to the rest of the file.

4. Viewer_ViewRotationTool class - it has static methods only, why those methods cannot be the package methods of Viewer package and are not declared in Viewer.cdl? Do we really need a new class for that?

5. Bnd_Box.cxx, lines 1161, 1189, 1192, 1195 - opening "{" should be on the same line as "if"/"for" statements.

6. Aspect.cdl, Aspect_ViewRotationType enumeration - for me, explanation of each rotation type's meaning is not clear ("gravity" most likely means "gravity center" here, right? it is better to use clear wording to avoid questions from the community), especially for VRT_OBJECTSINCENTER.
It would be great to have an example of situation when each rotation type is suitable. Ideally, Visualization User's Guide should be also updated with some illustrations explaining different rotation types.

Best regards,
Sergey

abv

2012-01-18 06:14

manager   ~0019163

Dear Anton,
Could you please refresh the status of this fix?

apl

2012-01-19 09:17

developer   ~0019176

This bug is still assigned and needs correction of remarks

kgv

2014-02-05 14:28

developer   ~0027765

Dear apl,

please analyze workload required to re-done the progress on this issue to current master and finalize integration.

apl

2014-02-17 13:24

developer   ~0027916

Last edited: 2014-02-17 13:24

The development should be based on results of 0024413

git

2015-03-11 10:32

administrator   ~0038238

Branch CR2618_1 has been created by duv.

SHA-1: 458c2c58284045313bb94e094e23baac29754773


No new revisions were added by this update.

git

2015-03-11 11:06

administrator   ~0038243

Branch CR2618_1 has been updated by duv.

SHA-1: d451744c1bf07c93e9ab4116ca9a9860df84b1cd


Detailed log of new commits:

Author: duv
Date: Tue Mar 10 15:15:07 2015 +0300

    0002618: Visualization - choose better center of gravity for camera rotation operations
    
    Gravity point set to camera center.

duv

2015-03-11 11:14

developer   ~0038244

Alternative solution was implemented in advanced visualization demo. New camera concept introduced in OCCT 6.8.0 allows us to use camera "Center" point as "Gravity" point for rotation operations. Center point of camera doesn't get affected by scene contents directly. Thus we may achieve stable and predictable camera behavior.

Implementation available at branch CR2618_1.

kgv

2019-08-27 16:40

developer   ~0086470

Please switch into VERIFIED state.

Patch for 0030507 introduced AIS_RotationMode enumeration, including AIS_RotationMode_PickLast handy for rotating around picked point.

Applications may also override AIS_ViewController::GravityPoint() method to customize this behavior further in desired way, since there is no good answer to the question how to rotate camera in orbit mode within arbitrary geometry.

git

2019-08-27 16:41

administrator   ~0086471

Branch CR2618_1 has been deleted by kgv.

SHA-1: d451744c1bf07c93e9ab4116ca9a9860df84b1cd

Issue History

Date Modified Username Field Change
2003-05-13 11:31 bugmaster Assigned To bugmaster => vtn
2003-05-13 11:31 bugmaster Status new => assigned
2003-05-13 11:31 bugmaster Summary => Bug in V3d_View::Gravity
2003-05-14 16:43 vtn Status assigned => closed
2003-05-14 16:43 vtn Resolution @0@ => unable to reproduce
2003-06-09 18:32 bugmaster Assigned To vtn => bugmaster
2003-06-09 18:32 bugmaster Status closed => assigned
2003-06-09 18:32 bugmaster Resolution unable to reproduce => @0@
2003-06-09 18:32 bugmaster Assigned To bugmaster => vtn
2004-12-15 14:12 vtn Assigned To vtn => khr
2004-12-30 11:29 bugmaster Customer =>
2006-07-27 10:07 bugmaster Assigned To khr => san
2011-04-07 18:10 bugmaster Assigned To san => apl
2011-07-26 13:56 apl CC => kgv
2011-07-26 16:23 apl Assigned To apl => kgv
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2011-09-13 17:27 san Note Added: 0018140
2011-09-13 17:27 san Assigned To kgv => apl
2011-09-13 17:27 san Status assigned => reviewed
2011-09-13 17:27 san Status reviewed => assigned
2011-09-13 17:35 san Relationship added related to 0022520
2011-09-21 14:11 szy Fixed in Version EMPTY =>
2011-09-21 14:11 szy Target Version => 6.5.3
2011-09-21 14:11 szy Description Updated
2011-09-21 14:11 szy Additional Information Updated
2011-11-23 16:47 szy Additional Information Updated
2011-11-23 16:48 szy Additional Information Updated
2012-01-18 06:14 abv Note Added: 0019163
2012-01-18 06:14 abv Status assigned => feedback
2012-01-19 09:17 apl Note Added: 0019176
2012-01-19 09:17 apl Status feedback => assigned
2012-03-12 07:28 abv Target Version 6.5.3 => 6.5.4
2012-10-23 19:34 abv Target Version 6.5.4 => 6.6.0
2013-02-20 19:31 kgv Target Version 6.6.0 => 6.7.0
2013-11-01 19:37 san Target Version 6.7.0 => 6.7.1
2014-02-05 14:28 kgv Note Added: 0027765
2014-02-05 14:28 kgv Status assigned => feedback
2014-02-05 14:47 kgv Relationship added has duplicate 0006784
2014-02-11 17:24 apl Relationship added related to 0024617
2014-02-17 13:23 apl Status feedback => assigned
2014-02-17 13:24 apl Note Added: 0027916
2014-02-17 13:24 apl Note Edited: 0027916
2014-04-04 18:09 abv Target Version 6.7.1 => 6.8.0
2014-08-06 12:07 kgv Priority normal => high
2014-08-06 12:07 kgv Severity trivial => feature
2014-08-06 12:07 kgv Summary Bug in V3d_View::Gravity => Visualization - choose better center of gravity for camera rotation operations
2014-09-26 14:24 abv Target Version 6.8.0 => 7.1.0
2015-01-26 14:46 kgv Relationship added related to 0025723
2015-01-26 14:50 kgv Priority high => normal
2015-03-11 10:32 git Note Added: 0038238
2015-03-11 11:06 git Note Added: 0038243
2015-03-11 11:14 duv Note Added: 0038244
2016-10-25 09:48 kgv Target Version 7.1.0 => 7.2.0
2017-07-20 10:55 kgv Target Version 7.2.0 => 7.4.0
2019-08-27 16:34 kgv Relationship added related to 0030507
2019-08-27 16:40 kgv Note Added: 0086470
2019-08-27 16:40 kgv Assigned To apl => bugmaster
2019-08-27 16:40 kgv Status assigned => resolved
2019-08-27 16:40 kgv Status resolved => reviewed
2019-08-27 16:41 git Note Added: 0086471
2019-08-27 18:53 apn Test case number => Not needed
2019-08-27 18:53 apn Status reviewed => verified
2019-08-27 18:53 apn Resolution open => fixed