How To Map One Curve (Data) onto Another?

   1216   4   2
User Avatar
Member
132 posts
Joined: Aug. 2014
Offline
I have a data set that I can turn into a curve(red). Which has mostly low values, but a number of points hockey-pucks to really high values.
I want to be able to map the red curve onto the green curve, which is a more gently sloping positive curve.
If I normalize the curves from 0-1, is there a way to look up into the red curve (curve U attribute), and get the corresponding Y value on the green curve (at the same U attribute position)?
Thanks

Attachments:
Screen Shot 2022-03-27 at 7.20.14 PM.png (470.0 KB)

Jeroen
User Avatar
Member
166 posts
Joined: March 2014
Offline
I believe you could do this with the primuv VEX function. Without having tested the code, it should be something like this, assuming you plug the red curve into the first input and the green into the second input of a wrangle:
vector pos = primuv(1, "P", 0, set(f@curveu, 0, 0));
User Avatar
Member
132 posts
Joined: Aug. 2014
Offline
Thanks, Digipiction.
I neglected to clarify the lookup mechanism I need:
For a point on the red curve's Y value, return the green curve's Y value with the same curveu index.
i.e. I need to look up: for a point on the red curve with a specific Y value, how do I get the corresponding curveu?
Edited by jlapre - March 28, 2022 11:43:12
Jeroen
User Avatar
Member
166 posts
Joined: March 2014
Offline
I'm sure there's a mathematical solution, but you could probably put a grid at the Y value so that it intersects the red curve, then do an intersection analysis or a boolean to create a point there and read its curveu.

Another way would be to resample the red curve heavily (give it a ton of points), then scale it to 0 on both X and Z so that it points straight up from the origin. Then find the closest point to your Y value:
int n = nearpoint(0, set(0, yValue, 0));
float curveu = point(0, "curveu", n);
User Avatar
Member
255 posts
Joined: Sept. 2012
Offline
I will give a try with Uvsample(), Uvdist()
Edited by vinyvince - June 16, 2023 16:27:07
Vincent Thomas   (VFX and Art since 1998)
Senior Env and Lighting  artist & Houdini generalist & Creative Concepts
http://fr.linkedin.com/in/vincentthomas [fr.linkedin.com]
  • Quick Links