Random Position on Surface?

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

On 29/07/2008 at 06:51, xxxxxxxx wrote:

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

---------
Hi,

is there a good (and fast) way to get a random position on a polygon object's surface, and maybe even the surface normal at that position?

I didn't find anything in the SDK, maybe I just don't know what to search for.

Thanks in advance for any tipps and hints!

Greetings,
Jack

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

On 29/07/2008 at 07:12, xxxxxxxx wrote:

The TP node "PSurfacePosition" does exactly what I want, but I need to implement it in C++. Is there any class I could have a look at which may help me with that?

Thanks again,
Jack

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

On 29/07/2008 at 11:56, xxxxxxxx wrote:

OK, I already got my answer. And a pretty good one, indeed :)

Thanks anyway.

Jack

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

On 29/07/2008 at 13:00, xxxxxxxx wrote:

Nice to hear you found a solution. Would you mind sharing what you found out?

cheers,
Matthias

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

On 30/07/2008 at 12:33, xxxxxxxx wrote:

Get a random polygon from the object, weight it according to its area (to prevent resulting random positions crowding on smaller polygons).

The use random baricentric coordinates to get a position on the triangulated polygon.

At first I wanted to do it with a GeRayCollider shootin' random rays at the geometry, but this way is much faster and less work to implement :)

URL=http://en.wikipedia.org/wiki/Barycentric_coordinates_(mathematics)]Wiki Link[/URL]

Cheers,
Jack[