VS:GetPtInPoly: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 17:34, 13 August 2008

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

Description

Finds a point inside a polyline. The point is found by the following method: draw a line from the HCenter of the poly to the centroid. Find all of the intersections between this line and the poly. Use the two intersections closest to the centroid. Average them, and return the result.

FUNCTION GetPtInPoly(
h :HANDLE) VECTOR;
def vs.GetPtInPoly(h):
    return VECTOR

Parameters

h HANDLE

Example

PROCEDURE Example;
VAR
   h :HANDLE;
   p :VECTOR;
BEGIN
   h := FSActLayer;
   IF h = NIL THEN
      AlrtDialog('Select a polyline object')
   ELSE BEGIN
      p := GetPtInPoly(h);
      Locus(p.x, p.y);
   END;
END;
RUN(Example);

Version

Availability: from All Versions

This is drop-in function.