DiscussionsIssue archiveOCCT:Visualization

Archived issue #0030440

Visualization - Graphic3d_Camera::Frustum() returns wrong planes in portrait mode

CommunityOCCT:Visualizationclosed7 public notes

Search issues

Description

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.

Public activity

7 archived notes

Participants are labeled by their role within this record.

01Commenter 2
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.
02Author
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();
03Commenter 3
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
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.
04Commenter 2
Well, these points are used nowhere in OCCT (V3d_View::FitMinMax() takes only directions), but, indeed, aspect ratio should be taken into account.
05Commenter 2
06Commenter 1
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
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
07Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records