Jump to content

Sampling environment


Recommended Posts

I store them because I use them to create new points, and it's been suggested it may not be safe to do so while looping through points (although in this particular example nothing appears to go wrong if I do so). The other reason is of course because I don't know what I'm doing and try to find out the right ways.

I'll try the point block!

Edited by Macha
Link to comment
Share on other sites

Guest mantragora

I store them because I use them to create new points, and it's been suggested it may not be safe to do so while looping through points.

In your original code you are looping thru GU_Detail* gdp not thru const GU_Detail* input1 and that's why I suggested it.

If you iterate thru you const GU_Detail* input1 you don't have to worry about it because it's const. Than you can add points to GU_Detail* gdp, not to const GU_Detail* input1, so there is no problem with changing geometry.

Edited by mantragora
Link to comment
Share on other sites

Apparently GA_Detail::appendPoint (which returns a GA_Offset) gets overridden by GEO_Detail::appendPoint which returns a GEO_Point. GA_Detail::appendPointOffset is the proper choice in this case... sigh

And as has been mentioned several times: don't iterate over the current node's detail (gdp). Grab a reference to the node's first input geometry.

Link to comment
Share on other sites

  • 2 weeks later...

How come that when I use this technique to loop over points:


GA_FOR_ALL_PTOFF(input0, ptOff)
{
...do something...
}[/CODE]

it doesn't work when I do it twice, like so:

[CODE]
GA_FOR_ALL_PTOFF(input0, ptOff)
{
...do something...
}


GA_FOR_ALL_PTOFF(input0, ptOff)
{
...do something else...
}

[/CODE]

It gives me following error (even if I create a new GA_Offset variable for the second loop):

[CODE]error: redefinition of 'lcl_start'[/CODE]

Wouldn't that lcl_start expire after the first loop is done?

I want to get the min and max value of an attribute I created in the first loop. There may be a min max method, but I didn't find one on the att handle.

Edited by Macha
Link to comment
Share on other sites

Looking at the macro in GA/GA_GBMacros.h it would appear to be doing declaring offset variables outside the loop which naturally leads to this lovely problem. I guess submit a bug? You could at least work around the issue by constructing the loop yourself instead of relying on the macro.

 GA_Offset lcl_start, lcl_end;	 \
for (GA_Iterator lcl_it((gdp)->getPointRange()); lcl_it.blockAdvance(lcl_start, lcl_end); ) \
	 for (ptoff = lcl_start; ptoff < lcl_end; ++ptoff)

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...