Quad/Triangulate from scratch



  • On 18/05/2017 at 03:44, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    I just look at this project https://github.com/heimlich1024/OD_CopyPasteExternal.
    and I started a fork aviable here for c4d https://github.com/gr4ph0s/OD_CopyPasteExternal/tree/master/C4D/Source/source (don't look UV part is not finnished yet)

    I would like to build ngon from scratch but the only information I found is from an already triangulate/quad https://c4dprogramming.wordpress.com/2013/06/21/all-the-fun-you-can-have-with-ngons/

    Since only informations I have are

    • pt_num in the ngon
    • each pt_id
    • each pt_position

    I guess the first step is to build a triangulate version of this then translate them into ngon.

    Is there any function for make such things ? Or I have to do mine?

    Thanks in advance.

    Btw: my final goal is to build ngon from scratch, so if there is no real need for make quad/tri before it's ok ! ;)



  • On 18/05/2017 at 07:17, xxxxxxxx wrote:

    This thread has an example of making an NGon based object from scratch:
    https://plugincafe.maxon.net/topic/9693/13035_ngons-usage-solved&KW=ngonPoints&PID=51576#51576

    -ScottA



  • On 18/05/2017 at 07:40, xxxxxxxx wrote:

    Wow exactly what I need ! :D

    EDIT:
    I just have a little ask is there a way for retrieving poly_ids of the created ngon?
    I don't really understand how ngon, poly id are handle.

    lets imagine I get 3 poly
    poly id 1
    and poly 2 and 3 are 1 ngon.

    PolygonObject.GetPolygonCount() return me 3.
    But is there a way for make it return 2?
    Or does I have to do some calcul with GetPolygonCount and the ngnon count + ngon poly?

    Thanks in advance anyway.



  • On 19/05/2017 at 07:01, xxxxxxxx wrote:

    Hi,

    you have a bunch of options.

    As you already stated GetPolygonCount() returns just the number of polygons (tris and quads) without considering ngons at all, so also all polygons being part of ngons will add into this count. As you said, in your example it's three.

    Then there is GetNgonCount(), which really only returns the number of ngons. In your case it's one.

    Finally there are GetPolygonTranslationMap() and GetNGonTranslationMap(), both not only provide you with translation maps, but also with another ngon count, which in this case is exactly what you are looking for. It is the number of all tris and quads not part of any ngons plus the number of ngons. So in your example two.

    You may have been hesitant to look into the later two, as you probably have seen a thread in Python sub-forum, where I stated GetPolygonTranslationMap() to be buggy, but that's really just an issue in Python. In C++ these functions are fine.



  • On 19/05/2017 at 07:25, xxxxxxxx wrote:

    Thanks you alot Andreas.

    You really read my mind it's freaking with GetPolygonTranslationMap...

    I guess I have everything I need.


Log in to reply