UV coordinate to polygon?

On 01/07/2016 at 21:56, xxxxxxxx wrote:

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

Is there any easy way of converting a UV coordinate to a polygon index?

Thus far, the only thing I've been able to figure out is to iterate over all the data of a UVWTag using the UVWTag::Get() function as described in the SDK documents, then test to see whether or not the UV coordinate I'm trying to locate actually falls within the triangle/quadrangle defined by the UVWStruct.

This is, of course, very time consuming, since I have to iterate over all the polygons in the UVWTag each and every time my code executes. Is there some other quicker way of handling this?


On 02/07/2016 at 05:20, xxxxxxxx wrote:


Well, it sounds like the Neighbor class would help you there. :wink:

Cactus Dan

On 04/07/2016 at 07:59, xxxxxxxx wrote:


there is no function to achieve what you want.
a) There's no direct 1:1 relation, there could be multiple polygons belonging to a single UW coordinate.
b) There would be some additional data structures be needed to speed up such a look up and these do not exist.
So it would need to be done internally in the same way you can do it on your own. Sorry.