Jump to content

opinput question


logix1390

Recommended Posts

hello,

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.

@P=v@origP
v@myP= v@opinput1_P;
@Cd= length(@origP-@myP);

I will attach my file for anyone that wants to take a look.

Thank you

 

opinput_p_question.hip

Link to comment
Share on other sites

1 hour ago, logix1390 said:

hello,

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.

@P=v@origP
v@myP= v@opinput1_P;
@Cd= length(@origP-@myP);

I will attach my file for anyone that wants to take a look.

Thank you

 

opinput_p_question.hip

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 :

@Cd = fit(xyzdist(1,@P),0,2,0,1);

Hope that helps

Link to comment
Share on other sites

Hi thank you for your reply.

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

Link to comment
Share on other sites

12 hours ago, logix1390 said:

Hi thank you for your reply.

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)

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