Jump to content

HDK GU_RandomPoint::generatePoints


Recommended Posts

Hi everyone,

I'm very new to HDK.

Can anybody explain how to use GU_RandomPoint::generatePoints please?

I've tried to scatter points on a surface, but I don't know how to use the above method.

There is no clear information about it in the document, or maybe I didn't see it.

Thanks,

Link to comment
Share on other sites

Hi Edward

Thank you for reply :) Unfortunately, I couldn't make it works though.

It will be very appreciate if anyone can provide me some hint or snippet of code of how to use this function.

Best Regards

Link to comment
Share on other sites

GA_Size num_prims;

UT_FloatArray probability;

num_prims = gdp->getNumPrimitives();

for (int i=0; i<num_prims; ++i)
    probability.append(i);

GU_RandomPoint::generatePoints(*gdp, 100, 0, probability, 0);

Link to comment
Share on other sites

Hi Edward

Thank you for reply :) Unfortunately, I couldn't make it works though.

It will be very appreciate if anyone can provide me some hint or snippet of code of how to use this function.

Best Regards


#include <GU/GU_Detail.h>
#include <GU/GU_RandomPoint.h>

int main()
{
GU_Detail gdp;
if (!gdp.load("box.bgeo").success())
return 1;

GU_RandomPoint grp;
UT_FloatArray prob;
prob.entries(gdp.getNumPrimitives());
prob.constant(1.0);
grp.generatePoints(gdp, 1000, 1, prob, 0);
gdp.save("points.bgeo", NULL);
return 0;
}[/CODE]

edit: ups, graham was faster.

Edited by SYmek
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...