Point inside a closed Polyline

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
avimms
Posts: 13
Joined: 06 Dec 2005, 09:57
Location: India

Point inside a closed Polyline

Post by avimms » 07 Dec 2007, 08:03

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

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 07 Dec 2007, 16:33

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

Post Reply