Triangulate() Problem



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

    On 06/01/2011 at 12:53, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R12 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hey guys,

    I got a problem with the function Triangulate(). I want to triangulate an existinting object (like a converted cube) internal (only for me). And then calculate the area (later volume).

      
      BaseObject* obj = doc->GetActiveObject();  
      PointObject* pointobj =  ToPoint((BaseObject* )(obj));  
      Vector* padr = pobj->GetPoint();  
        LONG pcnt = pobj->GetPointCount()  
      
      CPolygon* tripolys;  
      LONG tricount;  
      if(!Triangulate(padr, pcnt, &tripolys, &tricount)) return FALSE;  
      
      LONG i area=0;  
      for(i=0; i<tricount; i++)  
      {  
          const Vector x = points[tripolys[i].b]-points[tripolys[i].a];  
          const Vector y = points[tripolys[i].a]-points[tripolys[i].c];  
          area+=abs(x.Cross(y).GetLength())/2;  
      }  
    

    But I don´t know what Cinema do?
    tricount is 6 for a cube, but shouldn't it not be 12 (6*2)?
    And tripolys gives some strange points out -> over the room, so the vector get 3d not 2d...

    Help me please. 😢



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

    On 10/01/2011 at 14:40, xxxxxxxx wrote:

    How to triangulate polygons intern?



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

    On 13/01/2011 at 10:02, xxxxxxxx wrote:

    What about SendModelingCommand(); ?

    Greetings, nux



  • On 27/02/2013 at 23:32, xxxxxxxx wrote:

    Way late to the party but Triangulate() (and the similar PolyTriangulate class) seem to be attempts at converting point clouds into polygonal meshes by returning triangles over the vertices sent.  My tests show that these are not very useful (unless there is some voodoo required and not mentioned).  Results were very disappointing, even using a planar landscape object or a sphere object with just vertices.

    As NiklasR said, SendModelingCommand(MCOMMAND_TRIANGULATE) is the option to actually take a polygonal mesh object and turn its n-gons and quads into triangles.



  • On 28/02/2013 at 02:04, xxxxxxxx wrote:

    it is because the class is the capping algorithm for c4d, so it is meant to be used for capping and
    not remeshing.



  • On 28/02/2013 at 11:19, xxxxxxxx wrote:

    That settles that.  It would be nice if they provided information like that in the documentation.


Log in to reply