Hi VovKa,
I ran speed tests while working on the latest code. They indicated the
core part of the routine, from IntersectWith to where the two points are
known, was already fast. Like 0.1 second or less and often half that.
This includes cases where the second calculation, the part you rewrote,
gets a good workout.
At that point I thought, rightly or wrongly, trying to make it faster
wasn't worth it. I'm sure you're right, it could be faster. I wonder
though whether the user would ever see the difference.
There could be a condition which tests for whether either objects is a
circle. Special case since there are no ends to deal with. Get the closest
point on the other object from center point of the circle. Get the closest
point on the circle from that point.
I found something interesting while speed testing. Check the attached
example file and the test routine which follows. The polylines have more
than 600 vertices, no bulges I believe. The IntersectWith method takes
about 0.35 second to compare the objects. It causes a noticeable lag in
the routine.
(defun StartTimer ()
(setq *start* (getvar "date")))
(defun EndTimer (/ end)
(setq end (* 86400 (- (getvar "date") *start*)))
(princ (strcat "\nTimer: " (rtos end 2 8) " seconds\n")))
(defun c:test ( / obj1 obj2)
(setq obj1 (car (entsel "\nSelect polyline: "))
obj1 (vlax-ename->vla-object obj1)
obj2 (car (entsel "\nSelect polyline: "))
obj2 (vlax-ename->vla-object obj2)
)
(starttimer)
(vlax-invoke obj1 'IntersectWith obj2 acExtendNone)
(endtimer)
)