array questions

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

On 16/09/2009 at 14:34, xxxxxxxx wrote:

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

---------
okay, I have the following code which cycles through the polygons and finds polygons that do not have a partner on the other side of a symmetry plane.

> `

  
\>       // Loop through all polygons and see if we need to delete them because they are on the wrong side  
\>       for (lngI=0;lngI<lngPolygonCount;lngI++)  
\>       {       
\>  /////////////////////////////////////////////////////////////////////////////////////////////////////////////  
\>            // Check to see if polygon has a partner   
\>            lngPartner=FindPolyPartnerTemp(arrPolygons,arrPartnerPoints,lngPolygonCount,lngI);  
\>              
\>            if (lngPartner==-1)  
\>            {     GePrint("Poly Doesn't have a partner "+LongToString(lngI));  
\>    
\>                 blnOK = false;  
\>            }  
\>       

`

The console then prints out a list of indices of polygons that do not have partners.

I would like to then store the points that make up those polygons in an array for future use. Can someone tell me what I need to do to store the points that make up the polygons at the printed indices. eventually I would like to find the coordinates of those points and then determine the average of those points to create new points in between those points.

LOL wordy, I know..   but that's what I am looking to do..   can anyone help me?

Thanks,

~Shawn

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

On 16/09/2009 at 17:52, xxxxxxxx wrote:

The CPolygon class stores four indices into the point Vector array of the object (a, b, c, and d). If the polygon is a triangle, c==d. This does not handle n-gons (5+ point polygons). To get the points of the polygon, make sure you have the Vector array (obj->GetPointW()) and index using the CPolygon element members (for instance) :

Vector v = vadr[arrPolygons[lngI].a];

* Remember that polygons share points so deleting a point in the array will affect all polygons that reference it. See ResizeObject() and VariableChanged for information on changing the number of points/polygons on a Polygon object.

To 'store' the points of interest, I would allocate a BaseSelect. BaseSelect acts like a 'yes'/'no' correlation table for selection. You can Select() the points by index in this class and then use it to retrieve only the points of interest (indirectly by index). See BaseSelect::IsSelected() for the efficient way to traverse the selected elements in the array.

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

On 16/09/2009 at 17:57, xxxxxxxx wrote:

what does "vadr" represent?

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

On 16/09/2009 at 17:59, xxxxxxxx wrote:

Vector* vadr = obj->GetPointW();

Just a variable name used often for easy remembrance.

vadr is the point array. (vector address)
padr is the polygon array. (polygon address)

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

On 16/09/2009 at 18:10, xxxxxxxx wrote:

beautiful, awesome, outstanding.   Do they pay you to answer questions here.. LOL.. you deserve a cut!

~Shawn