ok well i actualy just figured this out... i dont know if this is the "way it works" lol but this "way works"

the distance is simple math... the view prespective is where the trig comes into play.

so here it is:

"dx is the Distance between dot1 and dot2 in the IR cameras view on the X axis"

dx = dotOne.x - dotTwo.x

"dy is the Distance between dot1 and dot2 on the Y axis"

dy = dotOne.y - dotTwo.y

now we have our dots on a 2D plain...

imagin looking down at them placed on a grid, as you move your head closer the dots spread further (or the Distance between them gets larger)

so if we find the square root of the distances...

distance = sqrt(dx*dx + dy*dy)

it essentialy gives you a Z axis, or a corrisponding number that can be placed there

hope that helps explain it for you,