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

What is the difference between classes Geom_Plane and gp_Pln? (and similar pairs of classes)

Jim Williams's picture
Forums: 

I'm starting to use OpenCascade, and of course learning as I go. I'm successfully loading  STEP files and exampining the toploogy. 

OpenCascade is clearly a very powerful system. But I'm not sure of the difference​ between the various classes I'm using.

For instance, what is the difference​ between the class Geom_Plane and the class  gp_Pln?​ (Or between Geom_CylindricalSurface and gp_Cylinder)?

Geom_Plane contains a  gp_Pln. But it seems you do some operations on the Geom_Plane and some on the gp_Pln

​What is the difference/relationship between Geom_Plane and  gp_Pln? They both contain a method  'Axis()'

When should you use Geom_Plane, and when gp_Pln?

Is there any documentation on this? I have looked, but without success . Perhaps I'm looking in the wrong place.

My (working!) loading code is below.

void MyClass::GetShapeInfo(const TopoDS_Shape& aShape) 
 {

//Get all faces in the shape with an explorer
for (TopExp_Explorer aFaceExplorer(aShape, TopAbs_FACE); aFaceExplorer.More(); aFaceExplorer.Next())
 {                                  

            TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current());            
            
            //Get surface from face
            Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);    

            //Get the type of the surface
            Standard_CString surfaceName =  aSurface->DynamicType()->Name(); //!!jw**
       

            // Handle different surface types. 
            if (aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane))
            {
                Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface);
                //Get plane's normal
                gp_Dir norm = aPlane->Pln().Axis().Direction();

Thank you very much

Mario Mancusi's picture

Hello Jim,

I guess gp_* are "lightweght" geometric classes, that is they do not derive from a smart pointer - like class, so

they are suitable for geometric computations that not involve topology. For example, gp_Pln is suitable to compute

a mean plane of a cloud of points.

Geom_* surfaces, instead, can be shared by smart pointers, so they are more suitable to be used as data member

of topological classes like TopoDS_Face.

Best Regards.

Mario Mancusi

TIAN DAJIANG's picture

Thanks for your answer!

Qr Qr's picture

That's true. Classes from gp form the geometric "language" of the library (gp = geometric primitive). Classes from Geom and Geom2d are designed to participate in B-Rep models (that is, to be shared).

Jim Williams's picture

Thank you, that's very  helpful.

Jim

Jim Williams's picture

Where is the best place to research this sort of thing, in the documentation or elsewhere? I have looked at the documentation, but couldn't find an answer to this question.

Thanks,

Jim

Qr Qr's picture

This forum is a pretty nice knowledge database which you can use to search. And, of course, just keep asking questions, so that you and others will benefit from the conversations which would follow. There are actually TONS of subtleties which you will never find in the documentation, and will unlikely figure out by yourself without a hint from the community. This library is very complicated, but also very challenging. Have fun!

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.