[ back to toc ]

x,y coordinates

Date: 2002/06/14 11:36

hi !

X1-X2 =Y1-Y2
i don't have a saqure but no i only have twolines like this

i have a starting point
x1,y1 = 10,10
and ending point
x2,y2 = 15,15

x1-x2 =y1-y2
10-15 = 10-15

i have two lines not four i will get ths shape not a saqure ?

ok thsi si wat my prog do

i have point all over the screen on x y coordinated the distace between
one x,y point is 5 coloums x,y

. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .
. . . . . . . . .

now the user can move throgh these point with the help of cursor keys up
,down,right and left,

now if the user wants to selctt any point , user just press enter now that
x,y point is selected lets say 10,10
now from ths point forward user can only move one point to right ,lleft
,up and down and select any of thses four points
now the user agin press the enter key and slects the up point at location
x,y = 10,5

now a line is drawn from point 10,10 to 10,5 as soon as the line is drawn
loops start again user can move throgh any point he wants and select the
first point again at any x,y coornites and as soon as he selects that
point he can move the courser to only one point ,up,down,right and left
and as soon he select any point from these four points the line is dranm
between thses points and so on it continues

now wat i wnat was how will i know if a saqure is formed anywhere between
four points ??????

To check if there is a square you have to check each four points that may
form a square on the table. This is simple if you consider only horizontal
squares, but is more difficult if you consider tilted squares as well.

You can decrease computation intensity if you check only when a point is
selected. You can in that case check only the squares that have a corner
at that point.


[ back to toc ]