<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic PolyOperations_Example.gsm details in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/PolyOperations-Example-gsm-details/m-p/247980#M11251</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;Hi Graphisoft!&lt;BR /&gt;
I'm working with exciting PolyOperations_Example object. Cutting polygon with halfplane works fine but when the halfplane is vertical I am in trouble:&lt;BR /&gt;
what parameters ca,cb and cc should be used in that case?&lt;BR /&gt;
&lt;BR /&gt;
 ca,cb and cc are calculated from the endpoints of the cutting line x1,y1,x2,y2&lt;BR /&gt;
&lt;BR /&gt;
if abs(x2-x1)&amp;gt;.001 then &lt;BR /&gt;
k=(y2-y1)/(x2-x1)&lt;BR /&gt;
&lt;BR /&gt;
!		Defining inequality for the half plane: ca * x + cb * y &amp;gt; cc&lt;BR /&gt;
!		line equation&lt;BR /&gt;
!		     y-y1&amp;gt;k*(x-x1)&lt;BR /&gt;
!		&amp;lt;=&amp;gt; -k*x+y&amp;gt;-k*x1+y1&lt;BR /&gt;
k=(y2-y1)/(x2-x1)&lt;BR /&gt;
ca=-k&lt;BR /&gt;
cb=1&lt;BR /&gt;
cc=(y1-k*x1)&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
code:&lt;BR /&gt;
......&lt;BR /&gt;
! ==============================================================================&lt;BR /&gt;
! Cut "poly3" with halfplane&lt;BR /&gt;
! ==============================================================================&lt;BR /&gt;
&lt;BR /&gt;
PREPAREFUNCTION  ch, "HalfPlaneParams", "", ca, cb, cc&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
dim resPolyIDArray[]&lt;BR /&gt;
numPoly = CALLFUNCTION (ch, "PolyCut", "poly3", resPolyIDArray)&lt;BR /&gt;
....&lt;/T&gt;&lt;/DIV&gt;</description>
    <pubDate>Sat, 21 Feb 2015 11:51:15 GMT</pubDate>
    <dc:creator>Pertti Paasky</dc:creator>
    <dc:date>2015-02-21T11:51:15Z</dc:date>
    <item>
      <title>PolyOperations_Example.gsm details</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/PolyOperations-Example-gsm-details/m-p/247980#M11251</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;Hi Graphisoft!&lt;BR /&gt;
I'm working with exciting PolyOperations_Example object. Cutting polygon with halfplane works fine but when the halfplane is vertical I am in trouble:&lt;BR /&gt;
what parameters ca,cb and cc should be used in that case?&lt;BR /&gt;
&lt;BR /&gt;
 ca,cb and cc are calculated from the endpoints of the cutting line x1,y1,x2,y2&lt;BR /&gt;
&lt;BR /&gt;
if abs(x2-x1)&amp;gt;.001 then &lt;BR /&gt;
k=(y2-y1)/(x2-x1)&lt;BR /&gt;
&lt;BR /&gt;
!		Defining inequality for the half plane: ca * x + cb * y &amp;gt; cc&lt;BR /&gt;
!		line equation&lt;BR /&gt;
!		     y-y1&amp;gt;k*(x-x1)&lt;BR /&gt;
!		&amp;lt;=&amp;gt; -k*x+y&amp;gt;-k*x1+y1&lt;BR /&gt;
k=(y2-y1)/(x2-x1)&lt;BR /&gt;
ca=-k&lt;BR /&gt;
cb=1&lt;BR /&gt;
cc=(y1-k*x1)&lt;BR /&gt;
endif&lt;BR /&gt;
&lt;BR /&gt;
code:&lt;BR /&gt;
......&lt;BR /&gt;
! ==============================================================================&lt;BR /&gt;
! Cut "poly3" with halfplane&lt;BR /&gt;
! ==============================================================================&lt;BR /&gt;
&lt;BR /&gt;
PREPAREFUNCTION  ch, "HalfPlaneParams", "", ca, cb, cc&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
dim resPolyIDArray[]&lt;BR /&gt;
numPoly = CALLFUNCTION (ch, "PolyCut", "poly3", resPolyIDArray)&lt;BR /&gt;
....&lt;/T&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 21 Feb 2015 11:51:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/PolyOperations-Example-gsm-details/m-p/247980#M11251</guid>
      <dc:creator>Pertti Paasky</dc:creator>
      <dc:date>2015-02-21T11:51:15Z</dc:date>
    </item>
  </channel>
</rss>

