How to reach an perspective projection using a HLRAlgo_Projector?


I'm trying to use

    HLRAlgo_Projector (const gp_Ax2 &CS, const Standard_Real Focus)
    Creates a perspective projector. <CS> is the viewing coordinate system.

but I get something like isometric projection, regardless of the values used:

How to get a view with perspective distortions like this? image

Kirill Gavrilov's picture

From StdPrs_HLRShape::ComputeHLR(), perspective projector setup should look like this:

const Handle(Graphic3d_Camera)& theProjector;

gp_Dir aBackDir = -theProjector->Direction();
gp_Dir aXpers   = theProjector->Up().Crossed (aBackDir);
gp_Ax3 anAx3 (theProjector->Center(), aBackDir, aXpers);
gp_Trsf aTrsf;
aTrsf.SetTransformation (anAx3);

HLRAlgo_Projector aProj (aTrsf, !theProjector->IsOrthographic(), theProjector->Scale());

But unfortunately, HLR algo is just not yet adapted to handle perspective projection properly - it is designed for orthographic projection.

box p 1 1 1
ptorus p 1 0.2
vinit View1
vcamera -persp
vdisplay -dispMode 1 p
vhlr on -showHidden 1 -algoType algo


W W's picture

How do I get the complete Torus outline? Even if it is for otrhographic projection. I'm using HLRBRep_PolyHLRToShape, but OutLineVCompound() return nothing.