SRL Archive - Help and Support

Need a little help..


weibs

2006-11-08 19:32:50

Ok, I need to find a way to find the coordinates of the red point:


The only information I have is this:

The coordinates of the two black dots, and the depth.

The depth is the distance from the middle of the black line to the red point.

Also, the distances between each black dot and the red dot ( The grey lines ) have to be the same.

I've gotten close, but not there yet. If anyone could help me, I'd appreciate it.

YoHoJo

2006-11-08 19:45:22

can you restate what you want?
and what is this for?

Here

program New;
var x,y,reddot:integer;
begin
reddot := DTMFromString('78DA63CC6360606062644006FFA1344C94D11' +
'F485C63C00AE06AF62069C4A106000F2D0457');
if finddtm(reddot,x,y,1,1,1000,700) then
Movemouse(x,y)
end.

drag cross hair to your internet browser.
pres play

Boreas

2006-11-08 19:46:59

I think I got it. Hold on I'm trying to figure out the best way to type it.

The line from the red dot to the middle of the black line is perpendicular to the black line, creating 2 smaller right angle trianges. Each triangle has a grey line for one side, half the black line for another side, and the depth line for the third side. The angles are all the same since the grey lines are the same.

So you find the distance between the 2 black dots to get the black line, and divide by 2 to get half the black line side. You know the depth side.

Lets say J is the angle angle between the grey line and the black line.

Tan(J)=depth/halfblack

J=arctan(depth/halfblack)

Now to get the grey line, Sin(J)=halfblack/grey
grey=halfblack/sin(j)

Now we know the length of grey, we need to know its angle to the vertical and horizontal so we can break it up into its x and y components to get the relative coordinates to the black dots. Draw an imaginary line thru the top left black dot horizontally, and a vertical line thru the other black dot. These 2 lines with the black line create a triangle, where the horizontal line is the difference in x coords of the dots, and the vertical line is the difference in ys. Now figure out the angle between black line and the horizontal line with
cos(L)=(x2-x1)/blackline
L=arccos((x2-x1)/blackline)

Now 90-(J+L)= K where K is the angle between the left grey and the vertical.

Now make another triangle by drawing a vertical line thru the left black dot and a horizontal line thru the red. This triangle has K as the angle at the top, and grey line as the hypoteneuse. The length of the other 2 lines are the differences in the x and y of the red dot and the left black dot. To get the difference in X, use
sin(K)=XDiff/grey

XDiff=sin(K)*grey

and Y is

YDiff=cos(K)*grey

Take the XDiff and YDiff, combine with the coords of the left black dot to get the coords of red dot.

I'll combine all those formulas into a big one in a sec.

Here it is

The only thing you have to do is blackline, which is the distance between the black dots, I don't know what coordinate system you are using so I'll leave it to you.

XDiff=sin(90-(arctan(depth/(blackline/2))+arccos((x2-x1)/blackline)))*(blackline/2)/sin(arctan(depth/(blackline/2)))
YDiff=cos(90-(arctan(depth/(blackline/2))+arccos((x2-x1)/blackline)))*(blackline/2)/sin(arctan(depth/(blackline/2)))

If I screwed combining them into a big formula then just do it by the steps.