Determine the selection point and the normals



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

    On 02/02/2011 at 02:25, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   12 
    Platform:    Mac  ;  
    Language(s) :     C++  ;   PYTHON  ;

    ---------
    Hi,
    I am new in the plug-in development for cinema 4d. Before I want to write a specific tool plug-in I tried some general stuff. One problem I faced is to determine the correct selection point of a selected polygon or a number of polygons. It should be the same coordinate like is the origin of the three arrows that are shown when the selection tool is active.
    The second problem is to determine the correct normal vector of a selected polygon also if the points of that polygon are not coplanar.

    Thanks,
    Karsten



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

    On 02/02/2011 at 03:00, xxxxxxxx wrote:

    The "three arrows" normally show the modeling axis, which can be set in various ways in the app (Attribute Manager -> Tool -> Modeling Axis). The way to access it is:

      
    BaseObject* objcenter = doc->GetRealActiveObject(NULL, NULL);   
    if (objcenter != NULL)   
    {   
    Matrix centermat = objcenter->GetModelingAxis(doc);   
    // centermat is your "three arrows" coordinate system   
    }                  
    

    As for the normal of a non-coplanar polygon: mathematically, there is none. C4D uses the first three points of a polygon to determine the normal (at least according to the normal line that is drawn in the viewport) and ignores the last. As for N-gons... I do not have the slightest clue, the line just points somewhere!


Log in to reply