tuu Posted March 10, 2013 Share Posted March 10, 2013 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, Quote Link to comment Share on other sites More sharing options...
edward Posted March 11, 2013 Share Posted March 11, 2013 Try the comments in GU_RandomPoint.h Quote Link to comment Share on other sites More sharing options...
tuu Posted March 11, 2013 Author Share Posted March 11, 2013 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 Quote Link to comment Share on other sites More sharing options...
graham Posted March 11, 2013 Share Posted March 11, 2013 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); Quote Link to comment Share on other sites More sharing options...
symek Posted March 11, 2013 Share Posted March 11, 2013 (edited) 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 March 11, 2013 by SYmek Quote Link to comment Share on other sites More sharing options...
tuu Posted March 12, 2013 Author Share Posted March 12, 2013 Hi guys Thank you so much graham and Symek. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.