# Barycenter of 3 points

### #1

Posted 14 November 2010 - 10:36 AM

See, suppose I've got all the coords, all of them. And :

G barycenter of (A,a) (B,b) and (C,c) ;ABC a triangle.

And I need to calculate the a,b and c.

Well you might think, what is this for?

I just need it for my painting tool. Thx in advance.

immm, I know these function :

Gx= (a*Ax+b*Bx+c*Cx) / (a+b+c)

Gy= .... Etc ...

### #2

Posted 14 November 2010 - 12:17 PM

You want to calculate the coordinates of a triangle, that has a barycenter located at G ? There's an infinity of possible triangles whose barycenter is G.Ok I know what a barycenter is; but I need to reverse the process.

See, suppose I've got all the coords, all of them. And :

G barycenter of (A,a) (B,b) and (C,c) ;ABC a triangle.

And I need to calculate the a,b and c.

Maybe you could explain more carefully what you want.

### #3

Posted 14 November 2010 - 01:16 PM

If you've got all the coordinates, where does the 'barycenter' come into it?See, suppose I've got all the coords, all of them. And :

G barycenter of (A,a) (B,b) and (C,c) ;ABC a triangle.

And I need to calculate the a,b and c.

### #4

Posted 14 November 2010 - 02:48 PM

So he knows only the x values of the triangle but not the y values.

### #5

Posted 14 November 2010 - 03:23 PM

Ok here it is :

I am now able to calculate the intersection between a 3D model triangle and the mouse vector.

Suppose G the point of intersection.

ABC the triangle points.

So we can admit that G is the Barycenter of (A,a) , (B,b) and (C,c)

If I'll be able to calculate a,b and c, I will be able to calculate G pos on the UVmap.

And I know all the coords. ALL of them. Thx

**Edited by The Scorpion, 14 November 2010 - 03:24 PM.**

### #6

Posted 14 November 2010 - 07:01 PM

You need to define some of your "terms":

1) What do you mean by "mouse vector"? You mean the mouse screen position?

2) Is the triangle really defined in 3-space? Or in the screen plane?

3) What do you mean by (A,a),(B,b) and (C,c)? Or these the X,Y coordinates?

Better yet, draw us a picture.

### #7

Posted 14 November 2010 - 08:17 PM

The process is fully 3d.

ok, suppose ther is a point G(gx,gy,gz) that belongs to a plane (P) in 3d

ABC a triangle also icluded in (P)

Ok so we can say that G is the Barycenter of (A,a: val) (B,b) and (C,c)

Do I need to explain what a barycenter is?

Suppose that I have all the points coords.

How can I calculate a,b and c ?

### #8

Posted 14 November 2010 - 08:25 PM

-IMP

### #9

Posted 14 November 2010 - 08:43 PM

I'll assume you all know what a brycenter is.

exemple :

If G is the Barycenter of (A,2) (B,3) and (C,8) we can get the G coords by : Gx= ( 2 * Ax + 3 * Bx + 8 * Cx) / (2 + 3 + 8) same thing with Gy and Gz, but replace all x coords with y and z coords.

Get it?????

Now to reverse the Process, I know all the coords, but I need to calculate a,b,c?

If I'll have to explain this one more time, I'll close the Topic. Please People, I thought this won't Take more than 2 hours to be solved.

### #10

Posted 14 November 2010 - 08:44 PM

Do I need to explain what a barycenter is?

No, you need to explain what (A, a) means.

### #11

Posted 14 November 2010 - 08:55 PM

Is that what you mean by (A,a), (B,b) etc?

### #12

Posted 14 November 2010 - 09:11 PM

http://www.fmaths.co...nter/lesson.php

(A,a) means that the Point (A) with coords (Ax,Ay,Az)

get tha value (a) as a coefficient.

Sorry if My math English words are incorrect.

If you knew what a barycenter is, you'll immediately understand what (A,a) is.

**Edited by The Scorpion, 14 November 2010 - 09:18 PM.**

### #13

Posted 14 November 2010 - 11:10 PM

If all of the vertices have the same weight, then simply find the average of each of the components. Otherwise, you'll do a weighted average to find the center of mass.

However, this process clearly isn't reversible since you are taking a collection of ordered triplets and getting a resulting singlet, of which is not unique. So there isn't a (unique) way of reversing this process.

### #14

Posted 16 November 2010 - 06:21 PM

I know that it's a 3 equations system.

But you see I'm not that good at math.

First it's not a center of mass. It's a barycenter of

**3**points.

Second, I'm ,if you like looking for these weights.

Ok here it is, if out of 3 points ABC, I get a Barycenter G at a particular Position in the space, How can I calculate the 3 points A,B and C masses ?

So far tha'ts what I got :

if

a=alfa b=beta c=gamma Gx = ( a * Ax + b*Bx + c* Cx) / ( a+b+c)

Then

a * Ax = Gx * (a+b+c) - b*Bx - c*Cx a - a * (Gx /Ax) = (b*Gx + c*Gx - b * Bx - c*Cx ) / Ax a = ( (b*Gx + c*Gx - b * Bx - c*Cx ) / Ax ) / (1- Gx/Ax)

Pls I want you to check if my calculs are correct.

if we do the same with BETA and Gamme

we can get a 3 equations system :

a = ( (b*Gx + c*Gx - b * Bx - c*Cx ) / Ax ) / (1- Gx/Ax) b = ( (a*Gx + c*Gx - a * Ax - c*Cx ) / Bx ) / (1- Gx/Bx) a = ( (b*Gx + a*Gx - b * Bx - a*Ax ) / Cx ) / (1- Gx/Cx)

See that simple, Because I haven't Got so far in Math Studies (system of 3 equations)

I need help to calculate (a,b and c)

Thanks for everyone, I know you're trying to Help, But seriously, it was not that obvious.

**Edited by The Scorpion, 16 November 2010 - 06:38 PM.**

### #15

Posted 16 November 2010 - 06:54 PM

If you have what you're saying:

eqn1 = Gx == a Ax / (a + b + c) + b Bx / (a + b + c) + c Cx / (a + b + c)

eqn2 = Gy == a Ay / (a + b + c) + b By / (a + b + c) + c Cy / (a + b + c)

eqn3 = Gz == a Az / (a + b + c) + b By / (a + b + c) + c Cz / (a + b + c)

Then your goal hopefully is to find a, b, c, given that you have Gx, Gy, Gz, etc.

Unfortunately, Mathematica does not yield a solution to this.

### #16

Posted 17 November 2010 - 10:06 AM

I see, you are strictly working with three points and three coefficients.

If you have what you're saying:

eqn1 = Gx == a Ax / (a + b + c) + b Bx / (a + b + c) + c Cx / (a + b + c)

eqn2 = Gy == a Ay / (a + b + c) + b By / (a + b + c) + c Cy / (a + b + c)

eqn3 = Gz == a Az / (a + b + c) + b By / (a + b + c) + c Cz / (a + b + c)

Then your goal hopefully is to find a, b, c, given that you have Gx, Gy, Gz, etc.

Unfortunately, Mathematica does not yield a solution to this.

Why is that I think it's possible, If we can express

a = (expression that does not contain (a) as a variable)

b and c as well, then this system can be solved.

I know that such math exists but I don't know the process.

I know Gx,Gy,Gz, as well as Ax,Ay,Az,Bx,By ... all the coords are known.

Does this help now?

### #17

Posted 17 November 2010 - 01:20 PM

Go ahead and try that. I think you'll find those quadratic terms make it difficult.If we can express

a = (expression that does not contain (a) as a variable)

b and c as well, then this system can be solved.

A simple algebraic approach (reducing the number of variables by substitution) won't work here. You'll need to be more clever.

### #18

Posted 17 November 2010 - 04:31 PM

Probably because there isn't a unique solution? For instance, if (a, b, c) = (1, 2, 3) satisfies the equation, then (2, 4, 6), (3, 6, 9), (10, 20, 30) and so on will also satisfy it.Unfortunately, Mathematica does not yield a solution to this.

I think you need an additional constraint. For example, assume that we know the total weight of those three points. Let a+b+c=M that is a constant. Then we get the following simultaneous equations that is solvable:

Gx = a'Ax + b'Bx + c'Cx

Gy = a'Ay + b'By + c'Cy

Gz = a'Az + b'Bz + c'Cz

where a'=a/M, b'=b/M and c'=c/M.

**Edited by torigara, 17 November 2010 - 05:29 PM.**

### #19

Posted 17 November 2010 - 05:50 PM

Probably because there isn't a unique solution? For instance, if (a, b, c) = (1, 2, 3) satisfies the equation, then (2, 4, 6), (3, 6, 9), (10, 20, 30) and so on will also satisfy it.

Unfortunately, Mathematica does not yield a solution to this.

I think you need an additional constraint. For example, assume that we know the total weight of those three points. Let a+b+c=M that is a constant. Then we get the following simultaneous equations that is solvable:

Gx = a'Ax + b'Bx + c'Cx

Gy = a'Ay + b'By + c'Cy

Gz = a'Az + b'Bz + c'Cz

where a'=a/M, b'=b/M and c'=c/M.

I don't really follow you in here. But here comes an idea, If we suppose that a=1

then this will became 2 equations system.

Is this correct?

**Edited by The Scorpion, 17 November 2010 - 05:51 PM.**

### #20

Posted 17 November 2010 - 08:54 PM

Probably because there isn't a unique solution? For instance, if (a, b, c) = (1, 2, 3) satisfies the equation, then (2, 4, 6), (3, 6, 9), (10, 20, 30) and so on will also satisfy it.

Usually Mathematica will give you every solution, even ones you don't want. Perhaps I was erroneous on the equations that I entered. There obviously are solutions, but getting them might not be doable through algebraic means. Using the constraint does yield a solution, of course, since it results in a linear equation, and its just as one would expect it to be.

I don't really follow you in here. But here comes an idea, If we suppose that a=1

then this will became 2 equations system.

Is this correct?

Don't approach the problem like this. Instead, just solve the system of three equations and three unknowns.

### #21

Posted 18 November 2010 - 02:12 AM

I don't know much about Mathematica, but does it give solutions when there is anUsually Mathematica will give you every solution, even ones you don't want.

*infinite*number of them?

The problem here is that, when a set of numbers (a

_{0}, b

_{0}, c

_{0}) is a solution, then (n*a

_{0}, n*b

_{0}, n*c

_{0}) is also a solution for all n (except 0.) Actually, G is determined by the

*ratio*a:b:c.

Sorta correct; that's another way to add a constraint (by putting 1:bIf we suppose that a=1 then this will became 2 equations system.

Is this correct?

_{1}:c

_{1}=a:b:c to obtain one of solutions.)

If you don't still follow, consider the following scales as a simplified example. Given the mass of each weight, it is easy to determine the balancing point C.

| | +--------+-----------------+ | C | +--+--+ +--+--+ | 50g | | 25g | | | +-----+ +-----+ |<------>|<--------------->| 10cm 20cmHowever, the reverse isn't generally possible. If weights are unknown, all we can tell is that M1=2*M2 (or M1:M2=2:1) unless there is additional information (e.g. M1 is a constant.)

| | +--------+-----------------+ | C | +--+--+ +--+--+ | ? | | ? | | | +-----+ +-----+ M2 M1 |<------>|<--------------->| 10cm 20cm

As for solving the problem: supposing that , the aforementioned three equations are tranformed as following.

a(Ax-Gx) + b(Bx-Gx) + c(Cx-Gx) = 0

a(Ay-Gy) + b(By-Gy) + c(Cy-Gy) = 0

a(Az-Gz) + b(Bz-Gz) + c(Cz-Gz) = 0

The first one represents a 3-d plane whose normal vector is (Ax-Gx, Bx-Gx, Cx-Gx) and passes the point (0, 0, 0). The latter two represent other planes all passing (0, 0, 0). Solving the above simultaneous equations is equivalent to finding the intersection of those three planes. It is apparent that they intersect at (0, 0, 0), but it isn't the solution because of the restriction that a+b+c is not 0. To have intersection point other than (0, 0, 0), all of three planes must share the same intersection line (i.e. their normal vector is on a same plane.) All solutions lie on this common intersection line.

So, we only have to calculate the intersection line between the first two (the other one also shares the same line.) Now, let the direction vector of the intersection line (Va, Vb, Vc). This is perpendicular to the normal vector of two planes. So, just calculate the cross production:

Va = (Bx-Gx) * (Cy-Gy) - (Cx-Gx) * (By-Gy)

Vb = (Cx-Gx) * (Ay-Gy) - (Ax-Gx) * (Cy-Gy)

Vc = (Ax-Gx) * (By-Gy) - (Bx-Gx) * (Ay-Gy)

Choose an arbitray number t (that is not 0), then you can derive a, b and c as:

a = t * Va

b = t * Vb

c = t * Vc

**Edited by torigara, 18 November 2010 - 10:37 AM.**

### #22

Posted 18 November 2010 - 02:57 AM

I don't know much about Mathematica, but does it give solutions when there is an infinite number of them?

Typically yes--it'll write everything in terms of some free variables. If you had three unknowns and two equations, it'll get it down to one equation.

### #23

Posted 18 November 2010 - 07:07 AM

I don't really follow you in here. But here comes an idea, If we suppose that a=1

then this will became 2 equations system.

Is this correct?

Don't approach the problem like this. Instead, just solve the system of three equations and three unknowns.

Ok, I'll try that. thx any way

### #24

Posted 18 November 2010 - 11:59 AM

I don't know much about Mathematica, but does it give solutions when there is an

Usually Mathematica will give you every solution, even ones you don't want.infinitenumber of them?

The problem here is that, when a set of numbers (a_{0}, b_{0}, c_{0}) is a solution, then (n*a_{0}, n*b_{0}, n*c_{0}) is also a solution for all n (except 0.) Actually, G is determined by theratioa:b:c.Sorta correct; that's another way to add a constraint (by putting 1:bIf we suppose that a=1 then this will became 2 equations system.

Is this correct?_{1}:c_{1}=a:b:c to obtain one of solutions.)

If you don't still follow, consider the following scales as a simplified example. Given the mass of each weight, it is easy to determine the balancing point C.| | +--------+-----------------+ | C | +--+--+ +--+--+ | 50g | | 25g | | | +-----+ +-----+ |<------>|<--------------->| 10cm 20cmHowever, the reverse isn't generally possible. If weights are unknown, all we can tell is that M1=2*M2 (or M1:M2=2:1) unless there is additional information (e.g. M1 is a constant.)| | +--------+-----------------+ | C | +--+--+ +--+--+ | ? | | ? | | | +-----+ +-----+ M2 M1 |<------>|<--------------->| 10cm 20cm

As for solving the problem: supposing that , the aforementioned three equations are tranformed as following.

a(Ax-Gx) + b(Bx-Gx) + c(Cx-Gx) = 0

a(Ay-Gy) + b(By-Gy) + c(Cy-Gy) = 0

a(Az-Gz) + b(Bz-Gz) + c(Cz-Gz) = 0

The first one represents a 3-d plane whose normal vector is (Ax-Gx, Bx-Gx, Cx-Gx) and passes the point (0, 0, 0). The latter two represent other planes all passing (0, 0, 0). Solving the above simultaneous equations is equivalent to finding the intersection of those three planes. It is apparent that they intersect at (0, 0, 0), but it isn't the solution because of the restriction that a+b+c is not 0. To have intersection point other than (0, 0, 0), all of three planes must share the same intersection line (i.e. their normal vector is on a same plane.) All solutions lie on this common intersection line.

So, we only have to calculate the intersection line between the first two (the other one also shares the same line.) Now, let the direction vector of the intersection line (Va, Vb, Vc). This is perpendicular to the normal vector of two planes. So, just calculate the cross production:

Va = (Bx-Gx) * (Cy-Gy) - (Cx-Gx) * (By-Gy)

Vb = (Cx-Gx) * (Ay-Gy) - (Ax-Gx) * (Cy-Gy)

Vc = (Ax-Gx) * (By-Gy) - (Bx-Gx) * (Ay-Gy)

Choose an arbitray number t (that is not 0), then you can derive a, b and c as:

a = t * Va

b = t * Vb

c = t * Vc

Thx torigara, It Actually work

I don't know what to say, soory for the late respond,

I actually missed this reply yesterday. Thx again.

Ok can I ask one last thing, can you rewrite

Va,Vb and Vc with (x and z coords) and if possible too (zy)

thank you very much if you do that

**Edited by The Scorpion, 18 November 2010 - 01:29 PM.**

### #25

Posted 19 November 2010 - 02:12 PM

Well, why do you need it? It is the same answer. Anyway, it's a simple transposition: just replace all y with z.Ok can I ask one last thing, can you rewrite

Va,Vb and Vc with (x and z coords) and if possible too (zy)

### #26

Posted 20 November 2010 - 02:34 AM

I see, you are strictly working with three points and three coefficients.

If you have what you're saying:

eqn1 = Gx == a Ax / (a + b + c) + b Bx / (a + b + c) + c Cx / (a + b + c)

eqn2 = Gy == a Ay / (a + b + c) + b By / (a + b + c) + c Cy / (a + b + c)

eqn3 = Gz == a Az / (a + b + c) + b By / (a + b + c) + c Cz / (a + b + c)

Then your goal hopefully is to find a, b, c, given that you have Gx, Gy, Gz, etc.

Unfortunately, Mathematica does not yield a solution to this.

Using these equations exactly yields a solution for a and b in terms of c in Mathematica. This makes sense because it characterizes the infinity of solutions (since there's one degree of freedom).

### #27

Posted 20 November 2010 - 12:35 PM

Well, why do you need it? It is the same answer. Anyway, it's a simple transposition: just replace all y with z.

Well suppose that a tiangle that its X or Y coords are all the same, the Equation will always be 0. See! Thx for the reply, it helped too.

### #28

Posted 04 December 2010 - 06:05 AM

Take a triangular sheet and put on it, at point A, a 1 kg weight, at point B, a 2kg weight, and at point C a 3kg weight. The barycenter of the system ponderates points is the centre of gravity of the sheet, that means the point where the sheet is balanced. Call it G. You guess that G will be closer to C than to A. G verifies the vector equality : propriete barycenter

In general, the barycenter G of ponderates points verifies :

propriete fondamentale du barycenter

How to build a barycenter :

To draw it, decompose 2 of the 3 vectors according to the vectors you can already build. Long but simple :

calculation construction barycenter

So G is here :

vecteurs triangle

### #29

Posted 04 December 2010 - 11:59 AM

triangle

Take a triangular sheet and put on it, at point A, a 1 kg weight, at point B, a 2kg weight, and at point C a 3kg weight. The barycenter of the system ponderates points is the centre of gravity of the sheet, that means the point where the sheet is balanced. Call it G. You guess that G will be closer to C than to A. G verifies the vector equality : propriete barycenter

In general, the barycenter G of ponderates points verifies :

propriete fondamentale du barycenter

How to build a barycenter :

To draw it, decompose 2 of the 3 vectors according to the vectors you can already build. Long but simple :

calculation construction barycenter

So G is here :

vecteurs triangle

I'm not really following you here, Any way I solved the problem.

Thx fot the reply.

### #30

Posted 04 December 2010 - 12:13 PM

Finally somebody explained this clearly without all those damn fool equations.The barycenter of the system ponderates points is the centre of gravity of the sheet, that means the point where the sheet is balanced. Call it G. You guess that G will be closer to C than to A. G verifies the vector equality : propriete barycenter

In general, the barycenter G of ponderates points verifies

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users