Jump to content


Photo

Barycenter of 3 points


  • This topic is locked This topic is locked
29 replies to this topic

#1 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 14 November 2010 - 10:36 AM

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.

Well you might think, what is this for? :wacko:

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

immm, I know these function :

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

Gy= .... Etc ...
  • 0

#2 chance

chance

    GMC Member

  • Global Moderators
  • 7621 posts
  • Version:GM:Studio

Posted 14 November 2010 - 12:17 PM

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.

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.

Maybe you could explain more carefully what you want.
  • 0

#3 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 14 November 2010 - 01:16 PM

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.

If you've got all the coordinates, where does the 'barycenter' come into it?
  • 0

#4 Drara

Drara

    GMC Member

  • GMC Member
  • 325 posts

Posted 14 November 2010 - 02:48 PM

I'm not sure, but I think he means with (A,a), (x,y)
So he knows only the x values of the triangle but not the y values.
  • 0

#5 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 14 November 2010 - 03:23 PM

Ok it seems I was not that clear.

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.

  • 0

#6 chance

chance

    GMC Member

  • Global Moderators
  • 7621 posts
  • Version:GM:Studio

Posted 14 November 2010 - 07:01 PM

Oh, that's MUCH more clear! :P

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.
  • 0

#7 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 14 November 2010 - 08:17 PM

Ok leave the mouse vector. that's not the problem.

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 ?
  • 0

#8 IceMetalPunk

IceMetalPunk

    InfiniteIMPerfection

  • GMC Elder
  • 9331 posts
  • Version:Unknown

Posted 14 November 2010 - 08:25 PM

I have to admit that I, too, am a little confused here. You say you have all the points' coordinates, correct? If so, and if {a,b,c} are the y-values of those coordinates, then don't you already have those values? So why do you need to back-track and recalculate them from the barycenter?

-IMP ;) :)
  • 0

#9 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 14 November 2010 - 08:43 PM

Ok, a,b,c are not the Y coords.

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????? :wacko:
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. :skull:
  • 0

#10 Yourself

Yourself

    The Ultimate Pronoun

  • GMC Elder
  • 7352 posts
  • Version:Unknown

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.
  • 0

#11 chance

chance

    GMC Member

  • Global Moderators
  • 7621 posts
  • Version:GM:Studio

Posted 14 November 2010 - 08:55 PM

It sounds like you're trying to identify the coordinates of a particular "triangular facet" of a 3D model. When you make a UV map, it's like unfolding the 3D model onto a plane. Then each triangular facet can be defined by three of (x,y) coordinates.

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

#12 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 14 November 2010 - 09:11 PM

Read this :

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.

  • 0

#13 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4345 posts
  • Version:GM:Studio

Posted 14 November 2010 - 11:10 PM

Nonsense. One can talk about the center of mass without introducing such a nonstandard notation.

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.
  • 0

#14 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 16 November 2010 - 06:21 PM

No I don't think so.

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.

  • 0

#15 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4345 posts
  • Version:GM:Studio

Posted 16 November 2010 - 06:54 PM

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.
  • 0

#16 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

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?
  • 0

#17 chance

chance

    GMC Member

  • Global Moderators
  • 7621 posts
  • Version:GM:Studio

Posted 17 November 2010 - 01:20 PM

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.

Go ahead and try that. I think you'll find those quadratic terms make it difficult. :D

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

#18 torigara

torigara

    GMC Member

  • GMC Member
  • 6507 posts

Posted 17 November 2010 - 04:31 PM

Unfortunately, Mathematica does not yield a solution to this.

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.

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.

  • 0

#19 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 17 November 2010 - 05:50 PM


Unfortunately, Mathematica does not yield a solution to this.

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.

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.

  • 0

#20 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4345 posts
  • Version:GM:Studio

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.
  • 0

#21 torigara

torigara

    GMC Member

  • GMC Member
  • 6507 posts

Posted 18 November 2010 - 02:12 AM

Usually Mathematica will give you every solution, even ones you don't want.

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

The problem here is that, when a set of numbers (a0, b0, c0) is a solution, then (n*a0, n*b0, n*c0) is also a solution for all n (except 0.) Actually, G is determined by the ratio a:b:c.

If we suppose that a=1 then this will became 2 equations system.
Is this correct?

Sorta correct; that's another way to add a constraint (by putting 1:b1:c1=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           20cm
However, 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.

  • 1

#22 xshortguy

xshortguy

    GMC Member

  • Global Moderators
  • 4345 posts
  • Version:GM:Studio

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.
  • 0

#23 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

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 ^_^
  • 0

#24 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

Posted 18 November 2010 - 11:59 AM


Usually Mathematica will give you every solution, even ones you don't want.

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

The problem here is that, when a set of numbers (a0, b0, c0) is a solution, then (n*a0, n*b0, n*c0) is also a solution for all n (except 0.) Actually, G is determined by the ratio a:b:c.

If we suppose that a=1 then this will became 2 equations system.
Is this correct?

Sorta correct; that's another way to add a constraint (by putting 1:b1:c1=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           20cm
However, 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 ::lmao::
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 :lol:
Va,Vb and Vc with (x and z coords) and if possible too (zy)

thank you very much if you do that :D

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

  • 0

#25 torigara

torigara

    GMC Member

  • GMC Member
  • 6507 posts

Posted 19 November 2010 - 02:12 PM

Ok can I ask one last thing, can you rewrite :lol:
Va,Vb and Vc with (x and z coords) and if possible too (zy)

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

#26 Yourself

Yourself

    The Ultimate Pronoun

  • GMC Elder
  • 7352 posts
  • Version:Unknown

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).
  • 0

#27 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

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.
  • 0

#28 petermark1234

petermark1234

    GMC Member

  • New Member
  • 5 posts

Posted 04 December 2010 - 06:05 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
  • 0

#29 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 422 posts
  • Version:GM8

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. :D
Thx fot the reply. ;)
  • 0

#30 chance

chance

    GMC Member

  • Global Moderators
  • 7621 posts
  • Version:GM:Studio

Posted 04 December 2010 - 12:13 PM

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

Finally somebody explained this clearly without all those damn fool equations.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users