VS:PtInPoly: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
(Fails on poly line segments whose type is not corner)
m (fix autocorrect :))
Line 36: Line 36:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark>
([[User:CBM-c-_| _c_]] 2021.12.27): This only works on polygons or segments of poly lines whose vetex type is corner. Any point on poly segments with other vertex type (bezier, arc, radius, cubi) will return fall.
([[User:CBM-c-_| _c_]] 2021.12.27): This only works on polygons or segments of polylines whose vertex type is corner. Any point on poly segments with other vertex type (bezier, arc, radius, cubi) will return false.
</remark>
</remark>



Revision as of 16:27, 27 December 2021

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Function PtInPoly returns TRUE if the point specified point lies within, or on, the referenced polygon or polyline object.

FUNCTION PtInPoly(
pX,pY :REAL;
h :HANDLE) : BOOLEAN;
def vs.PtInPoly(p, h):
    return BOOLEAN

Parameters

p REAL X-Y coordinate point.
h HANDLE Handle to polygon.

Remarks

( _c_ 2021.12.27): This only works on polygons or segments of polylines whose vertex type is corner. Any point on poly segments with other vertex type (bezier, arc, radius, cubi) will return false.

Example

VectorScript

PROCEDURE Example;
VAR
polyHandle :HANDLE;
locusHandle :HANDLE;
x, y :REAL;
BEGIN
CallTool(-204); polyHandle := FSActLayer;
CallTool(-221); locusHandle := FSActLayer;
GetLocPt(locusHandle, x, y);
Message(PtInPoly(x, y, polyHandle));
END;
RUN(Example);

Python


Version

Availability: from All Versions