Not sure what you mean by internal point? What if you have a polyline within a polyline?Normally there is not this possibility, if there could be also the first polyline found can be good.
@gile: this is good for another case that I have to solve, but in this case it select too many objects
using: (getvar 'extmin).
roy_043: I do not have the point list to use your function I only have a pointMy KGA_Geom_PointInsidePointList_P function is an alternative for Lee's raycast function. Both functions take a point and a point list as arguments.
@gile: this is good for another case that I have to solve, but in this case it select too many objects
using: (getvar 'extmin).
(ssname ss 0)
You select only the first object (crossed by "fence")
Ciao
Ok I understand, sorry for the misinterpretation and thanks again.roy_043: I do not have the point list to use your function I only have a pointMy KGA_Geom_PointInsidePointList_P function is an alternative for Lee's raycast function. Both functions take a point and a point list as arguments.
(GILE_TEST INTERNALPOINT LAYERNAME)...........1186 / 12.27 <fastest>
(TEST_STEFAN INTERNALPOINT LAYERNAME).........1373 / 10.6
(POLYFROMINSIDEPOINT_KGA INTERNALPOINT).......5273 / 2.76
(POLYFROMINSIDEPOINT INTERNALPOINT)...........5632 / 2.58
(SELCLLWBYPT+LAY INTERNALPOINT LAYER...).....14555 / 1 <slowest>
(TEST_STEFAN INTERNALPOINT LAYERNAME)........1810 / 5.83 <fastest>
(GILE_TEST INTERNALPOINT LAYERNAME)..........2137 / 4.93
(POLYFROMINSIDEPOINT_KGA INTERNALPOINT)......6568 / 1.61
(POLYFROMINSIDEPOINT INTERNALPOINT).........10545 / 1 <slowest>
(GILE_TEST INTERNALPOINT LAYERNAME).........1185 / 5.45 <fastest>
(TEST_STEFAN INTERNALPOINT LAYERNAME).......1373 / 4.7
(POLYFROMINSIDEPOINT_KGA INTERNALPOINT).....6240 / 1.03
(POLYFROMINSIDEPOINT INTERNALPOINT).........6458 / 1 <slowest>
I don't know the context you want to use the code in, but I would not focus on speed just yet. All code examples have one or more issues:
- Bulges are not taken into account.
- Polylines may not be bisected by other polylines.
- The polyline must have an edge between the point and extmin.
- The polyline must be rectangular.
...
Marko did you seen my dwg? There are 4 errors (selcllwbypt+lay > 4 errors)...I don't know the context you want to use the code in, but I would not focus on speed just yet. All code examples have one or more issues:All these issues are taken into consideration with my code... Maybe that's why it's the slowest... Or I missed something in OP's request?
- Bulges are not taken into account.
- Polylines may not be bisected by other polylines.
- The polyline must have an edge between the point and extmin.
- The polyline must be rectangular.
...
Marko did you seen my dwg? There are 4 errors (selcllwbypt+lay > 4 errors)...
All these issues are taken into consideration with my code... Maybe that's why it's the slowest... Or I missed something in OP's request?I find that your code does not work if a polyline is bisected by another and if I click a point that is internal to the first and external to the second. Note: I use BricsCAD.
Ok, now is ok.Marko did you seen my dwg? There are 4 errors (selcllwbypt+lay > 4 errors)...
Yes, the problem is fuzz factor... Change 1e-10 to 1e-4 and it'll work...
[EDIT] : I've updated code in my post... Test it now... [/EDIT]
For this i think Lee Mac and your KGA... are OK.All these issues are taken into consideration with my code... Maybe that's why it's the slowest... Or I missed something in OP's request?I find that your code does not work if a polyline is bisected by another and if I click a point that is internal to the first and external to the second. Note: I use BricsCAD.
I don't know the context you want to use the code in, but I would not focus on speed just yet. All code examples have one or more issues:Sorry for the delay but I do not see my reply (about 5 hours ago) so I rewrite it:
- Bulges are not taken into account.
- Polylines may not be bisected by other polylines.
- The polyline must have an edge between the point and extmin.
- The polyline must be rectangular.
...
The raycasting method has a fundamental flaw:
http://ww3.cad.de/foren/ubb/Forum145/HTML/000602.shtml#000008
Here is my newest version... It's much more simple than previous, and it satisfies all previously mentioned issues... And it's fast enough - for my standards...Tested on Bricscad V14: do not works. Later I will tet on AutoCAD.
...
Regards, M.R.
A messy attempt to avoid such issues:Tested on Bricscad V15:
...
Don't expect it to be fast though!
Elapsed milliseconds / relative speed for 2048 iteration(s):
(GILE_TEST INTERNALPOINT LAYERNAME)...........1638 / 19.75 <fastest>
(POLYFROMINSIDEPOINT INTERNALPOINT)...........6926 / 4.67
(POLYFROMINSIDEPOINT_KGA INTERNALPOINT).......8580 / 3.77
(POLYFROMINSIDEPOINT2 INTERNALPOINT).........13494 / 2.4
(SELCLLWBYPT+LAY INTERNALPOINT LAYER...).....32355 / 1 <slowest>
Elapsed milliseconds / relative speed for 1024 iteration(s):
(GILE_TEST INTERNALPOINT LAYERNAME).........1451 / 6.81 <fastest>
(POLYFROMINSIDEPOINT INTERNALPOINT).........5382 / 1.83
(POLYFROMINSIDEPOINT_KGA INTERNALPOINT).....7488 / 1.32
(POLYFROMINSIDEPOINT2 INTERNALPOINT)........9875 / 1 <slowest>
Elapsed milliseconds / relative speed for 2048 iteration(s):
(GILE_TEST INTERNALPOINT LAYERNAME)..........1825 / 11.39 <fastest>
(POLYFROMINSIDEPOINT INTERNALPOINT).........12137 / 1.71
(POLYFROMINSIDEPOINT_KGA INTERNALPOINT).....19641 / 1.06
(POLYFROMINSIDEPOINT2 INTERNALPOINT)........20779 / 1 <slowest>
a little bit slower.
@ ribarm:
Your new function insidep creates two offset copies for every entity in ss. This must slow things down for large selection sets. Two other problems with this function are that the offset distance is hard-coded and that offset can create more than one new entity.
Another case to consider:
Two nested polylines without intersections and a point inside the biggest poyline only...
A messy attempt to avoid such issues:Tested on Bricscad V15:
...
Don't expect it to be fast though!
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).A messy attempt to avoid such issues:Tested on Bricscad V15:
...
Don't expect it to be fast though!
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.
(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)
)
I have one remark ab this Gile's function :@ribarm "posted DWG" is it my DWG? Does not exist overlapping polylines in that drawing, only
..
Please, test it on posted DWG, and look into picture... So it's the fastest, but it's wrong...
Regards...