(setq mylist (23.337 6.63198) (22.9351 6.23005) (22.9351 8.02967) (16.5646 12.593) (14.5698 8.22248) (9.64711 7.83685) (6.42968 11.661) (6.42968 5.65161))
this code fail >>>>
(mapcar (function (lambda (coord)
(if (member '(23.337 6.63198) coord)
(setq num (1+ num))
)))
mylist
)
and this one also >>>>
(mapcar (function (lambda (coord)
(if (vl-position '(23.337 6.63198) coord)
(setq num (1+ num))
)))
mylist
)
(defun gc:memberFuzz (expr lst fuzz)
(while (and lst (not (equal (car lst) expr fuzz)))
(setq lst (cdr lst))
)
lst
)
(and (equal 23.337 (car coord) 0.0001)(equal 6.63198 (cadr coord) 0.0001))
peach
Thank you all guys . :-)
What is the best value for fuzz ?
Thank you all guys . :-)
What is the best value for fuzz ?
Bill's beard.
sorry, you probably had to be there :)
_$ (setq mylist '((23.337 6.63198) (22.9351 6.23005) (22.9351 8.02967) (16.5646 12.593) (14.5698 8.22248) (9.64711 7.83685) (6.42968 11.661) (6.42968 5.65161)))
_$ (remove_point '(16.5646 12.593) mylist)
((23.337 6.63198) (22.9351 6.23005) (22.9351 8.02967) (14.5698 8.22248) (9.64711 7.83685) (6.42968 11.661) (6.42968 5.65161))
A precision of 1e-4 would be enough.
(equal (distance p1 p2) 0 fuzz)
i think it's more correct
(< (distance p1 p2) fuzz)
There may also be some other concerns - doesn't (distance...) use some current dimension style variables for precision?It's the first I've heard of that, aren't you thinking of the rtos function? You have a point about the squaring though, I think the distance function uses the Pythagorean theorem. So it squares all values and then square roots them, thus it might produce larger floating point errors than expected.
Hi,To get the min Fuzz even smaller, you might want to change the 14 decimal points to 52 binary points. Seeing as the double precision uses 53 bits for the significand, and 11 for the exponent. But that's just splitting hairs ... literally :lmao: .
The minFuzz routine returns the minimum fuzz usable with equal according to the point position within the significant digits of a floating point number (http://en.wikipedia.org/wiki/Floating_point).Code - Lisp: [Select]
(defun minFuzz (n) (if (zerop n) 1e-14 (expt 10. (- (fix (/ (log (abs n)) (log 10))) 14)) ) )