# Weighted blending of curves / point positions?

## Recommended Posts

I'm trying to blend together several curves.

These curves have been deformed from a base curve, I wish to have these curves blend together in Y based on their weight attributes. Think of the snap to average point position function of the fuse node, but then with weight taken into account.

In its simplest form I have 2 or more points, that need to be replaced by a point in their weighted average position.

To clarify. here is an example:

Point 1 is at Y = -10 with 90% influence

Point 2 is at Y = 15 with 50% influence

Point 3 is at Y = 5 with 20% influence

Does anyone here know if there is a node that does this, or otherwise, what mathematical formula I need to use to solve this problem.

##### Share on other sites

Can't you put the data into chops and blend them over there?

##### Share on other sites

Hey Erwin,

I don't really know in which context you wanted to have this, but in SOPs it can easily be done in a vopsop.

Let me know if the example in the attached file was what you were looking for .

Twan

WeightedCurves.hipnc

##### Share on other sites

Thanks Kim and Twan.

I need it to be able to blend between a variable range of curves so a simple hardwire won't work. I did find a mathmetical formula to do it with. Take the weighted offset of each curve/point. Add these weighted offsets together. Also add the weights together. Divide the sum of the weighted offset by the sum of the weight. And the value you get back is the weighted average.

I haven't worked much with chops so far, I need to have another look at those.

##### Share on other sites

np,

I did find a mathmetical formula to do it with. Take the weighted offset of each curve/point. Add these weighted offsets together. Also add the weights together. Divide the sum of the weighted offset by the sum of the weight. And the value you get back is the weighted average.

That is basically exactly what the vopsop does ,

if you want a variable amount of curves, you will need to put it in a forloop and keep storing the positions and weights per curve to attributes with procedural names.

Then calculate the result with a vopsop with a forloop inside it to go over all the stored data. That would be the most stable solution I guess, though possibly a bit over-designed.

If you know the maximum number of curves is going to something like 5, you could also duplicate the vopsop 5 times for the 5 possibilities and simply feed them into a switch.

## Create an account

Register a new account