Jump to content
Sign in to follow this  

foreach -setpointattrib

Recommended Posts

hello. I am trying to set color to the points in the array that the nearpoints function found. I am trying to set it in a foreach loop. However, it is not working for some strange reason. I'm sure im going wrong somewhere. Here it is:

i[]@ptarray =  nearpoints(1, v@P, chf("maxDist"), 133);

foreach(int pt; @ptarray){
    setpointattrib(0, "Cd", pt, {1,0,0});



Share this post

Link to post
Share on other sites

The logic doesn't work:
nearpoints() will give you point numbers from the second input, they have nothing to do with the first input point numbers.
Here are 2 simple ways of doing what you want, just testing if you get at least one point within a search radius.

// 1) nearpoint 
int pt = nearpoint(1,@P,chf("maxDist"));

// 2) pointcloud


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
Sign in to follow this