3rd point on a triangle given lengths and 2 points

Topics concerning ICE & Math
Pooby
Posts: 496
Joined: 27 Aug 2010, 22:25

3rd point on a triangle given lengths and 2 points

Post by Pooby » 15 Oct 2013, 13:25

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

User avatar
Daniel Brassard
Posts: 840
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario

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

Post by Daniel Brassard » 15 Oct 2013, 14:18

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
You do not have the required permissions to view the files attached to this post.
$ifndef "Softimage"
set "Softimage" "true"
$endif

NNois
Posts: 726
Joined: 09 Jun 2009, 20:33

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

Post by NNois » 15 Oct 2013, 14:23

actually there is 4 congruent triangles not 2...

User avatar
Daniel Brassard
Posts: 840
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario

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

Post by Daniel Brassard » 15 Oct 2013, 14:36

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.
You do not have the required permissions to view the files attached to this post.
Last edited by Daniel Brassard on 15 Oct 2013, 15:37, edited 1 time in total.
$ifndef "Softimage"
set "Softimage" "true"
$endif

User avatar
Mathaeus
Posts: 1739
Joined: 08 Jun 2009, 21:11
Location: Zagreb, Croatia

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

Post by Mathaeus » 15 Oct 2013, 14:59

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.

Pooby
Posts: 496
Joined: 27 Aug 2010, 22:25

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

Post by Pooby » 15 Oct 2013, 16:54

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.

Bullit
Moderator
Posts: 2453
Joined: 24 May 2012, 09:44

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

Post by Bullit » 15 Oct 2013, 16:54

Wouldn't this point be the intersection of rotation of 2 vectors each from the 2 known points?

User avatar
Daniel Brassard
Posts: 840
Joined: 18 Mar 2010, 23:38
Location: St. Thomas, Ontario

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

Post by Daniel Brassard » 15 Oct 2013, 17:24

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
$ifndef "Softimage"
set "Softimage" "true"
$endif

User avatar
rray
Moderator
Posts: 1611
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

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

Post by rray » 15 Oct 2013, 17:57

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?
softimage resources section updated Feb 7 2019

Pooby
Posts: 496
Joined: 27 Aug 2010, 22:25

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

Post by Pooby » 15 Oct 2013, 18:06

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.

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 01:41

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

Post by EricTRocks » 15 Oct 2013, 18:21

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.
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

User avatar
Mathaeus
Posts: 1739
Joined: 08 Jun 2009, 21:11
Location: Zagreb, Croatia

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

Post by Mathaeus » 15 Oct 2013, 18:47

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.

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 01:41

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

Post by EricTRocks » 15 Oct 2013, 21:47

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. :)
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken

Bullit
Moderator
Posts: 2453
Joined: 24 May 2012, 09:44

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

Post by Bullit » 16 Oct 2013, 00:24

emTools also has an intersection of 2 lines compound.

User avatar
Mathaeus
Posts: 1739
Joined: 08 Jun 2009, 21:11
Location: Zagreb, Croatia

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

Post by Mathaeus » 16 Oct 2013, 00:38

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.

EricTRocks
Moderator
Posts: 754
Joined: 25 Nov 2009, 01:41

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

Post by EricTRocks » 16 Oct 2013, 01:50

If there are already explanations else where that are easily consumed, please post links! :)
Eric Thivierge
Lead Kraken Developer, Fabric Engine
http://fabric-engine.github.io/Kraken