Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Triangulate?

    Scheduled Pinned Locked Moved SDK Help
    11 Posts 0 Posters 792 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 10/03/2007 at 09:05, xxxxxxxx wrote:

      Have you tried Triangulate()? 🙂

      If your object isn't polygonal, you'll need to convert it to be so first using either BaseDocument::Polygonize() or SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT,...).

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 10/03/2007 at 10:05, xxxxxxxx wrote:

        yes, i saw thet function in the documentation, but i have no clue wherei should get the values from

        Bool Triangulate(Vector* padr, LONG pcnt, CPolygon** vadr, LONG* vcnt)

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 10/03/2007 at 12:13, xxxxxxxx wrote:

          Straight from the polygon object:

          BaseObject* obj; // Your starting object  
          PolygonObject* pobj = ToPoly(obj);  
          Vector* padr = pobj->GetPoint();  
          LONG pcnt = pobj->GetPointCount()  
          if (!pcnt) return FALSE; // - or some error handling. This object has no points (and no useful polygons)  
          // These point to the newly created polygon triangle array and the number of triangles - don't forget to GeFree(tripolys) when you are done with the array!  
          CPolygon* tripolys;  
          LONG tricount;  
          if (!Triangulate(padr, pcnt, &tripolys;, &tricount;)) return FALSE; // Failed to triangulate  
          if (!(tripolys && tricount)) return FALSE; // tripolys=NULL or tricount=0L
          

          Then use these polygons instead of the ones on the original object - use the original points as they don't get changed during triangulation.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 27/03/2007 at 14:17, xxxxxxxx wrote:

            thank you so far, but i still dont get what to do with the array.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 27/03/2007 at 14:44, xxxxxxxx wrote:

              Ah, you are using the built-in Cinema 4D OBJ export. There are two ways to do this then:

              1. Triangulate using SendModelingCommand(MCOMMAND_TRIANGULATE) and get the result to use for export - you'll probably want to InsertObject() this result into the dummy document. Follow the MCOMMAND_CURRENTSTATETOOBJECT example in this case.

              2. Use the tripoly array to update the Polygon object. This will require calling PolygonObject::ResizeObject() with the current vertex array size and new polygon array size, filling in its polygon array with the tripoly array info, and then using the original Polygon object for export.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 31/03/2007 at 00:54, xxxxxxxx wrote:

                thank you very much, works great.

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 22/04/2008 at 10:50, xxxxxxxx wrote:

                  ok, first of all, sry for ressurrecting such an old topic.

                  I'm still have problems with triangulation.

                  Until now i was using SendModelingCommand(MCOMMAND_TRIANGULATE, Mdd), and it works fine.

                  But when i use Triangulate() the way kuroyume described, they alway come out mixed up, i cant get i to work:

                  help?

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 23/04/2008 at 14:58, xxxxxxxx wrote:

                    did i understand something wrong?

                    no idea, anyone?

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 02/01/2009 at 05:13, xxxxxxxx wrote:

                      Hey, I just got the very same problem.
                      Found any solution yet?

                      Or is there working example code for the MCOMMAND_TRIANGULATE? Can't get that to work, either.

                      Thanks in advance!

                      Cheers,
                      Jack

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 06/01/2009 at 03:23, xxxxxxxx wrote:

                        Triangulate() is not really meant to be used for existing polygon meshes but rather for example to create triangles from a point cloud.

                        > Quote: _Or is there working example code for the MCOMMAND_TRIANGULATE?
                        >
                        > * * *
                        _


                        That's actually pretty easy, here an example:

                        > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      StopAllThreads(); \> \>      BaseObject \*op = doc->GetActiveObject(); \>      if(!op) return TRUE; \> \>      if(op->GetType() == Opolygon) \>      { \>           ModelingCommandData md; \>           md.doc = doc; \>           md.op = op; \> \>           SendModelingCommand(MCOMMAND_TRIANGULATE, md); \>      } \>       \>      return TRUE; \> } \>

                        cheers,
                        Matthias

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post