Polygon from point index?



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

    On 17/06/2005 at 09:26, xxxxxxxx wrote:

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

    ---------
    Hi,

    is there an easy way to find out which polygon a point (index) belongs to?



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

    On 17/06/2005 at 10:36, xxxxxxxx wrote:

    Yep. Use this:

    class Neighbor::GetPointPolys(LONG pnt, LONG** dadr, LONG* dcnt)

    Don't know how to use it. Check the docs. :)



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

    On 17/06/2005 at 10:44, xxxxxxxx wrote:

    the neighbor class is too slow for what I need it for but maybe I can preallocate some stuff. thx



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

    On 17/06/2005 at 10:46, xxxxxxxx wrote:

    The only alternative (probably slower) is to loop through each polygon and compare each vertex index within to the point index in question. This is probably what the Neighbor class is doing, just encapsulated.



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

    On 17/06/2005 at 10:47, xxxxxxxx wrote:

    no alternative really as it surely is slower :)



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

    On 17/06/2005 at 13:00, xxxxxxxx wrote:

    The Neighbor class is very fast! looking up the points is taken directly from a table generated at Init (as all of its data is!). Even Init is fast, thats the whole point of the class ;-) It really is the best way, precalc the Init and use the functions, if it was slow you would notice it in CINEMA since its used everywhere.



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

    On 17/06/2005 at 23:38, xxxxxxxx wrote:

    Really? Well, the last time I used it, it was very slow. I used to calculate my vertex normals with it (now I am doing it differently) and uh..hell, was it slow. But ok, I´ll have a look at it then.

    Thanks to both of you!



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

    On 18/06/2005 at 05:05, xxxxxxxx wrote:

    Well I don't think I'm giving away any massive MAXON secret with this code snip, but this is the function you were calling (GetPointPolys) directly out of CINEMA:

        
        
          
        inline void BrowsePoint(LONG pnt, LONG *&data, LONG &cnt)  
        {  
         LONG ind = index[pnt];  
         cnt  = index[pnt+1]-ind;  
         data = field+ind;  
        }  
        
    

    Not exactly what you might call slow ;-) maybe something else was wrong? were you calling Init or precalc'ing it?



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

    On 18/06/2005 at 08:39, xxxxxxxx wrote:

    lol, yes, that doesn´t look too slow ;-) I don´t know what was wrong but init was only called once. It´s just long time ago I used it because of this experience. I guess I need to rethink here now though. Thanks :-)


Log in to reply