Where i wrong?



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

    On 24/03/2005 at 01:29, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.1 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    have a little problem... i have make this simple program with coffee where i count the point of one polygon that have a x coord equal to zero:

      
    var cnt=op->GetPointCount();  
    var p=op->GetPoints();  
    var i=0;  
    var b=0;  
      
    if (!cnt) return TRUE; // no points, nothing to do  
      
    for (i=0; i<cnt; i++)  
    {  
    if (p _.x==0) b++;  
    }  
      
    println (p _); //See the point coordinate into console  
      
    }  
      
    println (b);  
      
    

    Why b contains ZERO?!?!?

    Is right that the value of array p _can i identify with

    p _.x , p _.y , p _.z ?

    Tnx for the answer !



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

    On 24/03/2005 at 10:38, xxxxxxxx wrote:

    p is an array (a list with all points in it). You can access each point of the array with the [] operator.

    if(p _.x==0.0) b++;
    //or maybe p _- >x, not sure, too long ago I used COFFEE :)



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

    On 24/03/2005 at 14:23, xxxxxxxx wrote:

    3D Designer, looking carefully at the code listing above, methinks that he actually has that part, it just got reinterpret_cast-ed ;) into italics.

    Considering that [ i ] is ubiquitous beyond belief in C/C++/COFFEE programming (not to mention nearly every other language), why the web maintainers haven't found a way to exclude [ i ] from [ CODE ][ /CODE ] sections is beyond me...

    Time to have a discussion with Web Wiz Forums, perhaps?

    ETA: Yes, COFFEE always accesses objects with '- >' and not '.', at least in my experience.



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

    On 24/03/2005 at 15:54, xxxxxxxx wrote:

    reinterpret_cast-ed, *ROFL* ;D
    yes, that might be possible. :)

    And concerning the access, the COFFEE docs say

    Vector acces operator = . (v.x)

    So it should be p _.x me thinks. :)



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

    On 24/03/2005 at 18:12, xxxxxxxx wrote:

    Well, here's some of my own COFFEE code relating to Object points:

      
         // - Set Polygon Object's point positions to those of the Null Objects  
         var x = 0;  
         var noVector;  
         var ptArray = polyObject->GetPoints();  
         for (obj = doc->GetFirstObject(); obj; obj = obj->GetNext())  
         {  
              if (instanceof(obj, NullObject))  
              {  
                   noVector = obj->GetPosition();  
                   ptArray[x].x = noVector.x;  
                   ptArray[x].y = noVector.y;  
                   ptArray[x].z = noVector.z;  
                   x++;  
              }  
         }  
         polyObject->SetPoints(ptArray);  
    



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

    On 25/03/2005 at 00:33, xxxxxxxx wrote:

    Tnx for the answers !! :)

    Infact, i have writed p _.x but when i have put the program into code Tag, it have removed It !!

    Tnx to all !! :)


Log in to reply