13 Jun, 2009, Runter wrote in the 1st comment:
Votes: 0
Excuse the format below. I'd like to know how to solve this. I haven't had a geometry class in quite a few years. Any help would be appreciated. :)
(0, 14)
Q______________P (14, 14)
| /
| /
| /
| /
| /
| /
| /
| /
| /
| Z (??, ??)
| /
| /
| / 5ft
|/
X (0,0)


Q = (0,14)
P = (14,14)
X = (0,0)
Z = (??, ??)


Given line segment QP is 14 feet and line segment XZ is 5 feet. What is the coordinate of Z? Or rather, what's the Best ™ steps to get the answer?
13 Jun, 2009, Ssolvarain wrote in the 2nd comment:
Votes: 0
Graph paper and a pencil :tongue:


Since the the angle is 90 degrees, and equal distance on two lines, then the angle is 45 degrees and the location is 5,5.
13 Jun, 2009, Runter wrote in the 3rd comment:
Votes: 0
Ssolvarain said:
Graph paper and a pencil :tongue:


Meh.
13 Jun, 2009, Ssolvarain wrote in the 4th comment:
Votes: 0
If it were anything but a 45 degree angle, you'd be looking at some algebra.
13 Jun, 2009, Runter wrote in the 5th comment:
Votes: 0
Ssolvarain said:
If it were anything but a 45 degree angle, you'd be looking at some algebra.


Yeah, and I want it to work for all cases.
13 Jun, 2009, Ssolvarain wrote in the 6th comment:
Votes: 0
13 Jun, 2009, Runter wrote in the 7th comment:
Votes: 0
Here's what I am doing currently:

Finding length from X to P.
Finding what percentage XZ is of ZP. (about 25%)
Taking 14/14 - 0/0 to get 14/14
Using our percentage we found on 14/14 and getting 3.5/3.5.

Seems a little convoluted but worked? Any better answers?
13 Jun, 2009, David Haley wrote in the 8th comment:
Votes: 0
Quote
Since the the angle is 90 degrees, and equal distance on two lines, then the angle is 45 degrees and the location is 5,5.

This is unfortunately rather incorrect. If the diagonal distance is 5, and the angle is 45, then applying Pythagoras's Theorem:

a^2 + b^2 = c^2
a^2 + b^2 = 5^2

The angle is 45 degrees, so a = b, hence
2a^2 = 25
a^2 = 12.5
a = sqrt(12.5)
a ~= 3.536

So the point is at (3.536, 3.536).

You can verify this by calculating the distance from the origin, which uses a suspiciously similar formula:

d = sqrt(x^2 + y^2)

I'll leave it as an "exercise to the reader" (tee hee) to verify that sqrt(3.536^2 * 2) = 5.


The point 5,5 is in fact ~7.07 feet away from the origin.

———–

Anyhow, the easiest way to solve this in general is to just use vectors. You can compute the distance XP, and you already know that XZ is 5 feet. So, 5/XP gives you the proportion of the vector XP that goes to Z.

So to solve this, using underlines to represent vectors,

Z = P * 5 / norm(P)

You now have the x/y coordinates of Z. Namely,

Z_x = P_x * 5 / norm(P)
Z_y = P_y * 5 / norm(P)
13 Jun, 2009, Runter wrote in the 9th comment:
Votes: 0
DH said:
Anyhow, the easiest way to solve this in general is to just use vectors. You can compute the distance XP, and you already know that XZ is 5 feet. So, 5/XP gives you the proportion of the vector XP that goes to Z.

So to solve this, using underlines to represent vectors,

Z = P * 5 / norm(P)

You now have the x/y coordinates of Z. Namely,

Z_x = P_x * 5 / norm(P)
Z_y = P_y * 5 / norm(P)


Thanks, David.

I think that's the less convoluted explanation of the way I did it.
14 Jun, 2009, Tyche wrote in the 10th comment:
Votes: 0
(0, 14)
Q______________P (14, 14)
| /
| /
| /
| /
| /
| /
| /
| /
| /
| Z (??, ??)
| /
| /
| / 5ft
|/
X (0,0)


The angle of XP, theta, would be the arctan(len QP / len XP)
So the coordinates of Z would be sin(theta) * len XZ , cos(theta) * len XZ

In Ruby…
irb(main):002:0> Math::sin(Math::atan(14/14)) * 5
=> 3.53553390593274
irb(main):001:0> Math::cos(Math::atan(14/14)) * 5
=> 3.53553390593274

Anyone remember the great Indian chief, Sohcahtoa? ;-)
14 Jun, 2009, Ssolvarain wrote in the 11th comment:
Votes: 0
Ahh, pardon me.

I didn't mean to dare step foot onto the forum where the elitist snobs reside.

My bad.
14 Jun, 2009, David Haley wrote in the 12th comment:
Votes: 0
Sorry Ssolvarain, I didn't realize that a correction of math would be considered elitist snobbism. Sorry about that.
14 Jun, 2009, Jamdog wrote in the 13th comment:
Votes: 0
Everyone seems to be missing the fact that Pythagoras' Theorem can be used to simply calculate the co-ordinates.

#
# (0, 14)
# Q______________P (14, 14)
# | /
# | /
# | /
# | /
# | /
# | /
# | /
# | /
# | /
# Y—-Z (??, ??)
# | /
# | /
# | / 5ft
# |/
# X (0,0)

We know that XYZ is a 90 degree triangle, and as Pythagoras states: For any right angled triangle, the square of the Hypotenuse is equal to the sum of the squares of the other two sides.

We know the side XZ, which is the hypotenuse, so therefore
XY = YZ = ((XZ^2)/2)^(1/2)
XY = YZ = (25/2)^(1/2)
XY = YZ =
XY = YZ = 3.5355
14 Jun, 2009, Confuto wrote in the 14th comment:
Votes: 0
Jamdog said:
Everyone seems to be missing the fact that Pythagoras' Theorem can be used to simply calculate the co-ordinates.

Runter wants it to work in all cases, not just in cases where he has right angles.
14 Jun, 2009, Runter wrote in the 15th comment:
Votes: 0
Tyche said:
(0, 14)
Q______________P (14, 14)
| /
| /
| /
| /
| /
| /
| /
| /
| /
| Z (??, ??)
| /
| /
| / 5ft
|/
X (0,0)


The angle of XP, theta, would be the arctan(len QP / len XP)
So the coordinates of Z would be sin(theta) * len XZ , cos(theta) * len XZ

In Ruby…
irb(main):002:0> Math::sin(Math::atan(14/14)) * 5
=> 3.53553390593274
irb(main):001:0> Math::cos(Math::atan(14/14)) * 5
=> 3.53553390593274

Anyone remember the great Indian chief, Sohcahtoa? ;-)


Thanks a lot! :)
14 Jun, 2009, flumpy wrote in the 16th comment:
Votes: 0
Confuto said:
Jamdog said:
Everyone seems to be missing the fact that Pythagoras' Theorem can be used to simply calculate the co-ordinates.

Runter wants it to work in all cases, not just in cases where he has right angles.


AFAICR, to make it work in all cases you have to devide the (non-right angled) triangle up into smaller right angled triangles.

How you would do that programatically or mathematically I have no idea, and it would probably involve a lot of matrices.

David, you have a big mathematical brain, can you do it?
14 Jun, 2009, Runter wrote in the 17th comment:
Votes: 0
flumpy said:
Confuto said:
Jamdog said:
Everyone seems to be missing the fact that Pythagoras' Theorem can be used to simply calculate the co-ordinates.

Runter wants it to work in all cases, not just in cases where he has right angles.


AFAICR, to make it work in all cases you have to devide the (non-right angled) triangle up into smaller right angled triangles.

How you would do that programatically or mathematically I have no idea, and it would probably involve a lot of matrices.

David, you have a big mathematical brain, can you do it?


Both David and Tyche posted code that works in all cases given a vector.
14 Jun, 2009, Runter wrote in the 18th comment:
Votes: 0
irb(main):001:0> a = [14.0, 8.0]
=> [14.0, 8.0]
irb(main):002:0> b = [1.0, 1.0]
=> [1.0, 1.0]
irb(main):003:0> speed = 5.0
=> 5.0
irb(main):004:0> c = (b[0] + (Math::sin(Math::atan(a[0]/a[1])) * speed)).round, (b[1] + (Math::sin(Math::atan(a[1]/a[0])) * speed)).round
=> [5, 3]


Looks good to me.


I got all that quite wrong.
14 Jun, 2009, Runter wrote in the 19th comment:
Votes: 0
Tyche said:
(0, 14)
Q______________P (14, 14)
| /
| /
| /
| /
| /
| /
| /
| /
| /
| Z (??, ??)
| /
| /
| / 5ft
|/
X (0,0)


The angle of XP, theta, would be the arctan(len QP / len XP)
So the coordinates of Z would be sin(theta) * len XZ , cos(theta) * len XZ

In Ruby…
irb(main):002:0> Math::sin(Math::atan(14/14)) * 5
=> 3.53553390593274
irb(main):001:0> Math::cos(Math::atan(14/14)) * 5
=> 3.53553390593274

Anyone remember the great Indian chief, Sohcahtoa? ;-)


Hrm. arctan(len QP / len XP) wouldn't be atan(14, 14)

Did you mean len XQ instead of XP?
14 Jun, 2009, Tyche wrote in the 20th comment:
Votes: 0
Quote
Hrm. arctan(len QP / len XP) wouldn't be atan(14, 14)

Did you mean len XQ instead of XP?


Yeah. I also meant the angle QXP instead, since XP isn't an angle. ;-)

You also have to express the coordinates in absolute differences, save the signs, and add or subtract the result from your origin.

Going from 3,3 to -10,-4
QP = 13 negative direction from origin
XQ = 7 negative direction from origin
0.0/34