Points not on neighbor polygons edges



  • On 16/03/2013 at 15:33, xxxxxxxx wrote:

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

    ---------
    Let's say that I have two triangles (ta and tb) with a neighboring edge.  Using GetPolyInfo(ta), the point of ta that is not on the edge is trivial (for edge[0], it would be ta->c since edge[0] represents an edge from points a->b, etc.).  Is there a simple way to get the point not on the edge for tb or do I really need to find out which of the three point indices of tb (tb->a, tb->b, tb->c) don't match ta->a and ta->b?



  • On 16/03/2013 at 17:07, xxxxxxxx wrote:

    Well, okay.  I went the 'et tu, brute'-force method.  Here is an example for the curious:

    pinfo =        neighbor.GetPolyInfo(i);  
    if (!pinfo->mark[0])  
    {  
      s->Init(f->p1, f->p2, ks, kd, 0.0, 1000.0);  
      ++s;  
      ++scnt;  
      // Diagonal bracing across points not on edge for triangles  
      ef =    pinfo->face[0];  
      if (ef != NOTOK)  
      {  
          np =    &polys[ef];  
          if ((np->a != p->a) && (np->a != p->b))  
              s->Init(f->p3, &masses[np->a], ks, kd, 0.0, 1000.0);  
          else if ((np->b != p->a) && (np->b != p->b))  
              s->Init(f->p3, &masses[np->b], ks, kd, 0.0, 1000.0);  
          else  
              s->Init(f->p3, &masses[np->c], ks, kd, 0.0, 1000.0);  
          ++s;  
          ++scnt;  
      }  
    }
    

    Note: the number of 'edges' (in this case, the 's' array) total for a triangulated object becomes neighbor->GetEdgeCount() + (polygonCount * 2).


Log in to reply