you need to you use the abs value of each coordinate Bevan Weiss wrote:
> ----- 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 -- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >John M. Cardone Electro-Mechanical Dsgn. Engr. Grp. >M/S 125-14R Mechanical Engineering Section, 352 >4800 Oak Grove Dr. NASA / Jet Propulsion Laboratory >Pasadena, Ca 91109 MailTo:[EMAIL PROTECTED] >Tel: 818.354.5407 Fax: 818.393.4399 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *