Solved BuildNgon() with only two inner edges crashes

Hi,

Porting code again... this seemed to work years ago:

ngonBase->BuildNgon(innerEdges, NULL, 2, 0, polygonsDest, pointsDest);

An array with 2 inner edge indices is passed, and BuildNgon() should construct an Ngon around them.

In R20, I am getting crashes with the following console output:
/Volumes/Branches/build_osx/osx-4-release/depot/release/20.0/modules/model/source/dave/modeling/ngonbase.cpp(1450): CRITICAL: Stop: Degenerated Ngon Creation, an Ngon must have at least 5 vertices.

I am well aware that the actual reason for the crash might be somewhere else... but I want to understand what's going on here. Under which conditions exactly is this error thrown? When are there less than 5 vertices in the Ngon?Does it have anything to do with the topography of the surrounding polygons?

Thank you & greetings,
Frank

www.frankwilleke.de
Only asking personal code questions here.

Hi Frank, thanks for reaching out us.

Can you please provide us with a code snippet to reproduce the Critical Stop?

Thanks, Riccardo

Hmm, I'll try to make something up. The project is non-public code and part of a bigger project.

But even without a code snippet, you might know about any changes, as the code used to work.

If I pass only one inner edge, consisting of 2 vertices, to BuildNgon(), which definitely has either a quad or a triangle at each of its sides, what could go wrong?

Cheers,
Frank

www.frankwilleke.de
Only asking personal code questions here.

I noticed it's a different error message sometimes.

So here goes my next question: Under which circumstances does BuildNgon() print the following error message:
/Volumes/Branches/build_osx/osx-4-release/depot/release/20.0/modules/c4dplugin/source/src/christian/ge_register.cpp(244): WARNING: Unknown baselist allocator - RegID: OBJECT
Optout defined by Installer / Updater.

?

Thanks & greetings,
Frank

www.frankwilleke.de
Only asking personal code questions here.

Oh, it turns out, the last message wasn't triggered by our code. It appears anyway ;-)

www.frankwilleke.de
Only asking personal code questions here.

Hi Frank, thanks for following up.

With regard to

/Volumes/Branches/build_osx/osx-4-release/depot/release/20.0/modules/c4dplugin/source/src/christian/ge_register.cpp(244): WARNING: Unknown baselist allocator - RegID: OBJECT
Optout defined by Installer / Updater.

it has actually nothing to do with BuildNgon()

With regard to

/Volumes/Branches/build_osx/osx-4-release/depot/release/20.0/modules/model/source/dave/modeling/ngonbase.cpp(1450): CRITICAL: Stop: Degenerated Ngon Creation, an Ngon must have at least 5 vertices.

it takes place if the code identifies a potential situation where the number of outer edges ( computed from the list of the inner edges ) is lower than 5 which then could create degenerate ngons (since they should be quads).
This check has been recently introduced to avoid that 4-sides degenerated ngons were created in place of quads.

Best, Riccardo

Hi Ricardo!

OK, thanks! If there a way to ask the Ngon system for more information about that?
Or do we have to recreate parts of the Ngon creation algorithm to find predict degenerate Ngons before calling BuildNgon() ?

Cheers,
Frank

P.S.: Sorry for the late reply!

www.frankwilleke.de
Only asking personal code questions here.

Hi Frank, thanks for following up :)

With regard to your latest question, there are no means to "ask" the Ngon system about that.

Checking for the number of vertexes an n-gon is going to use before deciding to use it, it's a reasonable way to proceed.

Cheers, Riccardo