Super cool, Evgeniy, very very quick.
Now about a 500,000 points dwg generated by the following code.
Your code is about only 48s (vlx) or 58s (lsp), my code is about 160s.
sure, Daniel and pkohut and Gile 's code is much quick. But maybe C can 10 times quick than Lisp?
I need to deep study for your code structure, Thank you
---------------------------------
Just find a bugs, when in a only two points dwg, p1=(60,0,0) p2=(180,0,0), the code seems to get error, it seems that the error happen in the sortting data into xy grid.
----------------------------------
Recently, I buy the book you recommend to me :"Structure and interpretation of computer programs" by Harold Abeleson in MIT.
It is a rather good book for LISP, I am learning now about the recursion and so on.
I read your article about "recursion" in dwg.ru and learn a lot, could you post it here also for theswamp friends.
;;from internet
(defun random ()
(setq seed (if seed
(rem (+ (* seed 15625.7) 0.21137152) 1)
0.3171943
)
)
)
(defun random-n (n)
(* n (random))
)
(defun entmakepoint (pt layer)
(entmake (list (cons 0 "POINT")
(cons 8 layer);***
(cons 6 "BYLAYER")
(cons 10 pt) ;***
(cons 39 0.0)
(cons 50 0.0)
(cons 62 256)
(cons 210 (list 0.0 0.0 1.0))
)
)
)
;;generate random points
(defun c:test1 ()
(repeat 500000
(entmakepoint (list (random-n 100000) (random-n 60000) 0) "0")
)
)