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 intersect two polygons?

Grigoriy Pekar's picture
Forums: 

How to intersect two polygons? If somebody knows it, can you give me this infomation? Thanks a lot!

Bearloga's picture

Take a look at the generic class Intf_InterferencePolygon2d. To use, you need to instantiate it.

Grigoriy Pekar's picture

It will be very kind of you if you give to me some examples. Which headers i should include? and what the type of constructor i should to use?

Grigoriy Pekar's picture

And where the definition of this Intf_InterferencePolygon2d...in Intf.hxx i saw only a declaration, but i couldn`t found the definition...And compilator said for me "incomplete type is not allowed"...

Bearloga's picture

It is a generic CDL class. It has no header. Its header is CDL declaration. It should be instantiated using CDL extractor. You should install WOK for that. Or, alternatively, you can do it by hands. For that you need to make header by yourself using declarations in CDL, then make .cpp file including there .gxx file with predefined some macros. You can see the example of instantiation of a generic class, looking at the following automatically generated files (for the class TCollection_Array1 instantiated with Standard_Real as a type argument):
inc/TColStd_Array1OfReal.hxx
drv/TColStd_Array1OfReal_0.cxx

Grigoriy Pekar's picture

" For that you need to make header by yourself using declarations in CDL, then make .cpp file including there .gxx file with predefined some macros. You can see the example of instantiation of a generic class, looking at the following automatically generated files (for the class TCollection_Array1 instantiated with Standard_Real as a type argument):
inc/TColStd_Array1OfReal.hxx
drv/TColStd_Array1OfReal_0.cxx"

Exuse me, but i don`t understand it...Sorry for my noob questions, but, what should i do for use this CDL extractor? Is this WOK in standart OPENCASCADE package?

Bearloga's picture

WOK is a development environment of the OCCT libraries. Anyone can install it in his computer. The source files are available in OCCT. But believe me that installation of WOK is a challenge much more harder than instantiation of a generic class by hands. So, please, take patience, reread my previous post and try to understand how the generic class TCollection_Array1.cdl is instantiated with type argument Standard_Real to create a new class TColStd_Array1OfReal.

Grigoriy Pekar's picture

OOO!!!Now i`m understand)...Previously i misunderstood that i should look for *.cdl file...I`ll try to do it like in your example...I`ll write the results of it there!!!THANKS A LOT!!!

Grigoriy Pekar's picture

Thanks a lot!!!Now it is working. This function can find the points of intersections. Do you know is in opencascade function to unite, find the difference between two polygons, and function to know is point inside the closed polygon?

Bearloga's picture

You can build a planar TopoDS_Face from a 2D polygon (use package BRepBuilderAPI). With faces, you can use standard Boolean operations (from BRepAlgoAPI package), or classify a point inside the face boundary (don't remember exactly the package name, search for FaceClassifier class).