MantisBT - Community
View Issue Details
0030440Community[OCCT] OCCT:Visualizationpublic2019-01-11 05:332019-05-26 10:48
Vico Liang 
bugmaster 
normalminor 
verifiedfixed 
[OCCT] 6.8.0 
[OCCT] 7.4.0* 
Not required
0030440: Visualization - Graphic3d_Camera::Frustum() returns wrong planes in portrait mode
Six planes returned from Graphic3d_Camera::Frustum() are correct in landscape mode, while it's wrong in portrait mode. It's scaled some distance to screen center in portrait mode.
No tags attached.
child of 0024413closed abv Open CASCADE Visualization - get rid of projection shift from orthographic camera definition 
png cadass_protrait.png (56,433) 2019-05-22 16:15
https://tracker.dev.opencascade.org/
Issue History
2019-01-11 05:33Vico LiangNew Issue
2019-01-11 05:33Vico LiangAssigned To => kgv
2019-05-22 13:16kgvNote Added: 0084540
2019-05-22 13:16kgvAssigned Tokgv => Vico Liang
2019-05-22 13:16kgvStatusnew => feedback
2019-05-22 16:15kgvFile Added: cadass_protrait.png
2019-05-23 05:26Vico LiangNote Added: 0084553
2019-05-23 05:26Vico LiangAssigned ToVico Liang => kgv
2019-05-23 05:27Vico LiangStatusfeedback => assigned
2019-05-23 12:01kgvSummaryVisualization - Graphic3d_Camera::Frustum() return wrong in portrait mode for Android => Visualization - Graphic3d_Camera::Frustum() returns wrong planes in portrait mode
2019-05-23 12:04gitNote Added: 0084556
2019-05-23 12:06kgvNote Added: 0084557
2019-05-23 12:07kgvRelationship addedchild of 0024413
2019-05-23 12:08kgvProduct Version => 6.8.0
2019-05-23 13:27kgvNote Added: 0084563
2019-05-23 13:27kgvAssigned Tokgv => bugmaster
2019-05-23 13:27kgvStatusassigned => resolved
2019-05-23 13:27kgvStatusresolved => reviewed
2019-05-23 13:27kgvNote Edited: 0084563bug_revision_view_page.php?bugnote_id=84563#r21245
2019-05-23 15:45bugmasterNote Added: 0084572
2019-05-23 15:45bugmasterStatusreviewed => tested
2019-05-23 15:45bugmasterTest case number => Not required
2019-05-25 19:58bugmasterChangeset attached => occt master a4d594cb
2019-05-25 19:58bugmasterStatustested => verified
2019-05-25 19:58bugmasterResolutionopen => fixed
2019-05-26 10:48gitNote Added: 0084627

Notes
(0084540)
kgv   
2019-05-22 13:16   
Could you please provide a reproducible scenario clarifying what is actually wrong?

Graphic3d_Camera has no platform-specific code, so I suppose the problem should be reproducible on desktop as well. I don't see anything unexpected with vertically stretched window in Draw Harness and vcamera command output.
(0084553)
Vico Liang   
2019-05-23 05:26   
Please see my comment at the last two lines below, Aspect() > 1 condition is correct, the issue just occurs when Aspect() < 1.

void Graphic3d_Camera::Frustum (gp_Pln& theLeft,
                                gp_Pln& theRight,
                                gp_Pln& theBottom,
                                gp_Pln& theTop,
                                gp_Pln& theNear,
                                gp_Pln& theFar) const
{
  gp_Vec aProjection = gp_Vec (Direction());
  gp_Vec anUp = OrthogonalizedUp();
  gp_Vec aSide = aProjection ^ anUp;

  Standard_ASSERT_RAISE (
    !aProjection.IsParallel (anUp, Precision::Angular()),
     "Can not derive SIDE = PROJ x UP - directions are parallel");

  theNear = gp_Pln (Eye().Translated (aProjection * ZNear()), aProjection);
  theFar = gp_Pln (Eye().Translated (aProjection * ZFar()), -aProjection);

 // BUG HERE: if (Aspect() > 1.0)
  Standard_Real aHScaleHor = Scale() * 0.5 * Aspect();
  Standard_Real aHScaleVer = Scale() * 0.5;
  //else if(Aspect() < 1) Otherwise, the code should be
  Standard_Real aHScaleHor = Scale() * 0.5;
  Standard_Real aHScaleVer = Scale() * 0.5 / Aspect();
(0084556)
git   
2019-05-23 12:04   
Branch CR30440 has been created by kgv.

SHA-1: ae530f21ff3988752da8cee0b1dcbf07ca942f6f


Detailed log of new commits:

Author: kgv
Date: Thu May 23 12:02:29 2019 +0300

    0030440: Visualization - Graphic3d_Camera::Frustum() returns wrong planes in portrait mode
    
    Graphic3d_Camera::Frustum() now handles window Aspect Ratio < 1.0.
(0084557)
kgv   
2019-05-23 12:06   
Well, these points are used nowhere in OCCT (V3d_View::FitMinMax() takes only directions), but, indeed, aspect ratio should be taken into account.
(0084563)
kgv   
2019-05-23 13:27   
Please take the patch.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR30440-master-KGV/ [^]

(0084572)
bugmaster   
2019-05-23 15:45   
Combination -
OCCT branch : CR30440
master SHA - ae530f21ff3988752da8cee0b1dcbf07ca942f6f
d67d4b811012eef8913d3c535c29654d0acf3c4c
Products branch : master SHA - 986f3b05d4ac9538c920d339cc6c45c66f97af3b
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16329.970000000028 / 16353.149999999998 [-0.14%]
Products
Total CPU difference: 10514.79000000005 / 10547.03000000006 [-0.31%]
Windows-64-VC14:
OCCT
Total CPU difference: 17768.3125 / 17737.640625 [+0.17%]
Products
Total CPU difference: 12142.015625 / 12094.59375 [+0.39%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0084627)
git   
2019-05-26 10:48   
Branch CR30440 has been deleted by inv.

SHA-1: ae530f21ff3988752da8cee0b1dcbf07ca942f6f