Point inside a closed Polyline
Moderators: SDS, support, admin
Point inside a closed Polyline
Is there a simplest way to determine whether a given TFPoint lies inside a polyline? I am trying to use PtInRect API by windows to check the same. For this I first construct a rect around the vertices of the polyline and then convert this rect and the TFPoint to 2D point and then call PtInRect. But it seems not to be working. Can you help me.
Regards,
Avinash
Regards,
Avinash
Hello Avinash,
Current version of <b>CAD Import VCL</b> does not contain such functionality.
We suppose that this question can be solved by the followin way:
<ol type="1"><li>Get Box of a polyline.</li>
<li>Get CAD coordinate of the examined point.</li>
<li>Create a line: start point - CAD coordinate of the examined point, end point - move vertically or horizontal start point to the Box border + (or - ) 1.</li>
<li>Use consecutively function GetIntersectingPoint to count number of intersections: first input parameter - line, second - pairs of polyline points (segments).</li>
<li>Point belongs to a polyline area ff intersections number is even. And vice versa.</li></ol id="1">
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
Current version of <b>CAD Import VCL</b> does not contain such functionality.
We suppose that this question can be solved by the followin way:
<ol type="1"><li>Get Box of a polyline.</li>
<li>Get CAD coordinate of the examined point.</li>
<li>Create a line: start point - CAD coordinate of the examined point, end point - move vertically or horizontal start point to the Box border + (or - ) 1.</li>
<li>Use consecutively function GetIntersectingPoint to count number of intersections: first input parameter - line, second - pairs of polyline points (segments).</li>
<li>Point belongs to a polyline area ff intersections number is even. And vice versa.</li></ol id="1">
Sergey.
Please post questions to the forum or write to support@cadsofttools.com