Remap numbers

I’m trying to script ‘a remap of numbers with:

  • a minimum of the minimum;
  • a minimum of the maximum;
    so, a certain percentage of points does not move and a certain amount of points moves to the max; with in between a smoothly transition of points positioning,’

but it’s not working; there is no smoothly transition, what am I doing wrong?
Thanks in advance for your response.

20181117 problem remap numbers (40.0 KB)

So any number smaller than x_0 becomes equal to x_0, any number larger than x_1 becomes equal to x_1, and any number in between x_0 and x_1 is mapped onto an S-shaped curve?

This works… (23.3 KB)

I think the problem was that you’re using the entire range of values for the first remapping component, rather than your specified min-max range.

1 Like

Thank you, okay. Hmmm…
I am actually trying to make it all more controllable. Now I split the remapping in bits, but does not look very good.

Your example is very helpful. I am also trying to actually make it more controllable. My current model does not look good yet.

Do you might know another way?

What does more controllable mean?

Ah yes,
I mean by that:
I take 20% of the points closest to attractors and move them to the max of the remap.
I take 50% of the edge points farthest away from the attractors and move them to the min of the remap.
The rest 80% minus the edge points must transition smoothly between the previous remaps and also remap to the attractors which result in a smoothly ‘controlled’ transitioning.

So the points ‘in between’ the 20% closest and the 50% edge points must easily transition based on average of neighboring points their neigboring points including reacting on the attractors. That is what I am trying to do.

I’m officially confused now. My solution was purely a per-value approach, are there constraints on how much a value is allowed to change based on some sense of value adjacency as well?

We are dealing only with the z-coordinates of points here right?

So you have a list of points and also a list of numbers, where each point is associated with a single number. The points associated with the top 20% highest numbers have their z-value set to some constant to be determined by the user. The points associated with the bottom 50% lowest numbers have their z-value set to some other constant to be determined by the user. The points so far untouched (30% by my reckoning, not 80%), must be averaged with their neighbours, some of which will be locked in place and others who are free as well?

I made a mesh, I take the points of that mesh and move them along the z-axis.
A curve nearby acts as an attractor curve. So, the distances are taken from the points to the curve and remapped from 0.000 to 2.000.

However, I want the 20% closest points to the curve move to the max of 2.000.
And, I want 50% of the points on the edge of the mesh moved to the min of 0.000.
The rest in between must be smoothly transitioned. For that, I was looking for the average of “the distance to the curve” and “the heights of the neighboring points.”

Now I only made it possible to let 20% of the closest points rise to the max of 2.000; to let 50% of the edge points stay on the min of 0.000; and move the other points in height based on the distance to the curve.
But, I was not able to smoothly transition the points between the pre-made highest and lowest points.
And, I am till now since 3 days ago not able to manage that.

The script of the first post shows a clean version without any trials to create a smooth transition. Former made transition trials did not work.
I want to know how to manipulate the graph mapper or of what kind of components I can think of to create a smooth transition. Do you might know?

Your constraints as stated are not really compatible. You’re making decisions based on distance from points to curves, but then you’re also making decisions about what percentage point a specific distance has with respect to all other distances. One of these constraints is a per-value one, the other requires knowledge about all the values.

What you need to do is rephrase the constraints so that they are both only based on distances.

You can do this by sorting all the distance values from smallest to largest. You then extract the sorted value which is 20% along this list of sorted values. This now gives you a single number which is the 20% threshold. Any point which is closer than that one number is part of the closest 20% You can do the same for the 50% threshold.

I added a colour gradient to this example file. Black points are moved the full 2 units and they are the closest 20%, the white points are the furthest 50 percent and do not move at all, the yellow/red points are the interpolated ones. (96.7 KB)

1 Like

Thank you for your response.

So, I think I can apply that 50% on the edges, but I don’t know yet how to do that connected to a smooth transition.
Somehow, when I open it, only one point reaches the full 2. I cannot understand it. On your computer you can see flat surfaces of points that are leveled to 2?

Are you running Grasshopper on Rhino6? If not, you may not have gotten the relay objects (the little grey capsules with the text “Vertices” and “Faces”). Although you should have gotten a warning when opening the file in that case.

Perhaps best if you share a screenshot of the file as it looks on your computer.