# Edge Selection indices

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

On 09/11/2012 at 01:32, xxxxxxxx wrote:

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

---------
I have a question about what the edge index of a selection represents with respect to either a triangular or quadrangular polygon?

"Edges are indexed (4*poly)+edge where edge is from 0-3."

If poly is a triangle and edge 2 is considered, is the edge from poly.c->poly.a or does it always represent poly.c->poly.a?  Here is my code.  Please help me validate that it is correctly considering the vertex indices represented by each edge:

``````        LONG    pi, ei;
for (LONG seg = 0L; bs->GetRange(seg,&a,&b); ++seg)
{
for (i=a; i<=b; ++i)
{
pi =    i/4L;
ei =    Mod(i,4L);
if        (ei == 0L)
{
DetermineAsSourceVertex(verts, normal, polys[pi].a, side, mepsilon);
DetermineAsSourceVertex(verts, normal, polys[pi].b, side, mepsilon);
}
else if (ei == 1L)
{
DetermineAsSourceVertex(verts, normal, polys[pi].b, side, mepsilon);
DetermineAsSourceVertex(verts, normal, polys[pi].c, side, mepsilon);
}
else if (ei == 2L)
{
DetermineAsSourceVertex(verts, normal, polys[pi].c, side, mepsilon);
if (polys[pi].c != polys[pi].d)
DetermineAsSourceVertex(verts, normal, polys[pi].d, side, mepsilon);
else
DetermineAsSourceVertex(verts, normal, polys[pi].a, side, mepsilon);
}
else // ei == 3L
{
DetermineAsSourceVertex(verts, normal, polys[pi].d, side, mepsilon);
DetermineAsSourceVertex(verts, normal, polys[pi].a, side, mepsilon);
}
}
}
``````

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

On 09/11/2012 at 03:55, xxxxxxxx wrote:

Yes, that looks right to me. I have made the same assumptions in my plugins.

/Filip

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

On 20/11/2012 at 10:43, xxxxxxxx wrote:

I just woke up and haven't had me coffee yet but... are you sure that side 2 is used at all if it's a triangle?  I may be crossing some info about one thing with another, but IIRC, side 2 is typically not used/indicated if it's a triangle, which would allow you to skip a test (not a big deal, either way).

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

On 21/11/2012 at 05:45, xxxxxxxx wrote:

Edge 3 (for 0-3 indices) would be omitted and skipped for a triangle.

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

On 21/11/2012 at 08:39, xxxxxxxx wrote:

My reference was from the PolyInfo structure, where you find this in the SDK docs...

``````
`.... S N I P ....

for (i=0; i<polygon_count; i++)
{
pli = n->GetPolyInfo(i);

for (side=0; side<4; side++) // test all 4 sides of a polygon
{
// only proceed if edge has not already been processed
// and edge really exists (***** for triangles side 2 from c..d does not exist as c==d ****** )
if (pli->mark[side] || side==2 && vadr[i].c==vadr[i].d) continue;

// one can also skip the side==2 && vadr[i].c==vadr[i].d test as pli->mark is always TRUE for triangles
switch (side)
{