Not sure exactly what it is you're referencing here. The absolute value of each coordinat (ie X1 and aso X2) would give the incorrect length for the segment. given X1 = 12 and X2 = -4 (by your reasoning this would give a horizontal length of -8, which is not the case) I have the formula correct, there may however be an easier way. Such as perhaps using the IsOblique method described by Mattias. I didn't even open DXP to check anything, I just know that the formual I presented is correct to determine if the angle is either 45degrees, 135degrees, 225degrees, or 315degrees.
It should be noted that using the IsOblique method will not just select the above angles, it will select any segment which has an angle that is not a multiple of 90degrees. ----- Original Message ----- From: "John M. Cardone" <[EMAIL PROTECTED]> To: "Protel EDA Forum" <[EMAIL PROTECTED]> Sent: Thursday, February 12, 2004 10:14 AM Subject: Re: [PEDA] What's wrong with my query language program > 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] * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
