Author Topic: Fasted way to find a closed polyline by point inside  (Read 7264 times)

0 Members and 2 Guests are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12318
  • London, England
Re: Fasted way to find a closed polyline by point inside
« Reply #30 on: October 07, 2014, 08:48:24 AM »
A messy attempt to avoid such issues:
...
Don't expect it to be fast though!
Tested on Bricscad V15:

I'm not sure that the performance comparison between my later posted function and that posted earlier is meaningful since the first function I posted will return incorrect results under some conditions (arc-segmented polylines / ray tangent to edge etc.), and hence we are not comparing apples with apples.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1025
  • Marco
Re: Fasted way to find a closed polyline by point inside
« Reply #31 on: October 07, 2014, 09:10:54 AM »
A messy attempt to avoid such issues:
...
Don't expect it to be fast though!
Tested on Bricscad V15:

I'm not sure that the performance comparison between my later posted function and that posted earlier is meaningful since the first function I posted will return incorrect results under some conditions (arc-segmented polylines / ray tangent to edge etc.), and hence we are not comparing apples with apples.
I agree with you, I did a new test with Briscad and thought it was interesting the comparision in the case not need the condition: "arc-segmented polylines / ray tangent to edge etc." (in my case).
Thanks again.

ribarm

  • Water Moccasin
  • Posts: 2226
  • Marko Ribar, architect
Re: Fasted way to find a closed polyline by point inside
« Reply #32 on: October 07, 2014, 09:21:57 AM »
I have one remark ab this Gile's function :

Code: [Select]
(defun gile ( internalPoint layerName )
    (if (setq ss
          (ssget
            "_F"
            (list internalPoint (getvar 'extmin))
            (list '(0 . "lwpolyline") (cons 8 layerName) '(-4 . "&") '(70 . 1))
          )
        )
        (sssetfirst nil (ssadd (ssname ss 0)))
    )
    (princ)
)

Please, test it on posted DWG, and look into picture... So it's the fastest, but it's wrong...

Regards...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

roy_043

  • Water Moccasin
  • Posts: 1747
  • BricsCAD 18
Re: Fasted way to find a closed polyline by point inside
« Reply #33 on: October 07, 2014, 09:40:22 AM »
@ ribarm:
You are correct. But Gile's (or similar) code can be useful if you want the reduce the number of polylines to process.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1025
  • Marco
Re: Fasted way to find a closed polyline by point inside
« Reply #34 on: October 07, 2014, 01:49:09 PM »
I have one remark ab this Gile's function :
..
Please, test it on posted DWG, and look into picture... So it's the fastest, but it's wrong...
Regards...
@ribarm "posted DWG" is it my DWG? Does not exist overlapping polylines in that drawing, only
   adjacent. Anyway thanks again for your suggestions and tests!

Marco