Jump to content

Access Point by Point Number

Recommended Posts

Hi everyone!

I'm looking to access arbitrary point positions by point number. I was hoping to not have to iterate as I only want to access points 0,13,56 for example. Does anyone have any suggestions. I was thinking of just creating my own GA_Offset but I couldn't figure out how to create and edit one without using the helper functions like GA_FOR_ALL_PTOFF.

Thanks for the help!

Share this post

Link to post
Share on other sites

Something like:

const std::array<GA_Index,3> interesting_points = {0,13,56};
for (const auto & point_index: interesting_points) {
  assert(point_index < gdp->getNumPoints());
  GA_Offset point_offset = gdp->pointOffset(point_index);
  UT_Vector3 pos = gdp->getPos3(point_offset);
  // ... do something with pos

It doesn't have to be inside a loop ofc.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now