here is something like yoursI have test your function and about: ; works with polygons only, i.e. if (equal (car PointsList) (last PointsList))
http://www.cadtutor.net/forum/showthread.php?39199-Identify-a-polyline-by-a-point-inside-this-polyline&p=263330&viewfull=1#post263330 (http://www.cadtutor.net/forum/showthread.php?39199-Identify-a-polyline-by-a-point-inside-this-polyline&p=263330&viewfull=1#post263330)
(defun c:test (/ ent pt PntLst)
(if
(and
(setq ent (car (entsel "\nLWPolyline: ")))
(setq pt (getpoint "\nPt: "))
(setq PntLst (mapcar 'cdr (vl-remove-if-not (function (lambda (x) (eq 10 (car x)))) (entget ent))))
)
(progn
(princ "\nequal: ")(princ (equal (car PntLst) (last PntLst)))
(princ "\nIsPointInside: ")(princ (vl-princ-to-string (vk_IsPointInside pt PntLst)))
(princ " PtInPoly_p: ")(princ (vl-princ-to-string (PtInPoly_p pt ent)))
)
)
(princ)
)
Do you think it's better to pass the last vertex in all cases where it is not equal to the first?usually i write my routines to work with coordinate lists not entities
(vk_IsPointInside
pt
(if (vl-position (cons 70 1) (entget ent))
(cons (last PntLst) PntLst)
PntLst
)
)
Ok, grazie. :)one more thing that i forgot to mention was that your
(setq PntLst (mapcar 'cdr (vl-remove-if-not (function (lambda (x) (eq 10 (car x)))) (entget ent))))
and ymg's(setq i (+ (vlax-curve-getEndParam en) 1))
(while (setq v (vlax-curve-getPointAtParam en (setq i (1- i))))
(setq l (cons v l))
)
return different resultsSorry for late, now I realized:Ok, grazie. :)one more thing that i forgot to mention was that yourCode: [Select](setq PntLst (mapcar 'cdr (vl-remove-if-not (function (lambda (x) (eq 10 (car x)))) (entget ent))))
and ymg'sCode: [Select](setq i (+ (vlax-curve-getEndParam en) 1))
return different results
(while (setq v (vlax-curve-getPointAtParam en (setq i (1- i))))
(setq l (cons v l))
)
so be careful
(defun Ale_AddZeta (pt)
(if (not (caddr pt))
(list (car pt) (cadr pt) 0.0)
pt
)
)
(defun c:test2 (/ ent pt PntLst i v l)
(setq ent (car (entsel "\nLWPolyline: ")))
(setq PntLst (mapcar 'cdr (vl-remove-if-not (function (lambda (x) (eq 10 (car x)))) (entget ent))))
(setq PntLst (mapcar 'Ale_AddZeta PntLst))
(setq i (+ (vlax-curve-getEndParam ent) 1))
(while (setq v (vlax-curve-getPointAtParam ent (setq i (1- i))))
(setq l (cons v l))
)(princ " \n ")
(princ (vl-princ-to-string l)) ; case X
(princ " \n ") (princ (vl-princ-to-string PntLst)) ; case Y
(princ)
)
Just a note: in case "C" (open but apparently closed ) with:(vk_IsPointInside
pt
(if (vl-position (cons 70 1) (entget ent))
(cons (last PntLst) PntLst)
PntLst
)
)
you add a double vertex equal to the last...Marc'Antonio Alessi,There are two types of "closed polylines" see value 1 and 2 of this function:
As stated the input should be the ename or vla-object of a closed polyline.
The little snippet that list the vertices is an excerpt from one of Gile's routine.
There is logic in VovKa's way of passing a point list instead of an entity to the
routine.
I'm sure you can easily modify it.
ymg
; Return Values:
; nil if LwPolyline is Open Lw0
; 1 if is Closed - (or logand 1 flag 70 is True) Lw1
; 2 if is Open BUT startpoint is equal endpoint Lw2
;
; Example:
; (ALE_Pline_LwClosedP (vlax-ename->vla-object (car (entsel "Poly: "))) 0.001)
;
(defun ALE_Pline_LwClosedP (LwPObj FuzFac)
(cond
( (eq :vlax-true (vla-get-closed LwPObj)) 1) ; or (= 1 (logand 1 (cdr (assoc 70 (entget EntNam)))))
( (equal (vlax-curve-getStartPoint LwPObj) (vlax-curve-getEndPoint LwPObj) FuzFac) 2 )
)
)
if you use my function test2 you get:Lw0:
((0.0 0.0 0.0) (10.0 0.0 0.0) (0.0 10.0 0.0))
((0.0 0.0 0.0) (10.0 0.0 0.0) (0.0 10.0 0.0))
Lw1:
((13.0 0.0 0.0) (23.0 0.0 0.0) (13.0 10.0 0.0) (13.0 0.0 0.0))
((13.0 0.0 0.0) (23.0 0.0 0.0) (13.0 10.0 0.0))
Lw2:
((27.0 0.0 0.0) (37.0 0.0 0.0) (27.0 10.0 0.0) (27.0 0.0 0.0))
((27.0 0.0 0.0) (37.0 0.0 0.0) (27.0 10.0 0.0) (27.0 0.0 0.0))
So your function works well with both Lw1 and LW2 even if the polyline is open because it always gets 4 vertices.; ALE_Pline_LwClosedP - Version: 1.01
;
; Return Values:
; nil if LwPolyline is Open
; 1 if is Closed - (or logand 1 flag 70 is True)
; 2 if is Open BUT startpoint is equal endpoint
; 3 if is Closed AND startpoint is equal endpoint
;
; Example:
; (ALE_Pline_LwClosedP (vlax-ename->vla-object (car (entsel "Poly: "))) 0.001)
;
(defun ALE_Pline_LwClosedP (LwPObj FuzFac)
(cond
( (eq :vlax-true (vla-get-closed LwPObj))
(if
(equal
(vlax-curve-getEndPoint LwPObj)
(vlax-curve-getPointAtParam LwPObj (1- (vlax-curve-getEndParam LwPObj)))
)
3 1
)
)
( (equal (vlax-curve-getStartPoint LwPObj) (vlax-curve-getEndPoint LwPObj) FuzFac) 2 )
)
)
Working with coordinates rather than the entity is faster as Vovka's routine does.yep, but you must get coordinates somewhere in you code anyway
3668 Points
Benchmarking .........Elapsed milliseconds / relative speed for 64 iteration(s):
(PTINPOLY_P P L).................1422 / 1.60 <fastest>
(POINTINSIDEPOINTLIST_P P L).....2031 / 1.12
(VK_ISPOINTINSIDE P L)...........2282 / 1.00 <slowest>
36639 Points
Benchmarking ........Elapsed milliseconds / relative speed for 32 iteration(s):
(PTINPOLY_P P L).................1500 / 1.65 <fastest>
(POINTINSIDEPOINTLIST_P P L).....2469 / 1.00 <slowest>
(vk_ispointinside p l) ...Hard error occurred *** internal stack limit reached (simulated)
(defun Isinside (pt ent / pt1 pt2 $_object_1 $_object_2 $_object_3 #gr #pti Inresult vlazone)
(if (>
(distance '(0 0 0) (cdr (assoc 10 (entget ent))))
9000000.00
)
(setq ofstval 0.8)
(setq ofstval 0.001)
)
(if (and pt ent)
(progn
(setq vlazone (vlax-ename->vla-object ent))
(setq $_object_1 (vlax-ename->vla-object ent))
(setq $_object_2 (car (vlax-invoke $_object_1 'Offset ofstval))
$_object_3 (car (vlax-invoke $_object_1 'Offset (- ofstval)))
)
(if (> (vla-get-area $_object_2) (vla-get-area $_object_3))
(progn
(set '#gr $_object_2)
(set '#pti $_object_3)
)
(progn
(set '#gr $_object_3)
(set '#pti $_object_2)
)
)
(setq pt1 (vlax-curve-getClosestPointTo #gr pt)
pt2 (vlax-curve-getClosestPointTo #pti pt)
)
(if (> (distance pt pt1) (distance pt pt2))
(setq Inresult T)
(setq Inresult nil)
)
(mapcar (function (lambda (x)
(progn
(vla-delete x)
(vlax-release-object x)
)
)
)
(list $_object_2 $_object_3)
)
(if (not (vlax-object-released-p $_object_1))
(vlax-release-object $_object_1)
)
)
)
Inresult
)
;;test
;;(Isinside (getpoint) (car (entsel)))
14739 Points
_$
Benchmarking ..........Elapsed milliseconds / relative speed for 128 iteration(s):
(PTINPOLY_P P L)......1954 / 1.11 <fastest>
(PTINPOLY_P2 P L).....2172 / 1.00 <slowest>
Benchmarking ..........Elapsed milliseconds / relative speed for 128 iteration(s):
(PTINPOLY_P P L)......1969 / 1.12 <fastest>
(PTINPOLY_P2 P L).....2203 / 1.00 <slowest>
Benchmarking ..........Elapsed milliseconds / relative speed for 128 iteration(s):
(PTINPOLY_P P L)......1968 / 1.12 <fastest>
(PTINPOLY_P2 P L).....2203 / 1.00 <slowest>
ronjomp,Your code in the first post is faster.
Thanks! for the test.
There is a 15% difference,
but which one is the fastest
(6 arguments) or (3 arguments)?
ymg
Benchmarking ..................Elapsed milliseconds / relative speed for 32768 iteration(s):
(PTINPOLY_P3 P L)..........1232 / 1.09 <fastest>
(VK_ISPOINTINSIDE P L).....1295 / 1.04
(PTINPOLY_P2 P L)..........1310 / 1.02
(PTINPOLY_P1 P L)..........1342 / 1.00 <slowest>
; 11 forms loaded from #<editor "C:/Lisp/ptinpoly_p test.LSP">
_$
Benchmarking ..................Elapsed milliseconds / relative speed for 32768 iteration(s):
(PTINPOLY_P3 P L)..........1232 / 1.08 <fastest>
(PTINPOLY_P2 P L)..........1295 / 1.02
(VK_ISPOINTINSIDE P L).....1295 / 1.02
(PTINPOLY_P1 P L)..........1326 / 1.00 <slowest>
; 11 forms loaded from #<editor "C:/Lisp/ptinpoly_p test.LSP">
_$
Benchmarking ..................Elapsed milliseconds / relative speed for 32768 iteration(s):
(PTINPOLY_P3 P L)..........1248 / 1.08 <fastest>
(PTINPOLY_P2 P L)..........1311 / 1.02
(VK_ISPOINTINSIDE P L).....1326 / 1.01
(PTINPOLY_P1 P L)..........1342 / 1.00 <slowest>
; 12 forms loaded from #<editor "C:/Lisp/ptinpoly_p test.LSP">
_$
(setq lstC ((629.78 294.034 0.0) (1964.78 1162.32 0.0) (2507.46 907.264 0.0) (2936.18 147.51 0.0) (2219.84 -623.098 0.0) (1036.79 -557.976 0.0) (249.903 -699.074 0.0) (249.903 -281.209 0.0) (1015.08 -281.209 0.0) (917.402 -37.002 0.0) (92.5253 28.1198 0.0) (92.5253 266.9 0.0)))
(setq pt (570.085 -112.977 0.0))
(KGX_BenchMark '((GEO_Geom_PointInsidePointList_P pt lstC) (GEO_Geom_PointInsidePointList_P_01 pt lstC) (GEO_Geom_PointInsidePointList_P_02 pt lstC) (PtInPoly_p3 pt lstC)) 100000)
Benchmarking .......... elapsed milliseconds / relative timing <100000 iterations>
(GEO_GEOM_POINTINSIDEPOINTLIST_P PT LSTC) ........ 1593 / 1.27 <fastest>
(GEO_GEOM_POINTINSIDEPOINTLIST_P_01 PT LSTC) ..... 1703 / 1.18
(GEO_GEOM_POINTINSIDEPOINTLIST_P_02 PT LSTC) ..... 1813 / 1.11
(PTINPOLY_P3 PT LSTC) ............................ 2016 / 1.00 <slowest>
Benchmarking ............Elapsed milliseconds / relative speed for 512 iteration(s):
(PTINPOLY_P1 P L)............................2875 / 1.85 <fastest>
(PTINPOLY_P2 P L)............................3859 / 1.38
(PTINPOLY_P3 P L)............................4125 / 1.29
(GEO_GEOM_POINTINSIDEPOINTLIST_P_02 ...).....4219 / 1.26
(GEO_GEOM_POINTINSIDEPOINTLIST_P_01 ...).....5281 / 1.01
(GEO_GEOM_POINTINSIDEPOINTLIST_P P L)........5328 / 1.00 <slowest>
And using your 'lstc' and 'pt':Elapsed milliseconds / relative speed for 32768 iteration(s):
(PTINPOLY_P3 P L)............................1125 / 1.51 <fastest>
(PTINPOLY_P2 P L)............................1188 / 1.43
(PTINPOLY_P1 P L)............................1297 / 1.31
(GEO_GEOM_POINTINSIDEPOINTLIST_P_02 ...).....1468 / 1.16
(GEO_GEOM_POINTINSIDEPOINTLIST_P_01 ...).....1656 / 1.03
(GEO_GEOM_POINTINSIDEPOINTLIST_P P L)........1703 / 1.00 <slowest>
And here's compiled with the 940 point list and replacing your '(lambda with (function (lambda.Elapsed milliseconds / relative speed for 2048 iteration(s):
(PTINPOLY_P1 P L)............................1125 / 2.75 <fastest>
(PTINPOLY_P2 P L)............................1187 / 2.61
(PTINPOLY_P3 P L)............................1187 / 2.61
(GEO_GEOM_POINTINSIDEPOINTLIST_P_02 ...).....2375 / 1.30
(GEO_GEOM_POINTINSIDEPOINTLIST_P_01 ...).....3078 / 1.01
(GEO_GEOM_POINTINSIDEPOINTLIST_P P L)........3094 / 1.00 <slowest>
(setq lstC '((629.78 294.034 0.0) (1964.78 1162.32 0.0) (2507.46 907.264 0.0) (2936.18 147.51 0.0) (2219.84 -623.098 0.0) (1036.79 -557.976 0.0) (249.903 -699.074 0.0) (249.903 -281.209 0.0) (1015.08 -281.209 0.0) (917.402 -37.002 0.0) (92.5253 28.1198 0.0) (92.5253 266.9 0.0)))
(setq pt '(570.085 -112.977 0.0))
Benchmarking .......... elapsed milliseconds / relative timing <32768 iterations>
(GEO_GEOM_POINTINSIDEPOINTLIST_P_02 PT LSTC) ..... 500 / 1.56 <fastest>
(GEO_GEOM_POINTINSIDEPOINTLIST_P PT LSTC) ........ 516 / 1.51
(PTINPOLY_P1 PT LSTC) ............................ 531 / 1.47
(GEO_GEOM_POINTINSIDEPOINTLIST_P_01 PT LSTC) ..... 531 / 1.47
(PTINPOLY_P3 PT LSTC) ............................ 672 / 1.16
(PTINPOLY_P2 PT LSTC) ............................ 735 / 1.06
(VK_ISPOINTINSIDE PT LSTC) ....................... 781 / 1.00 <slowest>
Benchmarking .......... elapsed milliseconds / relative timing <2048 iterations>
(PTINPOLY_P1 P L) ............................. 1469 / 39.81 <fastest>
(GEO_GEOM_POINTINSIDEPOINTLIST_P_02 P L) ...... 2125 / 27.52
(GEO_GEOM_POINTINSIDEPOINTLIST_P P L) ......... 2375 / 24.63
(GEO_GEOM_POINTINSIDEPOINTLIST_P_01 P L) ...... 2422 / 24.15
(PTINPOLY_P3 P L) ............................. 2750 / 21.27
(PTINPOLY_P2 P L) ............................. 2890 / 20.24
(VK_ISPOINTINSIDE P L) ....................... 58485 / 1.00 <slowest>
Benchmarking .......... elapsed milliseconds / relative timing <2048 iterations>
(PTINPOLY_P1 P L) ............................ 1297 / 1.93 <fastest>
(GEO_GEOM_POINTINSIDEPOINTLIST_P P L) ........ 1953 / 1.28
(GEO_GEOM_POINTINSIDEPOINTLIST_P_01 P L) ..... 2078 / 1.20
(GEO_GEOM_POINTINSIDEPOINTLIST_P_02 P L) ..... 2188 / 1.14
(PTINPOLY_P3 P L) ............................ 2453 / 1.02
(PTINPOLY_P2 P L) ............................ 2500 / 1.00 <slowest>
(defun inside_p (:p :Lst / remote_p cross)
(setq remote_p (mapcar '+ '(1.0 1.0 0) (getvar "extmax")))
(setq cross 0)
(mapcar
'(lambda (a b)
(if (inters :p remote_p a b) (setq cross (1+ cross)))
)
:Lst (cdr :Lst)
)
(= 1 (rem cross 2))
)
(defun approxpoly (en / px fe)
(setq px (* 0.75 (acet-geom-pixel-unit))
fe (acet-list-remove-adjacent-dups
(acet-geom-object-point-list en (/ px 2.0)))
)
)
I don't think this will work with self intersecting polylines.
Also what happen If point P is directly on a vertex of the polyline?
What about polylines with arc segments?
Benchmarking .............Elapsed milliseconds / relative speed for 1024 iteration(s):
(PTINPOLY_P1 P L)..........1279 / 1.52 <fastest>
(INSIDE_P P L).............1934 / 1.01
(VK_ISPOINTINSIDE P L).....1950 / 1.00 <slowest>
Further, one must decide whether a point on the polygon's boundary is inside or outside. A standard convention is to say that a point on a left or bottom edge is inside, and a point on a right or top edge is outside. This way, if two distinct polygons share a common boundary segment, then a point on that segment will be in one polygon or the other, but not both at the same time. This avoids a number of problems that might occur, especially in computer graphics displays.
(defun PtInPoly_p1 (p l / i l p1 p2 v wn y)
;; Returns t if point p is strictly to the left of v1->v2 by ymg ;
(defun isleft (p v1 v2 / xp yp)
(setq xp (car p) yp (cadr p))
(minusp (- (* (- (cadr v1) yp) (- (car v2) xp)) (* (- (car v1) xp) (- (cadr v2) yp))))
)
;; Initialize the loop. ;
(setq p1 (car l)
y (cadr p)
wn 0
)
;; Loop through all edges of polygon. ;
(foreach p2 (cdr l)
(if (<= (cadr p1) y)
(if (> (cadr p2) y)
(if (isleft p p1 p2) (setq wn (1+ wn)))
)
(if (<= (cadr p2) y)
(if (not (isleft p p1 p2)) (setq wn (1- wn)))
)
)
(setq p1 p2)
)
(not (zerop wn));; Returns t if wn not equal to zero. ;
)
; // loop through all edges of the polygon
; for (int i=0; i<n; i++) { // edge from V[i] to V[i+1]
; if (V[i].y <= P.y) { // start y <= P.y
; if (V[i+1].y > P.y) // an upward crossing
; if (isLeft( V[i], V[i+1], P) > 0) // P left of edge
; ++wn; // have a valid up intersect
; }
; else { // start y > P.y (no test needed)
; if (V[i+1].y <= P.y) // a downward crossing
; if (isLeft( V[i], V[i+1], P) < 0) // P right of edge
; --wn; // have a valid down intersect
; }
; }
; return wn;
;}
(defun listpol (en / i p l)
(setq i (if (vlax-curve-IsClosed en)
(vlax-curve-getEndParam en)
(+ (vlax-curve-getEndParam en) 1)
)
)
(while (setq p (vlax-curve-getPointAtParam en (setq i (1- i))))
(setq l (cons (trans p 0 1 ) l))
)
)
(defun c:test (/ en l p)
(princ "\nSelect Polyline Under Test: ")
(setq en (car (entsel))
l (listpol en)
l (cons (last l) l)
)
(setvar 'PDSIZE -1.5)
(while (setq p (getpoint "\nPick a Point: "))
(if (ptinpoly_p1 p l)
(entmakex (list (cons 0 "POINT") (cons 10 p) (cons 62 1)))
(entmakex (list (cons 0 "POINT") (cons 10 p) (cons 62 7)))
)
)
(princ)
)
(defun PtInPoly_p5 (p l / i l p1 p2 v wn y)
;; Returns t if point p is strictly to the left of v1->v2 by ymg ;
(defun isleft (p v1 v2 / xp yp)
(setq xp (car p) yp (cadr p))
(- (* (- (cadr v1) yp) (- (car v2) xp)) (* (- (car v1) xp) (- (cadr v2) yp)))
)
;; Initialize the loop. ;
(setq p1 (car l)
y (cadr p)
wn 0
)
;; Loop through all edges of polygon. ;
(foreach p2 (cdr l)
(if (<= (cadr p1) y)
(if (> (cadr p2) y)
(if (> (isleft p p1 p2) 0) (setq wn (1+ wn)))
)
(if (<= (cadr p2) y)
(if (< (isleft p p1 p2) 0) (setq wn (1- wn)))
)
)
(setq p1 p2)
)
(not (zerop wn));; Returns t if wn not equal to zero. ;
)
(setq ptLst '((0.0 0.0 0.0) (104.0 0.0 0.0) (104.0 72.0 0.0) (0.0 72.0 0.0)))
(GEO_GEOM_POINTINSIDEPOINTLIST_P '(1.0 1.0 0.0) ptLst) => T
(PtInPoly_p1 '(1.0 1.0 0.0) ptLst) => T
(PtInPoly_p2 '(1.0 1.0 0.0) ptLst) => T
(PtInPoly_p3 '(1.0 1.0 0.0) ptLst) => T
(PtInPoly_p5 '(1.0 1.0 0.0) ptLst) => nil
(GEO_GEOM_POINTINSIDEPOINTLIST_P '(-1.0 0.0 0.0) ptLst) => nil
(PtInPoly_p1 '(-1.0 0.0 0.0) ptLst) => T
(PtInPoly_p2 '(-1.0 0.0 0.0) ptLst) => T
(PtInPoly_p3 '(-1.0 0.0 0.0) ptLst) => T
(PtInPoly_p5 '(-1.0 0.0 0.0) ptLst) => nil
(setq ptLst '((0.0 0.0 0.0) (104.0 0.0 0.0) (104.0 72.0 0.0) (0.0 72.0 0.0)))
(setq ptLstAlt '((0.0 0.0 0.0) (104.0 0.0 0.0) (104.0 72.0 0.0) (0.0 72.0 0.0) (0.0 0.0 0.0)))
(GEO_GEOM_POINTINSIDEPOINTLIST_P '(1.0 1.0 0.0) ptLst) => T
(PtInPoly_p1 '(1.0 1.0 0.0) ptLstAlt) => T
(PtInPoly_p2 '(1.0 1.0 0.0) ptLstAlt) => T
(PtInPoly_p3 '(1.0 1.0 0.0) ptLstAlt) => T
(PtInPoly_p5 '(1.0 1.0 0.0) ptLstAlt) => T
(vk_IsPointInside '(1.0 1.0 0.0) ptLstAlt) => T
(GEO_GEOM_POINTINSIDEPOINTLIST_P '(-1.0 0.0 0.0) ptLst) => nil
(PtInPoly_p1 '(-1.0 0.0 0.0) ptLstAlt) => nil
(PtInPoly_p2 '(-1.0 0.0 0.0) ptLstAlt) => nil
(PtInPoly_p3 '(-1.0 0.0 0.0) ptLstAlt) => nil
(PtInPoly_p5 '(-1.0 0.0 0.0) ptLstAlt) => nil
(vk_IsPointInside '(-1.0 0.0 0.0) ptLstAlt) => nil
benchmark '((approxpoly en 0.001) (tracepline en 0.11765)))
Benchmarking .....Elapsed milliseconds / relative speed for 4 iteration(s):
(TRACEPLINE EN 0.11765).....1466 / 1.10 <fastest>
(APPROXPOLY EN 0.001).......1606 / 1.00 <slowest>
...:)
By the way I like your illustration and poly a lot!!!
ymg
((and (zerop y1) (> x1 0)) (if (> y2 0) (setq w (+ w 0.5)) (setq w (- w 0.5))))
((and (zerop y2) (> x2 0)) (if (minusp y1) (setq w (+ w 0.5)) (setq w (- w 0.5))))
(setq b1 (append b1 (list (car b1))))
(setq tp1 (append b1 tp1))
(benchmark '((tracepline en 0.667)(tracepline2 en 0.001) (acet-list-remove-adjacent-dups (acet-geom-object-point-list en 0.001))))
Benchmarking ...............Elapsed milliseconds / relative speed for 4096 iteration(s):
(TRACEPLINE2 EN 0.001)........................1966 / 6.96 <fastest>
(ACET-LIST-REMOVE-ADJACENT-DUPS (ACE...)......3416 / 4.01
(TRACEPLINE EN 0.667)........................13682 / 1.00 <slowest>
_$ (length (TRACEPLINE2 EN 0.001))
127
_$ (length (acet-list-remove-adjacent-dups (acet-geom-object-point-list en 0.001)))
130
_$ (length (TRACEPLINE EN 0.667))
127
...able to define the tolerance in terms of the maximum sagitta allowed between the segment and the curve.Code - Auto/Visual Lisp: [Select]
...
Another disadvantage to it is that we always interpolate. Thus our resulting point list is always smaller than the original polyline.
I suggest add the closest point into pointlist , it can reduce a lot of points builded .
To judge a point location with a polygon I used following functions :
Function1
.......
.......
function2
.......
.......
function3 widding number method
.......
.......