Jump to content


Photo

Barycenter of 3 points


  • Please log in to reply
29 replies to this topic

#1 The Scorpion

The Scorpion

    GMC Member

  • GMC Member
  • 416 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

  • Reviewer
  • 5842 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
  • 1319 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
  • 305 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
  • 416 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

  • Reviewer
  • 5842 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
  • 416 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

  • Retired Staff
  • 9314 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
  • 416 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

  • Retired Staff
  • 7343 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

  • Reviewer
  • 5842 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
  • 416 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
  • 4196 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
  • 416 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
  • 4196 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
  • 416 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

  • Reviewer
  • 5842 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
  • 6483 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
  • 416 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
  • 4196 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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users