Hi Ru. The 'abs' function already exists in Jess. See, for example, the Jess 7.0 documentation:
http://herzberg.ca.sandia.gov/jess/docs/70/functions.html# "10.12. (abs <numeric-expression>) Arguments: One numeric expression Returns: Number Description: Returns the absolute value of its only argument." Regards, Win > Hello, > > [EMAIL PROTECTED] wrote: > > >> I think portalguy wrote: > >> > >> Here's your rule, cleaned up: > >> > >> (defrule check_Collision > >> "if the distance between any of the coordinates between two objects is > > less > > >> than 5 for example" > >> ?o1 <- (obj (xPos ?xpos1)(yPos ?ypos1)(zPos ?zpos1)) > >> ?o2 <- (obj (xPos ?xpos2)(yPos ?ypos2)(zPos ?zpos2)) > >> (test (and > >> (< (- ?xpos1 ?xpos2) 5) > >> (< (- ?ypos1 ?ypos2) 5) > >> (< (- ?zpos1 ?zpos2) 5) > >> (neq ?o1 ?o2))) > >> => > >> (printout t "check_collision has been fired")) > >> > > > I think abs function should be added: > > (< (abs(- ?xpos1 ?xpos2)) 5) > (< (abs(- ?ypos1 ?ypos2)) 5) > (< (abs(- ?zpos1 ?zpos2)) 5) > > Sincerely, > Ru > > R. P. Sorokin [EMAIL PROTECTED] > NIL OOGIS http://niggis.iias.spb.su > SPIIRAS http://www.spiiras.nw.ru/indexe.html > St.Petersburg, Russia > > > > > > > > > > > > -------------------------------------------------------------------- > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > (use your own address!) List problems? Notify [EMAIL PROTECTED] > -------------------------------------------------------------------- > -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
