Hi,
Is there a function to split a polygon into several polygons with a given number of vertices? My problem is that I have to spend a Complex over 101 simple polygonal vertices less than 101 vertices.
I'm programming in VBA
Regards
Good illustration!
Unknown said:Is there a function to split a polygon into several polygons with a given number of vertices?
There is no function that does exactly what you want. There are algorithms that will triangulate a polygon, but that isn't what you want either.
You must write your own algorithm:
Regards, Jon Summers LA Solutions
Hi Jon,
Thanks for your reply. The theory is easy but there is a problem. Your solution is good for regular polygon. But if the polygon is irregular the areas are incorrect. You can see in the picture.
Is there some algorithm or function that triangulates the polygon? I need it is divided into smaller areas and the sum of these is the total area.
Best Regards
Hi Jose,
the problem you describe is a general problem in computation. Just google is:
stackoverflow.com/.../how-can-i-split-a-polygon-by-a-line
Is there any function or method for to be triangulated the complex polygon? After, I can to go joining these polĂgons in other more simple.
Hi Stefan,
I go to see the link.
Stefan,
The example used to divide the polygon lines and I do not I have. Thank you.
> Is there any function or method for to be triangulated the complex polygon?
Yes, it is. But it assumes you to learn and understand how Mesh elements are created, structured and consumed which is in and of by itself quite a lot.
mdlMesh_triangulateEmbeddedArrays
Furthermore, working with indices will allow you to find both outer boundaries of triangulated mesh (including your special case which is a planar polygon) and also to construct a topology of neighbouring triangles, which in turn will enable you to follow Jon's advice of regrouping/dividing the geometry. Be warned that while all this is perfectly doable it is not done in a jiffy.
Cheers,
/Chris Z.
Answer Verified By: Unknown
Thanks Chris.
I'll try that function.
> I'll try that function.
Once you are comfortable with both basic tools for Meshes and can comfortably play with Embedded Arrays (Embedded here is basically an idiomatic synonym to Dynamic... in this context, the naming convention can indeed cause migraine, but its jmdlEmbedded... naming once made sense when described dynamic arrays for now long gone Java JMDL API) you can also take a closer look on mdlPop_... family of functions which provides a higher-level toolbox for Meshes.
Both the jmdlEmbeddedArray_api and the mdlPop_api are unsuitable for use with VBA. They require careful use of pointers and dynamic memory. VBA doesn't know about such things. Once you leave the comfort zone of VBA then errors can occur that you have no way of debugging.
It would be difficult to develop a VBA application that makes extensive calls into MDL. It would be wiser to create the application using MDL or native code C++.
> It would be difficult to develop a VBA application
Oopsie.
Missed the VBA part of this question (but I still believe Phil has some interesting insights in his READ FIRST post on this forum. He may be on to something ;-)
are you still elaborating on your algorithm?
(Casi fin de semana y capaz quiero hacer algo divertido y util).
No. I talked to people who want the program. We seek another solution. Divide the area into smaller areas with sides of 150m. And build smaller areas.
Ok. But this is simple then.
1) Get The Range of your large area element. (el.Range)
2) Build two loops that build all tiles in that range
3) Use a tile and your element to build the union. (GetRegionUnion)
Good luck.
Thanks Stefan for the idea of GetRegionUnion but I found the solution for the first case.