bonassus Posted February 22, 2017 Share Posted February 22, 2017 I'm trying to arrange (or add) points on a line so that the distance between them decreases based on a ramp. I have a ramp controlling Cd on the line using: @ptnum/(@numpt -1) I tried using a scatter node and generating the points based on Density Attribute Cd. But this results in some randomness in the decreasing distance. I thought I could use the resample node's distance attribute. but i haven't figured it out. I could one could shed some light here I would appreciate. Thanks B Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted February 22, 2017 Share Posted February 22, 2017 Hi bonassus, create a line with say 50 points and attach a point wrangle, e.g. @P.y = chramp('shift', @P.y); or float shift = chf('shift'); @P.y = pow(@P.y, shift); and click on the little icon appearing on the right of your code. line_density.hipnc 3 Quote Link to comment Share on other sites More sharing options...
bonassus Posted February 22, 2017 Author Share Posted February 22, 2017 POW! That was it. Thank you very much! Quote Link to comment Share on other sites More sharing options...
bonassus Posted March 13, 2017 Author Share Posted March 13, 2017 Thanks again for your response and to my last question. I'm wondering if you could help me with an other question relating to this set up. If you took the line described above for which the distance between the points decrease. Is there a way to get the distances between each point? Say for use in copying boxes to the points whose heights decrease in proportion to the point distances? Sorry of the convoluted questions. feel free to completely ignore this... Thanks. B Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted September 13, 2017 Share Posted September 13, 2017 Hi bonassus, you can access the next point simply by putting @ptnum + 1 in a point function. distance() then does the measuring between the current point @P and the next one pos_next. vector pos_next = point(0, "P", @ptnum + 1); f@pscale = distance(@P, pos_next); removepoint(0, @numpt - 1); The last point on the line gets removed, because measuring would not work that way and because the stack of boxes would then overshoot the line. Make sure to move the box up by half it´s height, as well. line_density_copy_boxes.hipnc 1 Quote Link to comment Share on other sites More sharing options...
bonassus Posted September 13, 2017 Author Share Posted September 13, 2017 Hey thanks! that works well. Okay now I have a random question that you may want to answer. why do I get a different result if i combine the code from the two wragles in to one? It seems like the order of operation should be the same. No? Thanks Again. Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted September 13, 2017 Share Posted September 13, 2017 It seems like you disabled the second attribwrangle on the right side. Apart from that you should not paste the code snippets into the same wrangle. Only when all positions are updated in the first wrangle the next one can go through all new positions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.