opinput question

Recommended Posts

I have a grid, and a sphere plugged into the second input of the point wrangle. Trying to create some color following the sphere if I move it....

just wondering why this doesn't work. I am trying to store the current position of the grid into an attribute called v@origP. and then i store the current position of the sphere from the second input into an attrib called @myP...however it says their is an error. Not sure what im doing wrong here.

Share this post

Link to post

Share on other sites

I have a grid, and a sphere plugged into the second input of the point wrangle. Trying to create some color following the sphere if I move it....

just wondering why this doesn't work. I am trying to store the current position of the grid into an attribute called v@origP. and then i store the current position of the sphere from the second input into an attrib called @myP...however it says their is an error. Not sure what im doing wrong here.

The Point Wrangle is running th epoint over each point of your grid, therefore when you write @P=v@origP, you are basically telling him to change the position of each point of the grid to v@origP, which is the null vector (because it hasn't been set to anything else previously). So the grid collapse.

Can you explain what you are trying to do ? What is the "current position of the grid" ? You talk about the center of the grid ?.

If you want to color the points of the grid proportionally to their distance to the center of the sphere, then maybe just put that code into tha wrangle :

v@myP = point(1,"P",0);
@Cd = fit(length(v@P-v@myP),0,5,0,1);

Don't forget to use fit() because your length maybe outside of what you can display (r,g,b) values should be between 0 and 1.

If you want to color them based on the distance to the closest point of the sphere (because it is deformed and you want that to influence the color), then use that code instead :

Share this post

Link to post

Share on other sites

Both your methods work great and it is exactly what I was trying to do.

I was actually trying to get more familiar with @opinput.

If i replace opinput instead of point into your code:

v@myP = v@opinput1_P;
@Cd = fit(length(v@P-v@myP),0,5,0,1);

I would think this would have the exact same effect, but instead the color goes to the center of the grid.

I am not sure why?

Thank you for the help

The color goes to the center of the grid because the @myP is set to zero, which indicates the @opinput_P returns 0, for most of the points : don’t forget that it returns the position P of the corresponding point in your opinput1, and there is only 1 point (with id 0).

As the wrangle run the code over each point, the @myP is OK for point 0, but as soon as it iterates over the points that have a number higher than zero, it can find the opinput1_P of the corresponding points in this input, because there are not.

That’s why I used the point(1, « P »,0) = it stands for (input1, Position P, point number 0)

Not sure if I am clear :-)

The @opinput1_attribute is OK when you look for « bijective » streams of geometry in terms of topology (or at least when what you seek to do doesn’t need to reference any particular points, as in this example)