----- Original Message ----- 
From: "Mr. Zhang Yangtian" <[EMAIL PROTECTED]>
To: "Protel    " <[EMAIL PROTECTED]>
Sent: Thursday, February 12, 2004 4:47 AM
Subject: [PEDA] What's wrong with my query language program


> I had write one line of query language in ProtelDXP as the following:
>
> IsTrack and ((ABS(X1-X2)-ABS(Y1-Y2))=0)
>
>  Its target is to find out all the tracks with their lean at 45-degree or
135-degree. After the execution of the program, some tracks are found while
some tracks satisfied with the constrain are leaked. I guess that the reason
is the precision of floating point number calculation. So I change it to the
following format:
>
> IsTrack and ((ABS(X1-X2)-ABS(Y1-Y2))  between -1 and 1).
>
> But this time, strange things happen: the queried tracks are nearlly all
the tracks with 0 degree, not 45-degree or 135-degree. Who can tell me why.
Is it a bug of DXP?
>
> Thank you very much!

Why are you using subtraction??
surely it then matters what the absolute lengths of the track are...
Perhaps the following would work:
IsTrack and ((ABS(Y2 - Y1) / ABS (X2 - X1)) = 1)
(you could also use a trig function to make it more understandable
ie if available use (ARCTAN((ABS(Y2-Y1) / ABS(X2-X1)) = 45), the use of the
absolute values for both X and Y directions constrains the angle to the
upper right quadrant, ie angles between 0 and 90degrees.

Bevan


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* To post a message: mailto:[EMAIL PROTECTED]
*
* To leave this list visit:
* http://www.techservinc.com/protelusers/leave.html
*
* Contact the list manager:
* mailto:[EMAIL PROTECTED]
*
* Forum Guidelines Rules:
* http://www.techservinc.com/protelusers/forumrules.html
*
* Browse or Search previous postings:
* http://www.mail-archive.com/[EMAIL PROTECTED]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Reply via email to