Grasshopper

generative modeling for Rhino

# Using Grasshopper to calculate the sum of two vectors?

I was wondering if Grasshopper can help me out with this physics problem I have - I need to sum two vectors - F1 and F2. But, these vectors have their anchor points, and their directions do not lie in the same plane.
If we would look at this as a simple mathematical problem, then we would simply translate one of these two vectors into the anchor point of another one (or some third point) and then by using the Pythagoras theorem we will get the resultant of summation F1 and F2.

But as this is a physics issue, I need some intermediate point (P3) between anchors points of P1 and P2, where the resultant will be located:

Any help on this issue?

I attached the .dxf file of the vectors.

Thank you.

Views: 783

Attachments:

### Replies to This Discussion

Hi Djordje,

You can add two vectors together by using the Addition Component on the Maths Tab.

If you then want to display this vector at an average location use the Average Component along with the Display component

Thank you for the reply Danny.
But I am not sure the resultant vector acts in the middle of the line between two anchors points of vector F1 (orange vector) and vector F2 (green vector).

There is an example of this in here:

It applies to vectors representing masses of two or several objects, but I guess it can also be applied to vectors as forces (or am I wrong???).

With this principle a center of mass of two objects can be calculated:

x = (m1 * x1 + m2 * x2) / (m1 + m2)

where m1 and m2 represent masses of the two objects respectively (in my case it will be forces - intensities of vectors)
x1 and x2 reprent the intensity (length) of the vectors from some reference point (any point we choose) to centers anchor points of vector F1 and F2.

For example let's say our reference point is (0,0,0)
x represents the intensity (length) of the vectors from that chose reference point to the anchor point of the F1+F2 resultant.

The problem is that this method is applied to vectors which have the same direction (both vertical).

In my case I have two vectors with different directions, so I do not know how much is m1 and m2?

I think you want to use the Weighted Average component to compute centers of mass for multiple objects.

You can use Addition as well, but you'll need to multiply the vectors by the weight first and then divide the sum vector by the sum total of all masses.

--

David Rutten

david@mcneel.com

See attached for both the Weighted Average and Roundabout approach. It works for any number of points, not just two.

--

David Rutten

david@mcneel.com

Attachments:

Thank you for the reply David.

Maybe my ignorance is causing all this confusion.

I am trying to sum two vectors (which represent forces), both having separate anchor points (that is the problem) and both acting in the separate planes and directions.

I just thought that principle described in my last reply, about how to find the center of masses for two/several objects can be applied to this my problem. But instead of center of masses, I would find the anchor point for the resultant of sum of those two vectors, I am trying to sum.
I though that maybe for some reason analogy between the masses which are represented by vectors, and forces which are represented by vectors, can be made.

btw I can not open the file WeightedAverage.gh you attached.

I have just downloaded and installed the 00.9.0010 version, but I am getting a message, that WeightedAverage.gh has been saved with the most recent version of grasshopper, when I try to open it.

Does it just warn about a newer version or does it actually fail to open afterwards as well?

--

David Rutten

david@mcneel.com

Both. Nothing happens after the information that file was made with the most resent version of grasshopper, gets confirmed.

Weird. I'll need to look in to that.

Anyway, here's the screenshot.

--

David Rutten

david@mcneel.com

Ok. This component is great.

But it seems that is not what I am looking for.

As I said, part of this is probably caused by my ignorance.

From my math knowledge, we used to translate the vectors to some point, and then sum them.

But I have never crossed onto example like this - where anchor points are fixed but vector directions do not match.

Basically I was hoping Grasshopper can automatically sum two vectors.

P.S.

about the not being able to open the file issue:

Maybe it's because I am using an old AMD processor and PC:

AMD Athlon 1.8 GHZ, 512 RAM DDR, Ge Force 2 MX 400, Windows XP SP3

I already had problems with some other Rhino plugins like Scan and Solve, which is impossible to be installed on my PC configuration.

Maybe I'm missing something, but I don't think you can just substitute forces for masses in that equation. the quantities m1 and m2 are scalar, not vector - it is r1 and r2 that are vector quantities, here representing position rather than any kind of forces.

In general it simply doesn't make sense to speak of vectors with anchor points; vectors can represent positions relative to an origin (as in the above example) or directions with magnitude, but not both.

There is no situation in which (to the best of my knowledge) the sum of two vectors depends on the "position" of those vectors in space - it just doesn't make sense as a question.  Maybe if you can give us a clearer picture of the physical problem you're trying to solve (e.g. calculating the center of mass of multiple objects) we can help explain a little better.

If you are trying to find the sum of multiple forces, you're simply summing vectors - no information about "position" involved. If you are dealing with a rotating object that is fixed to a point, you want to think about torque, which is a cross product of two vectors - maybe that's what you're after?

Hehe, you said "Maths."

• View All