For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

How to set the parameter in V3d_View?

hr's picture
Forums: 

Hi ,recently I use HLRBRep_Algo to get the 3D projection!Although I can get the 2D !but some lines can be seen,but in the program it is hidden!I want know what the parmeter need to set?In my program i only use the SetProj method!should I need to use SetAt SetEye and so on!if need ,please tell me the rules!!Thank you!!

Yuriy Sinithin's picture

Hi, you may see my Algo in previous message:

http://www.opencascade.org/org/forum/thread_18409/

There I'm make 3D - algoritm for HLR_Algo.

hr's picture

Hi,I read the algorim carefully!But some in it I can not know clearly!
myView->GetProjData(DX,DY,DZ,XAt,YAt,ZAt,Vx,Vy,Vz,IsPerspective,rightBottom, leftBottom, leftTop, rightTop, myX, myY);How does this doing?DX DY DZ XAt,YAt,ZAt,Vx,Vy,Vz ,have you Set them in other place?or automatic get it?If possible can you give whole program to my email!huangrui053469@163.com Thank for all your help!!

hr's picture

Hi,I also know V3d_Coordinate DX,DY,DZ,XAt,YAt,ZAt, Vx,Vy,Vz ;
myActiveView->Proj(DX,DY,DZ);
myActiveView->At(XAt,YAt,ZAt);
myActiveView->Up( Vx,Vy,Vz );
tolerant XAt,YAt,ZAt is 0 0 0,have you change it in your program?I use the mfc examples HLR

Yuriy Sinithin's picture

Hi! It's function like this:

void View::GetProjData(Standard_Real &DX, Standard_Real &DY, Standard_Real &DZ,
Standard_Real &XAt, Standard_Real &YAt, Standard_Real &ZAt,
Standard_Real &Vx, Standard_Real &Vy, Standard_Real &Vz,
Standard_Boolean &IsPerspective,
gp_Pnt &rightBottom, gp_Pnt &leftBottom,
gp_Pnt &leftTop, gp_Pnt &rightTop,
uint sizeX, uint sizeY)
{
myView->Proj(DX,DY,DZ);
myView->At(XAt,YAt,ZAt);
myView->Up(Vx,Vy,Vz);
IsPerspective = (myView->Type() == V3d_PERSPECTIVE);

V3d_Coordinate myV3dX1, myV3dY1, myV3dZ1,
myV3dX2, myV3dY2, myV3dZ2,
myV3dX3, myV3dY3, myV3dZ3,
myV3dX4, myV3dY4, myV3dZ4;

GetCoordFromView(0,0,myV3dX1, myV3dY1, myV3dZ1);
GetCoordFromView(sizeX,0,myV3dX2, myV3dY2, myV3dZ2);
GetCoordFromView(sizeX,sizeY,myV3dX3, myV3dY3, myV3dZ3);
GetCoordFromView(0,sizeY,myV3dX4, myV3dY4, myV3dZ4);

leftTop.SetCoord(myV3dX1, myV3dY1, myV3dZ1);
rightTop.SetCoord(myV3dX2, myV3dY2, myV3dZ2);
rightBottom.SetCoord(myV3dX3, myV3dY3, myV3dZ3);
leftBottom.SetCoord(myV3dX4, myV3dY4, myV3dZ4);

}

Yuriy Sinithin's picture

void View::GetCoordFromView(const Standard_Integer x, const Standard_Integer y, Standard_Real& X,
Standard_Real& Y,
Standard_Real& Z)
{
V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
myView->Eye(XEye, YEye, ZEye);
myView->At(XAt, YAt, ZAt);
gp_Pnt EyePoint(XEye, YEye, ZEye);
gp_Pnt AtPoint(XAt, YAt, ZAt);

gp_Vec EyeVector(EyePoint, AtPoint);
gp_Dir EyeDir(EyeVector);

gp_Pln PlaneOfTheView(AtPoint, EyeDir);
myView->Convert(x,y,X,Y,Z);
gp_Pnt ConvertedPoint (X,Y,Z);
gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project(PlaneOfTheView,ConvertedPoint);
gp_Pnt ResultPoint = ElSLib::Value(ConvertedPointOnPlane.X(),
ConvertedPointOnPlane.Y(),
PlaneOfTheView);

X = ResultPoint.X();
Y = ResultPoint.Y();
Z = ResultPoint.Z();
}

Yuriy Sinithin's picture

If you are see I'm use HLR Algo for two times. For the first to calculate where the HLR Shape must be inserted, after I'm remove him and build HLR Shape for all View and remove result shape on my screen. Also I make main object is unvisible, but selectable and HLR Shape I make not selectable, but visible.

The HLR Demo is no good at working. because you can't change your view mode directly.

hr's picture

You are the kindliness people I met!Thank you!!

hr's picture

I am sorry to interrupt you again!in my program,I have a projection vector for example(0.2588 0.9659 0),at this direction,I want get the 2D ,first I need to set the projection using SetProj(0.2588 ,0.9659 ,0);I want to know if i need to set the viewpoint using SetAt?I think this is the graphic problems,because use the HLR framework I can get the direction which i need!But some line which should hidden,but I can see!

Yuriy Sinithin's picture

Are you using Ortographic view or Perspective? I'm think that for Ortographic view you don't need to use SetAt.

Im my program for change viewpoint I'm only change Projection with myView->SetProj(DX,DY,DZ);

hr's picture

yes ,I use orthographic view ,now i know what i have to do ,thank you for your help!!ºÇºÇ

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.