The original poster mentions the line length in pixels. That is not the geometric length of the line. In pixels, the length of a line running from coordinates (x1,y1) to (x2,y2) is simply max (abs(x2 - x1), abs(y2 - y1)).
How long is this line?
0,0 .....100..... ...I_____.... .../..Y..\... ../~~~|~~~\.. <--- ./____X____\. .....200..... x,y
lets call the length of the ~ line A;
I is the y start of the 100px line
Ok, so if you know how long eatch of those two lines are.
If you know X and Y.
X = length from the 200pxl line to the ~ line on the X-axis.
Y = length from the 100pxl line to the ~ line on the X-axis.
ok, since you know those two, you know the distance betwine thw two known lines.
Lets call the distance Z;
Z = |X-Y| or abs(X-Y)
now you can splne it together.
So if Z == X, then A = 200
elseif Z == Y, then A = 100
else A = 100+(Y-I/X-Y)*100
ok, i dont know what i just said
[edited by - aftermath on April 24, 2002 6:42:18 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement