Page 1 of 2

3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 13:25
by Pooby
Does anyone know, in plain english rather than maths notation, (of which there is quite a bit around), how to calculate the position of a 3rd point of a triangle given the other 2 positions and all the lengths of all the sides?
Lets assume its 2d as I am aware that in 3d that point could be anywhere around a circle.

thanks

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 14:18
by Daniel Brassard
See Illustration

Given the two points A and B and the two lengths a and b, to find the point C, trace a circle at point A of radius a (red on the illustration) and at point B of radius b (green on the illustration). The intersection of the two circles is the location of point C. With an angle at A or B, you can then determine which point C it is.

For 3D, the circles become spheres and there intersections a circle (like you correctly said.)

Hope that help. Cheers!

Dan

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 14:23
by NNois
actually there is 4 congruent triangles not 2...

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 14:36
by Daniel Brassard
Hi NNois,

True if you do not know which length is with which point, Then you repeat the process at point A with the b length (green) and at point B with the a length (red) to get the two other points C.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 14:59
by Mathaeus
Pooby wrote:Does anyone know, in plain english rather than maths notation,
thanks
in plain Klingon, I think you're searching for 2-bone IK solver ( in case you're able to determine the longest distance of three, as root to effector distance). There are some in appropriate ICE compounds. Core, which calculates these intersections, is called Cosine Law, or Kosinus Satz. You get the angle between root-effector direction, and first bone. By rotating the first bone, you get third position.
Axis you'll be using, defines the 2d plane in 3d space - and this axis is equivalent of SI Chain preferred axis.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 16:54
by Pooby
Thanks for the replies. The circle method is interesting and thanks for posting it, but It doesnt help directly in ICE as I dont think there is a circle intersection node.

I am indeed trying to make a 2d IK solver. I dont quite understand how you get the position of the 3rd point from the angle between the 'unknown' bones.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 16:54
by Bullit
Wouldn't this point be the intersection of rotation of 2 vectors each from the 2 known points?

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 17:24
by Daniel Brassard
See it this way .... vector addition

vector A to B (length and direction) add vector B to C (length and direction) will give you vector A to C (length and direction).

Dan

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 17:57
by rray
Anto's comment reminded me of the hidden ICE Kine workgroup (in the programs/softimage/applcation folder), there are some nice rigging compounds in there including IK solvers.
I wonder why this isn't connected by default, is this because it's still not considered production ready?

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 18:06
by Pooby
Daniel Brassard wrote:See it this way .... vector addition

vector A to B (length and direction) add vector B to C (length and direction) will give you vector A to C (length and direction).

Dan
I cant get my head around it I'm afraid, but thanks for trying to help.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 18:21
by EricTRocks
Look at the Law of Cosines for this. Basically for a simple 2 bone IK solver, you know the lengths of the bones already and the length from Root to Effector. So you know all sides of the triangle. Just need to get the angles.

http://en.wikipedia.org/wiki/Law_of_cosines Look at Fig 3 and also the section that says "the angles of a triangle if one knows the three sides".

You only need to find the angle for the first bone. Then project a transform to the tip of the first bone (since you know the size of the vector to rotate by that first angle). This will be the position of bone02. Then just get the direction from the bone02 position to the effector and you can use the other ICE nodes to get that rotation for the 2nd bone's rotation. Done.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 18:47
by Mathaeus
Pooby wrote:Thanks for the replies. The circle method is interesting and thanks for posting it, but It doesnt help directly in ICE as I dont think there is a circle intersection node.

I am indeed trying to make a 2d IK solver. I dont quite understand how you get the position of the 3rd point from the angle between the 'unknown' bones.
First I found this solver in one old collection of samples, by Helge Mathee. Later , I've added soft IK to solver, too. If you're interested, especially in Soft IK part... no big deal to post all this.
Another one appeared in Phill Pack. Finally, as RRay said, in ICE kine compounds. Afaik Helge's version was more stable, the one from Phil Pack had tendency to produce NaNs.

By the way, inputs are 3 lengths, result is angle between first bone and root-effector direction.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 15 Oct 2013, 21:47
by EricTRocks
Mathaeus wrote:no big deal to post all this.
Thanks for this Mathaeus, I would only ask to wait until all options are exhausted in explaining how to build this setup as the ICE & Math section is exactly for explaining or figuring out these types of problems and have a library of solutions people can reference. This was one benefit to XSIBase when it was around there were tons of threads of solutions and walk throughs that helped people learn. I'm hoping to do the same here.

With that said, maybe I misunderstood what you meant by posting, if you meant you would post on how to set this up. :)

Re: 3rd point on a triangle given lengths and 2 points

Posted: 16 Oct 2013, 00:24
by Bullit
emTools also has an intersection of 2 lines compound.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 16 Oct 2013, 00:38
by Mathaeus
EricTRocks wrote:
Mathaeus wrote:no big deal to post all this.
With that said, maybe I misunderstood what you meant by posting, if you meant you would post on how to set this up. :)
Well I meant just posting the ICE compound, without too much explanation - but for now, thing is a part of something else, needs cleanup. That's why I'm asked before posting. Anyway I hope I'll put it into resource dump.

Long explanations, how to set this up and so on - to be honest, I really do not see the reason for explaining again, something already explained on so many places. No hope from my side.

Re: 3rd point on a triangle given lengths and 2 points

Posted: 16 Oct 2013, 01:50
by EricTRocks
If there are already explanations else where that are easily consumed, please post links! :)