Displaying a Parabola (gp_Parab)

Hi OpenCascade Users.

I'm trying to display a parábola in the AIS_InteractiveContext. I can't figure out what's wrong with my code. Nothing appears in the screen. I think the problem is whith gp_Dir or gp_Ax1.

My code, so far is:

gp_Pnt aOrigin(0 ,0 , 0);
gp_Dir xDir(1 , 0 , 0);
gp_Ax1 xAxis(aOrigin , xDir);
gp_Pnt aPoint(0,30,0);

gp_Parab aParabola(xAxis,aPoint);
TopoDS_Edge aEdge =
BRepBuilderAPI_MakeEdge(aParabola);

Handle (AIS_Shape) AisShape=new AIS_Shape(aEdge);
myAISContext->Display(AisShape);

I've modified the aOrigin with other coordinates, but the result was the same.

Can anyone help me?

Jeanmi B's picture

Hello David,

I think your problem is due to the fact that AIS cannnot display infinite shapes.
In your case when creating the edge you should add two additional parameters to limit the edge, for example:
TopoDS_Edge aEdge = BRepBuilderAPI_MakeEdge(aParabola,-100.,100.)

Regards. Jean Michel

David Jorge's picture

Thank you Jean. It worked.

I don't understand very well the meaning of the parameters to limit the edge!!
By the way, what kind of shapes are infinite?

Jeanmi B's picture

Hello David,

1/ The parameters that limit the edge depends on the parametrization of the underlying curve. In your case you may find the formula used for the parametrization of the parabola in the documentation of the class Geom_Parabola

2/ The shapes are not infinite. It is their uderlying geometry that could be infinite.
For example a Parabola curve, or a line curve is by definition infinite. So building an edge over these geometry without specifying limit parameters will give you "untrimmed" shapes which cannot be displayed using AIS

Regards. JeanMichel

MCV's picture

Hi David J.,

I am sorry to disturb you, but I am quite new to OCC 5.0 and seeking for a good and "easier" example compared to the tutorials of OCC.

I read your code and would ask you, if you could deliver me the whole Code AS IS, i.e. I would desperately see how to view the Parabola. What classes do I have to use to do it ?. Does the AIS-Class open a Window for the graphic or what ?

Could you help me with the code ? I just need one real world example, that builds an easy object (s.th. elementary like a parabola) and then visualizes the whole thing, so that one can see something finally !.

Please help me. Until now, I found nothing useful within the comments of the FAQs and so. I just need this one complete hint.

Please help me !

Best Regards

Chris

MCV's picture

Hi David J.,

I am sorry to disturb you, but I am quite new to OCC 5.0 and seeking for a good and "easier" example compared to the tutorials of OCC.

I read your code and would ask you, if you could deliver me the whole Code AS IS, i.e. I would desperately see how to view the Parabola. What classes do I have to use to do it ?. Does the AIS-Class open a Window for the graphic or what ?

Could you help me with the code ? I just need one real world example, that builds an easy object (s.th. elementary like a parabola) and then visualizes the whole thing, so that one can see something finally !.

Please help me. Until now, I found nothing useful within the comments of the FAQs and so. I just need this one complete hint.

Please help me !

Best Regards

Chris