230 Pages

Definition: an isobarycenter, also know as the center of gravity in Physics, is the average of equal masses placed at the point positions.
The formula is to add all the points, and divide by the number of points.
But fortunately, Project Spark has got a tile for that: "centroid". It needs an object set to work, so you'll have to put all your objects in an object set, or directly use each object (with the in-world picker/object variables and "plus"). Here's how this tile works: {object set} [centroid] returns the isobarycenter of the object set. You can found [centroid] inside the "Positioning" folder after an object set, which can be for instance an object set variable or an expression like [ ( ] [object1] [plus] [object2] [plus] ... [plus] [objectn] [ ) ].

The middle is simply the isobarycenter of 2 points. Even though you can use "centroid", it's as if you were using a chainsaw to cut a piece of paper. To keep a more understandle kode, use "centroid" when you have at least 3 points.
If I is the middle of A and B, then I is as far from A than it is from B (which means AI = IB). That implies that AB = AI + IB = AI + AI = 2*AI.
So in the end, you can find your point I, it's on the segment [AB] and such as AI = AB/2, this is to say that vector(AI) = vector(AB)/2
So you can define your point in Project Spark as:
[point I] [equals] [point A] [plus] [ ( ] [point B] [minus] [point A] [ ) ] [divided by] 
The explanation on how this formula works, and more generally, how to do operations on points and vectors, is in the first link.
Now, this isn't the easiest way of doing it. To find the best formula, you should actually look at the general formula for n points: sum(points) / number of points
So: [point I] [equals] [ ( ] [point A] [plus] [point B] [ ) ] [divided by] 
But now, look: the previous formula was saying A + vector(AB)/2,
which is also A + (B-A)/2 = A + B/2 - A/2 = A/2 + B/2 = (A+B)/2.
I hope this small demonstration of the isobarycenter formula for 2 points can help you understand operations on points/vectors a little better.
Lastly, I want to insist on the fact that you cannot do what you want with points. You can add vectors together to get vectors, multiply a vector to get a new vector. But if you're only considering isobarycenters, then you cannot add points to get points. And you cannot multiply points either. It's the combination of both that makes the isobarycenter formula coherent.
Indeed, if you want the isobarycenter of n points, the formula is:
(point_1 + point_2 + ... + point_n) / n = 1/n * point_1 + 1/n * point_2 + ... + 1/n * point_n
You're adding n times one nth of a point. That's a point! You can see that because the sum of the coefficients is n*1/n = 1.
Now, if you're points are all of mass m (not necessarily 1), the isobarycenter will also be of mass m. Indeed, you can do the same calculus and find out that the mass of the isobarycenter is the sum of all coefficients, so (m/n) + (m/n) + ... + (m/n) = n*(m/n) = m
Why am I telling you all this? Because there is not only isobarycenters in life. There is also the barycenter: in physics, this is the center of gravity of points of various masses (if you allow negative masses, which means they repel instead of attract the barycenter). The isobarycenter is just a special case where all masses are equal.
So now, if you have 2 points, instead of just giving the formula for the middle, I can give you a more general formula: how to get any point on the segment [AB]:
M = (1-t)*A + t*B where t is a number between 0 and 1
If t = 0 then M = A, if t = 1 then M = B, and if t = 1/2, then... M is the middle of [AB]! But now, you can get any point on the segment, so for example your t could be a number variable that changes over time, and you'll get some nice animation. And to make sure you see the link between that formula and the barycenter, M is here the barycenter of (A, 1-t) and (B, t), this is to say the point A with a mass of 1-t and B with a mass of t.

Community content is available under CC-BY-SA unless otherwise noted.