Jump to content

Sorting Lists within Lists of points, with fuzz


Quest for Peace

Recommended Posts

I have a list that essentially consists of lists of points. I need to compare the lists of points (with fuzz that can be 2’, but fractions of an inch are all they vary by) and record all the ones that are equal in length and point locations:

((1 (1 2 0) (3 4 0) (5 6 0)) (2 (3 4 0) (1 2 0) (5 6 0)) (3 (2 1 0) (4 3 0) (5 6 0)) (4 (1 2 0) (3 4 0) (5 6 0)) (5 (7 8 0) (9 10 0) (5 6 0)) (6 (2 1 0) (4 3 0) (5 6 0))

The results of this would be: ((1 2 4) (3 6))

Notice 2 is still equal, even though points are out of order and 5 is ignored because it is unique. Oh, these numbers I’m referring to are the leading index numbers there to keep track of the individual lists. If it means anything, the first point is always 0,0 – or close to it.

Here’s an actual list generated by the program:

 

((1 (-5.68434e-014 1.13687e-013 0.0) (-5.68434e-014 84.0 0.0) (-5.68434e-014 168.0 0.0) (-5.68434e-014 252.0 0.0) (47.9772 1.13687e-013 0.0) (47.9772 84.0 0.0) (47.9772 168.0 0.0) (47.9772 252.0 0.0) (95.9544 1.13687e-013 0.0) (95.9544 84.0 0.0) (95.9544 168.0 0.0) (95.9544 252.0 0.0) (143.932 1.13687e-013 0.0) (143.932 84.0 0.0) (143.932 168.0 0.0) (143.932 252.0 0.0) (191.909 1.13687e-013 0.0) (191.909 84.0 0.0) (191.909 168.0 0.0) (191.909 252.0 0.0) (239.886 1.13687e-013 0.0) (239.886 84.0 0.0) (239.886 168.0 0.0) (239.886 252.0 0.0) (287.863 1.13687e-013 0.0) (287.863 84.0 0.0) (287.863 168.0 0.0) (287.863 252.0 0.0) (335.84 1.13687e-013 0.0) (335.84 84.0 0.0) (335.84 168.0 0.0) (335.84 252.0 0.0) (383.817 1.13687e-013 0.0) (383.817 84.0 0.0) (383.817 168.0 0.0) (383.817 252.0 0.0) (431.795 1.13687e-013 0.0) (431.795 84.0 0.0) (431.795 168.0 0.0) (431.795 252.0 0.0)) 
 (2 (-2.27374e-013 2.27374e-013 0.0) (-2.27374e-013 84.0 0.0) (-2.27374e-013 168.0 0.0) (-2.27374e-013 252.0 0.0) (47.9772 2.27374e-013 0.0) (47.9772 84.0 0.0) (47.9772 168.0 0.0) (47.9772 252.0 0.0) (95.9544 2.27374e-013 0.0) (95.9544 84.0 0.0) (95.9544 168.0 0.0) (95.9544 252.0 0.0) (143.932 2.27374e-013 0.0) (143.932 84.0 0.0) (143.932 168.0 0.0) (143.932 252.0 0.0) (191.909 2.27374e-013 0.0) (191.909 84.0 0.0) (191.909 168.0 0.0) (191.909 252.0 0.0) (239.886 2.27374e-013 0.0) (239.886 84.0 0.0) (239.886 168.0 0.0) (239.886 252.0 0.0) (287.863 2.27374e-013 0.0) (287.863 84.0 0.0) (287.863 168.0 0.0) (287.863 252.0 0.0) (335.84 2.27374e-013 0.0) (335.84 84.0 0.0) (335.84 168.0 0.0) (335.84 252.0 0.0) (383.817 2.27374e-013 0.0) (383.817 84.0 0.0) (383.817 168.0 0.0) (383.817 252.0 0.0) (431.795 2.27374e-013 0.0) (431.795 84.0 0.0) (431.795 168.0 0.0) (431.795 252.0 0.0)) 
 (3 (0.0 3.41061e-013 0.0) (0.0 84.0 0.0) (0.0 168.0 0.0) (0.0 252.0 0.0) (47.9772 3.41061e-013 0.0) (47.9772 84.0 0.0) (47.9772 168.0 0.0) (47.9772 252.0 0.0) (95.9544 3.41061e-013 0.0) (95.9544 84.0 0.0) (95.9544 168.0 0.0) (95.9544 252.0 0.0) (143.932 3.41061e-013 0.0) (143.932 84.0 0.0) (143.932 168.0 0.0) (191.909 3.41061e-013 0.0) (191.909 84.0 0.0) (191.909 168.0 0.0) (191.909 252.0 0.0) (239.886 3.41061e-013 0.0) (239.886 84.0 0.0) (239.886 168.0 0.0) (239.886 252.0 0.0) (287.863 3.41061e-013 0.0) (287.863 84.0 0.0) (287.863 168.0 0.0) (287.863 252.0 0.0) (335.795 -0.00118379 0.0) (335.84 84.0 0.0) (335.84 168.0 0.0) (335.84 252.0 0.0) (383.817 3.41061e-013 0.0) (383.817 84.0 0.0) (383.817 168.0 0.0) (383.817 252.0 0.0) (431.795 3.41061e-013 0.0) (431.795 84.0 0.0) (431.795 168.0 0.0) (431.795 252.0 0.0)) 
 (4 (0.0 5.11591e-013 0.0) (0.0 84.0 0.0) (0.0 168.0 0.0) (0.0 252.0 0.0) (47.9772 5.11591e-013 0.0) (47.9772 84.0 0.0) (47.9772 168.0 0.0) (47.9772 252.0 0.0) (95.9544 5.11591e-013 0.0) (95.9544 84.0 0.0) (95.9544 168.0 0.0) (95.9544 252.0 0.0) (143.932 5.11591e-013 0.0) (143.932 84.0 0.0) (143.932 168.0 0.0) (143.932 252.0 0.0) (191.909 5.11591e-013 0.0) (191.909 84.0 0.0) (191.909 168.0 0.0) (191.909 252.0 0.0) (239.886 5.11591e-013 0.0) (239.886 84.0 0.0) (239.886 168.0 0.0) (239.886 252.0 0.0) (287.863 5.11591e-013 0.0) (287.863 84.0 0.0) (287.863 168.0 0.0) (287.863 252.0 0.0) (335.84 5.11591e-013 0.0) (335.84 84.0 0.0) (335.84 168.0 0.0) (335.84 252.0 0.0) (383.817 5.11591e-013 0.0) (383.817 84.0 0.0) (383.817 168.0 0.0) (383.817 252.0 0.0) (431.795 5.11591e-013 0.0) (431.795 84.0 0.0) (431.795 168.0 0.0) (431.795 252.0 0.0)) 
 (5 (0.0 -5.68434e-014 0.0) (0.0 84.0 0.0) (0.0 168.0 0.0) (0.0 252.0 0.0) (47.9772 -5.68434e-014 0.0) (47.9772 84.0 0.0) (47.9772 168.0 0.0) (47.9772 252.0 0.0) (95.9544 -5.68434e-014 0.0) (95.9544 84.0 0.0) (95.9544 168.0 0.0) (95.9544 252.0 0.0) (143.932 -5.68434e-014 0.0) (143.932 84.0 0.0) (143.932 168.0 0.0) (143.932 252.0 0.0) (191.909 -5.68434e-014 0.0) (191.909 84.0 0.0) (191.909 168.0 0.0) (191.909 252.0 0.0) (239.886 -5.68434e-014 0.0) (239.886 84.0 0.0) (239.886 168.0 0.0) (239.886 252.0 0.0) (287.863 -5.68434e-014 0.0) (287.863 84.0 0.0) (287.863 168.0 0.0) (287.863 252.0 0.0) (335.84 -5.68434e-014 0.0) (335.84 84.0 0.0) (335.84 168.0 0.0) (335.84 252.0 0.0) (383.817 -5.68434e-014 0.0) (383.817 84.0 0.0) (383.817 168.0 0.0) (383.817 252.0 0.0) (431.795 -5.68434e-014 0.0) (431.795 84.0 0.0) (431.795 168.0 0.0) (431.795 252.0 0.0)) 
 (6 (-1.42109e-013 1.13687e-013 0.0) (-1.42109e-013 47.9772 0.0) (-1.42109e-013 95.9544 0.0) (-1.42109e-013 143.932 0.0) (-1.42109e-013 191.909 0.0) (-1.42109e-013 239.886 0.0) (-1.42109e-013 287.863 0.0) (-1.42109e-013 335.84 0.0) (-1.42109e-013 383.817 0.0) (-1.42109e-013 431.795 0.0) (84.0 1.13687e-013 0.0) (84.0 47.9772 0.0) (84.0 95.9544 0.0) (84.0 143.932 0.0) (84.0 191.909 0.0) (84.0 239.886 0.0) (84.0 287.863 0.0) (84.0 335.84 0.0) (84.0 383.817 0.0) (84.0 431.795 0.0) (168.0 1.13687e-013 0.0) (168.0 47.9772 0.0) (168.0 95.9544 0.0) (168.0 143.932 0.0) (168.0 191.909 0.0) (168.0 239.886 0.0) (168.0 287.863 0.0) (168.0 335.84 0.0) (168.0 383.817 0.0) (168.0 431.795 0.0) (252.0 1.13687e-013 0.0) (252.0 47.9772 0.0) (252.0 95.9544 0.0) (252.0 143.932 0.0) (252.0 191.909 0.0) (252.0 239.886 0.0) (252.0 287.863 0.0) (252.0 335.84 0.0) (252.0 383.817 0.0) (252.0 431.795 0.0)) 
 (7 (-2.27374e-013 2.27374e-013 0.0) (33.0724 34.7567 0.0) (60.8531 -57.9042 0.0) (66.1448 69.5133 0.0) (93.9255 -23.1476 0.0) (99.2172 104.27 0.0) (121.706 -115.808 0.0) (126.998 11.6091 0.0) (132.29 139.027 0.0) (154.779 -81.0518 0.0) (160.07 46.3657 0.0) (165.362 173.783 0.0) (182.559 -173.713 0.0) (187.851 -46.2952 0.0) (193.143 81.1224 0.0) (198.434 208.54 0.0) (215.632 -138.956 0.0) (220.923 -11.5385 0.0) (226.215 115.879 0.0) (231.507 243.297 0.0) (248.704 -104.199 0.0) (253.996 23.2181 0.0) (259.288 150.636 0.0) (264.579 278.053 0.0) (281.776 -69.4428 0.0) (287.068 57.9748 0.0) (292.36 185.392 0.0) (297.652 312.81 0.0) (314.849 -34.6861 0.0) (320.141 92.7315 0.0) (347.921 0.0705583 0.0) (353.213 127.488 0.0) (358.505 254.906 0.0) (380.994 34.8272 0.0) (386.285 162.245 0.0) (414.066 69.5839 0.0) (419.341 196.983 0.0) (447.139 104.341 0.0) (480.194 139.079 0.0)) 
 (8 (-2.27374e-013 4.54747e-013 0.0) (33.0724 34.7567 0.0) (60.8231 -57.8728 0.0) (66.1448 69.5133 0.0) (93.9255 -23.1476 0.0) (99.2172 104.27 0.0) (121.706 -115.808 0.0) (126.998 11.6091 0.0) (132.29 139.027 0.0) (154.779 -81.0518 0.0) (160.07 46.3657 0.0) (165.362 173.783 0.0) (182.559 -173.713 0.0) (187.851 -46.2952 0.0) (193.143 81.1224 0.0) (198.434 208.54 0.0) (215.632 -138.956 0.0) (220.923 -11.5385 0.0) (226.215 115.879 0.0) (231.507 243.297 0.0) (248.704 -104.199 0.0) (253.996 23.2181 0.0) (259.288 150.636 0.0) (264.579 278.053 0.0) (281.776 -69.4428 0.0) (287.068 57.9748 0.0) (292.36 185.392 0.0) (297.652 312.81 0.0) (314.849 -34.6861 0.0) (320.141 92.7315 0.0) (325.432 220.149 0.0) (347.921 0.0705583 0.0) (353.213 127.488 0.0) (358.505 254.906 0.0) (380.994 34.8272 0.0) (386.285 162.245 0.0) (414.066 69.5839 0.0) (419.358 197.001 0.0) (447.139 104.341 0.0) (480.211 139.097 0.0)) 
 (9 (1.98952e-013 0.0 0.0) (1.98952e-013 47.9772 0.0) (1.98952e-013 95.9544 0.0) (1.98952e-013 143.932 0.0) (1.98952e-013 191.909 0.0) (1.98952e-013 239.886 0.0) (1.98952e-013 287.863 0.0) (1.98952e-013 335.84 0.0) (1.98952e-013 383.817 0.0) (1.98952e-013 431.795 0.0) (84.0 0.0 0.0) (84.0 47.9772 0.0) (84.0 95.9544 0.0) (84.0 143.932 0.0) (84.0 191.909 0.0) (84.0 239.886 0.0) (84.0 287.863 0.0) (84.0 335.84 0.0) (84.0 383.817 0.0) (84.0 431.795 0.0) (168.0 0.0 0.0) (168.0 47.9772 0.0) (168.0 95.9544 0.0) (168.0 143.932 0.0) (168.0 191.909 0.0) (168.0 239.886 0.0) (168.0 287.863 0.0) (168.0 335.84 0.0) (168.0 383.817 0.0) (168.0 431.795 0.0) (252.0 0.0 0.0) (252.0 47.9772 0.0) (252.0 95.9544 0.0) (252.0 143.932 0.0) (252.0 191.909 0.0) (252.0 239.886 0.0) (252.0 287.863 0.0) (252.0 335.84 0.0) (252.0 383.817 0.0) (252.0 431.795 0.0)) 
 (10 (-1.10845e-012 0.0 0.0) (-1.10845e-012 47.9772 0.0) (-1.10845e-012 95.9544 0.0) (-1.10845e-012 143.932 0.0) (-1.10845e-012 191.909 0.0) (-1.10845e-012 239.886 0.0) (-1.10845e-012 287.863 0.0) (-1.10845e-012 335.84 0.0) (-1.10845e-012 383.817 0.0) (-1.10845e-012 431.795 0.0) (84.0 0.0 0.0) (84.0 47.9772 0.0) (84.0 95.9544 0.0) (84.0 143.932 0.0) (84.0 191.909 0.0) (84.0 239.886 0.0) (84.0 287.863 0.0) (84.0 335.84 0.0) (84.0 383.817 0.0) (84.0 431.795 0.0) (168.0 0.0 0.0) (168.0 47.9772 0.0) (168.0 95.9544 0.0) (168.0 143.932 0.0) (168.0 191.909 0.0) (168.0 239.886 0.0) (168.0 287.863 0.0) (168.0 335.84 0.0) (168.0 383.817 0.0) (168.0 431.795 0.0) (252.0 0.0 0.0) (252.0 47.9772 0.0) (252.0 95.9544 0.0) (252.0 143.932 0.0) (252.0 191.909 0.0) (252.0 239.886 0.0) (252.0 287.863 0.0) (252.0 383.817 0.0) (252.0 431.795 0.0) (252.001 335.795 0.0)) 
 (11 (2.27374e-013 0.0 0.0) (38.9896 -27.9575 0.0) (48.9489 68.2643 0.0) (77.9792 -55.915 0.0) (87.9385 40.3068 0.0) (97.8977 136.529 0.0) (116.969 -83.8725 0.0) (126.928 12.3493 0.0) (136.887 108.571 0.0) (146.847 204.793 0.0) (155.958 -111.83 0.0) (165.918 -15.6082 0.0) (175.877 80.6135 0.0) (185.836 176.835 0.0) (194.948 -139.787 0.0) (204.907 -43.5657 0.0) (214.867 52.6561 0.0) (224.864 148.852 0.0) (233.938 -167.745 0.0) (243.897 -71.5232 0.0) (253.856 24.6986 0.0) (263.815 120.92 0.0) (272.927 -195.702 0.0) (282.886 -99.4807 0.0) (292.846 -3.25892 0.0) (302.805 92.9628 0.0) (311.917 -223.66 0.0) (321.876 -127.438 0.0) (331.835 -31.2164 0.0) (341.795 65.0053 0.0) (350.906 -251.617 0.0) (360.866 -155.396 0.0) (370.825 -59.1739 0.0) (380.784 37.0478 0.0) (399.855 -183.353 0.0) (409.815 -87.1314 0.0) (419.774 9.09036 0.0) (448.804 -115.089 0.0) (458.763 -18.8671 0.0) (497.753 -46.8246 0.0)))

I believe the results are ((1 2 4 5) (6 9 10)). Lists 3, 7, 8 and 11 are unique. 3 is missing one point, and 11 is altogether different. List 7 and 8 were supposed to match, but my program just told me #7 is missing point. Order of anything is of no importance, as long as the lists come out defining which lists are equal. The lists are typically 6-10 points long, and there can be as many as 80 lists in one drawing, with usually more than 80% matching each other in some combination.

 

I’ve searched everywhere and nothing has helped. The minute I try my hand at it, it immediately disintegrates into loops I can’t possibly keep track of in my head to understand what I’m doing or trying to do. Some of you are crazy sophisticated in your programming (as you are professionals), I’m purely amateur. As such, please avoid visual lisp. I can’t possibly understand that or tweak it later on as the need arises. I’m sure someone out there can laugh at me and work this out in a handful of lines. Some crazy combination of Mapcar and Lambda. Thanks in advance. Sorry if I didn’t post this properly. I lurk a lot, but seldom post. Thanks.

Link to comment
Share on other sites

Try this

 

(defun group (l f / round o r)
 
 (defun round (a f)
   (cond
     ((numberp a)
      (if (equal a (fix a)) a (* (atof (rtos (/ a f) 2 0)) f))
      )
     ((and a (listp a)) (mapcar '(lambda (x) (round x f)) a))
     )
   )
 
 (setq l (mapcar
           (function
             (lambda (x)
               (cons
                 (car x)
                 (vl-sort
                   (vl-sort
                     (vl-sort
                       (cdr x)
                       '(lambda (a b) (< (caddr a) (caddr b)))
                     )
                     '(lambda (a b) (< (cadr a) (cadr b)))
                   )
                   '(lambda (a b) (< (car a) (car b)))
                 )
               )
             )
           )
           (if (/= f 0.0) (round l f) l)
         )
       )
 (foreach x (reverse l)
   (if
     (setq o (vl-some '(lambda (a) (if (vl-every 'equal (car a) (cdr x)) a)) r))
     (setq r (subst (list (car o) (cons (car x) (cadr o))) o r))
     (setq r (cons (list (cdr x) (list (car x))) r))
     )
   )
 (vl-remove-if '(lambda (a) (< (length a) 2)) (mapcar 'cadr r))
 )

_$ (setq l '((1 (-5.68434e-014 1.13687e-013 0.0) (-5.68434e-014 ...
_$ (group l 0)      -> nil
_$ (group l 1)      -> ((1 2 4 5) (6 9 10))
_$ (group l 0.0001) -> ((1 2 4 5) (6 9))

_$ (setq l '((1 (1 2 0) (3 4 0) (5 6 0)) (2 (3 4 ...
_$ (group l 0)      -> ((1 2 4) (3 6))
_$ (group l 1)      -> ((1 2 4) (3 6))

Link to comment
Share on other sites

Try this

 

(defun group (l f / round o r)
 
 (defun round (a f)
   (cond
     ((numberp a)
      (if (equal a (fix a)) a (* (atof (rtos (/ a f) 2 0)) f))
      )
     ((and a (listp a)) (mapcar '(lambda (x) (round x f)) a))
     )
   )
 
 (setq l (mapcar
           (function
             (lambda (x)
               (cons
                 (car x)
                 (vl-sort
                   (vl-sort
                     (vl-sort
                       (cdr x)
                       '(lambda (a b) (< (caddr a) (caddr b)))
                     )
                     '(lambda (a b) (< (cadr a) (cadr b)))
                   )
                   '(lambda (a b) (< (car a) (car b)))
                 )
               )
             )
           )
           (if (/= f 0.0) (round l f) l)
         )
       )
 (foreach x (reverse l)
   (if
     (setq o (vl-some '(lambda (a) (if (vl-every 'equal (car a) (cdr x)) a)) r))
     (setq r (subst (list (car o) (cons (car x) (cadr o))) o r))
     (setq r (cons (list (cdr x) (list (car x))) r))
     )
   )
 (vl-remove-if '(lambda (a) (< (length a) 2)) (mapcar 'cadr r))
 )

_$ (setq l '((1 (-5.68434e-014 1.13687e-013 0.0) (-5.68434e-014 ...
_$ (group l 0)      -> nil
_$ (group l 1)      -> ((1 2 4 5) (6 9 10))
_$ (group l 0.0001) -> ((1 2 4 5) (6 9))

_$ (setq l '((1 (1 2 0) (3 4 0) (5 6 0)) (2 (3 4 ...
_$ (group l 0)      -> ((1 2 4) (3 6))
_$ (group l 1)      -> ((1 2 4) (3 6))

 

 

 

 

wow , impressive :-)

Link to comment
Share on other sites

Here is an optimisation of Stefan's method:

(defun sort2 ( lst fuz / rtn tmp )
   (foreach itm lst
       (setq tmp
           (vl-sort (cdr itm)
              '(lambda ( a b )
                   (if (equal (car a) (car b))
                       (if (equal (cadr a) (cadr b))
                           (< (caddr a) (caddr b))
                           (< (cadr  a) (cadr  b))
                       )
                       (< (car a) (car b))
                   )
               )
           )
       )
       (or (vl-some
              '(lambda ( x )
                   (if (vl-every '(lambda ( a b ) (equal a b fuz)) (last x) tmp)
                       (setq rtn  (subst (cons (car itm) x) x rtn))
                   )
               )
               rtn
           )
           (setq rtn (cons (list (car itm) tmp) rtn))
       )
   )
   (reverse (vl-remove-if-not 'cdr (mapcar '(lambda ( x ) (cdr (reverse x))) rtn)))
)

Comparison:

_$ (benchmark '((group lst 0.01) (sort2 lst 0.01)))
Benchmarking ............Elapsed milliseconds / relative speed for 512 iteration(s):

   (SORT2 LST 0.01).....1513 / 2.51 <fastest>
   (GROUP LST 0.01).....3791 / 1 <slowest>

Link to comment
Share on other sites

Here is an optimisation of Stefan's method:

(defun sort2 ( lst fuz / rtn tmp )
   (foreach itm lst
       (setq tmp
           (vl-sort (cdr itm)
              '(lambda ( a b )
                   (if (equal (car a) (car b))
                       (if (equal (cadr a) (cadr b))
                           (< (caddr a) (caddr b))
                           (< (cadr  a) (cadr  b))
                       )
                       (< (car a) (car b))
                   )
               )
           )
       )
       (or (vl-some
              '(lambda ( x )
                   (if (vl-every '(lambda ( a b ) (equal a b fuz)) (last x) tmp)
                       (setq rtn  (subst (cons (car itm) x) x rtn))
                   )
               )
               rtn
           )
           (setq rtn (cons (list (car itm) tmp) rtn))
       )
   )
   (reverse (vl-remove-if-not 'cdr (mapcar '(lambda ( x ) (cdr (reverse x))) rtn)))
)

Comparison:

_$ (benchmark '((group lst 0.01) (sort2 lst 0.01)))
Benchmarking ............Elapsed milliseconds / relative speed for 512 iteration(s):

   (SORT2 LST 0.01).....1513 / 2.51 <fastest>
   (GROUP LST 0.01).....3791 / 1 <slowest>

 

 

I knew you couldn't resist Lee haha

Link to comment
Share on other sites

You guys are awesome and greatly appreciated. Sometimes I have to go into programs I wrote on my own more than 10 years ago and I find routines that are a page long that I can do in a couple of lines with my own lambda and mapcar expressions. All learned from you folks. It's so much easier now, more accurate and my debugging time is so much shorter. I realized about a week ago I was going to need this routine, I've been dreading it all week. I started to get into it yesterday. I think I had myself mentally defeated before I began. Thank you all so much, it works great.

Link to comment
Share on other sites

Here is an optimisation of Stefan's method:

Comparison:

_$ (benchmark '((group lst 0.01) (sort2 lst 0.01)))
Benchmarking ............Elapsed milliseconds / relative speed for 512 iteration(s):

   (SORT2 LST 0.01).....1513 / 2.51 <fastest>
   (GROUP LST 0.01).....3791 / 1 <slowest>

 

That's Lee Mac for you... Always try to give appropriate solution.... Hats off to you :notworthy:

Link to comment
Share on other sites

Here is an optimisation of Stefan's method:

 

(setq l '((1 (-5.68434e-014 1.13687e-013 0.0) (-5.68434e-014 ...

_$ (sort2 l 0.01) -> ((1 2 4 5) (6 9))
_$ (group l 0.01) -> ((1 2 4 5) (6 9))

_$ (sort2 l 1)    -> ((1 2 4 5) (6 9))
_$ (group l 1)    -> ((1 2 4 5) (6 9 10))

Link to comment
Share on other sites

(setq l '((1 (-5.68434e-014 1.13687e-013 0.0) (-5.68434e-014 ...

_$ (sort2 l 0.01) -> ((1 2 4 5) (6 9))
_$ (group l 0.01) -> ((1 2 4 5) (6 9))

_$ (sort2 l 1)    -> ((1 2 4 5) (6 9))
_$ (group l 1)    -> ((1 2 4 5) (6 9 10))

 

It depends on whether the fuzz should be interpreted as a tolerance on the distance between the points, or a tolerance on the equality of the individual coordinate values.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...