Teen Programmers Unite  
 

 

Return to forum top

math problem

Posted by RedX [send private reply] at February 22, 2002, 05:14:40 PM

Big problem. Seem to miss the solution.
Here it is:
You have a rectangle with given size. Inside you have a point. You know the distants from that point to each of the four corners of the rectangle. How do I get the x,y coordinates of that point?
I've spend whole evening thinking on this one. It's probably something simple, but I'm stuck at it.

For the record: this isn't homework.

RedX

Posted by taubz [send private reply] at February 22, 2002, 07:00:13 PM

For each corner, you know the point lies on a circle of some particular radius. Take two of the corners, and you know that the point is on the intersection of the corresponding circles. There can be zero, one, or two intersections. (Finding the intersections is another problem, I guess.) If there are two intersections, use a third corner to determine which one is the point.

- taubz

Posted by RedX [send private reply] at February 26, 2002, 03:53:20 PM

I found it yesterday. It's so simple actually. Our good friend Pytagoras has the answer: A = B + C
The the upper and lower left diagonal lines together with the left line of the rectangle form a triangle. So do the lower left and the lower right diagonal lines with the bottom line. This gives the X and Y coordinates.
It also leaves one diagonal unused. So it can be droped.

Thanks
RedX

Posted by yogirs [send private reply] at March 04, 2002, 12:16:26 AM

its simple

just add the distance x with left corner co-ordinate x and distance y with the left corner co-ordinate y you will have the actual co-ordinates of the point

Posted by RedX [send private reply] at March 04, 2002, 01:53:39 PM

That would require to know the angles (which I can't know). I think the A=B+C would be the best guess here.
It's actually a real world thing. It's part of a navigation system of a mobile robot. The idea is to get a ruff idea of it's position by measuring the distance between the robot and the four corners of the room (How this is measured is a whole explenation on its own). Then use its position together with a map of the room to map out a route to a particular location (e.g. reloading station).

RedX

Posted by taubz [send private reply] at March 04, 2002, 08:03:07 PM

Quite possibly the basis for GPS positioning as well.

Posted by RedX [send private reply] at March 05, 2002, 12:02:39 PM

Only on a lot smaller scale. I'm going to use ultrasone instead of radio. The reason for this, is that radiowaves travel at c (3x10E8 is a bit high). This results in times in ns, which is rather difficult to measure accuratly. Ultrasone on the other hand is a lot slower (about 320m/s). Which gives times in the s and ms range. These are a lot easier to measure.

RedX

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.