Re: [SVG] [Batik] Polygon Area

"[email protected] [svg-developers]" <[email protected]> 06 Nov 2015 14:26:26 -0800
Newsgroups gmane.text.xml.svg.devel
Message-ID <[email protected]>
--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Type:  text/plain;  charset=utf-8 
Content-Transfer-Encoding: base64

VGhlIGNvZGUgYmVsb3cgaXMgSmF2YVNjcmlwdC4gUGFzcyBYIGFuZCBZIGFycmF5cyBvZiB4
IGFuZCB5IHBvaW50cyAoY2xvY2t3aXNlIG9yIGNvdW50ZXJjbG9ja3dpc2UpLCBhbmQgbiBu
dW1iZXIgb2YgdmVydGljZXMuIElmIHlvdSBuZWVkIGl0IGZvciBhIHBhdGggZWxlbWVudCB0
aGUgU1ZHIEphdmFTY3JpcHQgYmluZGluZyBwcm92aWRlcyBkZWRpY2F0ZWQgZnVuY3Rpb25z
IGxpa2UgZ2V0UG9pbnRBdExlbmd0aCgpLCBnZXRQYXRoU2VnQXRMZW5ndGgoKSwgZXRjLiB0
byBjb252ZXJ0IHRoZSBwYXRoIGludG8gcG9seWdvbiBwb2ludHMuIA0KIA0KDQogICAgIGZ1
bmN0aW9uIHBvbHlnb25fYXJlYSAoWCwgWSwgbikgew0KICAgICAgIHZhcg0KDQogICAgICAg
ICBhcmVhID0gMCwNCiAgICAgICAgIGksDQogICAgICAgICBqID0gbiAtIDE7DQogDQoNCiAg
ICAgICBmb3IgKGkgPSAwOyBpIDwgbjsgaiA9IGkrKykgew0KICAgICAgICAgYXJlYSArPSAo
WFtqXSArIFhbaV0pICogKFlbal0gLSBZW2ldKTsNCiAgICAgICB9DQogDQoNCiAgICAgICBy
ZXR1cm4gTWF0aC5hYnMoYXJlYSAvIDIpOw0KICAgICB9DQogDQoNCiBEb21lbmljbw0K

--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit





<head>

<style type="text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title 
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none; 
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html>
<head>
<style type="text/css">
<!--
#ygrp-mkp {
  border: 1px solid #d8d8d8;
  font-family: Arial;
  margin: 10px 0;
  padding: 0 10px;
}

#ygrp-mkp hr {
  border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
  color: #628c2a;
  font-size: 85%;
  font-weight: 700;
  line-height: 122%;
  margin: 10px 0;
}

#ygrp-mkp #ads {
  margin-bottom: 10px;
}

#ygrp-mkp .ad {
  padding: 0 0;
}

#ygrp-mkp .ad p {
  margin: 0;
}

#ygrp-mkp .ad a {
  color: #0000ff;
  text-decoration: none;
}
-->
</style>
</head>
<body>



<!-- |**|begin egp html banner|**| -->

<br><br>

<!-- |**|end egp html banner|**| -->


<div>The code below is JavaScript. Pass X and Y arrays of x and y points (clockwise or counterclockwise), and n number of vertices. If you need it for a path element the SVG JavaScript binding provides dedicated functions like getPointAtLength(), getPathSegAtLength(), etc. to convert the path into polygon points.&nbsp;</div><div><br></div><div>&nbsp; &nbsp; function&nbsp;<span style="word-spacing:normal;line-height:1.25;">polygon_area</span><span style="word-spacing:normal;line-height:1.25;">&nbsp;</span><span style="word-spacing:normal;line-height:1.25;">(X, Y, n) {</span></div><div><span style="word-spacing:normal;line-height:1.25;">&nbsp; &nbsp; &nbsp; var</span><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; area = 0,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; i,</div><div>&nbsp; &nbsp; &nbsp; &
 nbsp; j = n - 1;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; for (i = 0; i &lt; n; j = i++) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; area += (X[j] + X[i]) * (Y[j] - Y[i]);</div><div>&nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; return Math.abs(area / 2);</div><div>&nbsp; &nbsp; }</div><div><br></div><div>Domenico</div>



<!-- |**|begin egp html banner|**| -->

<br>


<br>

<!-- |**|end egp html banner|**| -->


<div width="1" style="color: white; clear: both;"/>__._,_.___</div>

      
  

    
    <div id="fromDMARC" style="clear:both; margin-top: 10px;">
         <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
         Posted by: [email protected]         <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
    </div>
<!-- Start Recommendations -->
<!-- End Recommendations -->


<!-- |**|begin egp html banner|**| -->

<br><br>
<tt>
-----<BR>
To unsubscribe send a message to: [email protected]<BR>
-or-<BR>
visit <a href="http://groups.yahoo.com/group/svg-developers">http://groups.yahoo.com/group/svg-developers</a> and click &quot;edit my membership&quot;<BR>
----</tt>
<br><br>

<!-- |**|end egp html banner|**| -->



<!-- |**|begin egp html banner|**| -->

  <img src="http://geo.yahoo.com/serv?s=97476590/grpId=1298421/grpspId=1706030390/msgId=66496/stime=1446848787" width="1" height="1"> <br>

<!-- |**|end egp html banner|**| -->

  
<!-- |**|begin egp html banner|**| -->

<br>



   
     
 
        <!-- |**|begin egp html banner|**| -->
        <div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

        <span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://groups.yahoo.com/neo/groups/svg-developers/info;_ylc=X3oDMTJlazQ1amRuBF9TAzk3MzU5NzE0BGdycElkAzEyOTg0MjEEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ0Njg0ODc4Nw--" style="text-decoration: none;">Visit Your Group</a></span>

     <ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
            <li style="border-right: 1px solid #000; font-weight: 700; display: inline; padding: 0 5px; margin-left: 0;">
      <span class="cat"><a href="https://groups.yahoo.com/neo/groups/svg-developers/members/all;_ylc=X3oDMTJmbnB0bnBsBF9TAzk3MzU5NzE0BGdycElkAzEyOTg0MjEEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0NDY4NDg3ODc-" style="text-decoration: none;">New Members</a></span>
      <span class="ct" style="color: #ff7900;">1</span>
    </li>
                                              </ul>
  </div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
  <a href="https://groups.yahoo.com/neo;_ylc=X3oDMTJkMDdmaXJmBF9TAzk3NDc2NTkwBGdycElkAzEyOTg0MjEEZ3Jwc3BJZAMxNzA2MDMwMzkwBHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDQ2ODQ4Nzg3" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height="15" width="137" alt="Yahoo! Groups" style="border: 0;"/></a>
  <div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/us/yahoo/groups/details.html" style="text-decoration: none;">Privacy</a> &bull; <a href="mailto:[email protected]?subject=Unsubscribe" style="text-decoration: none;">Unsubscribe</a> &bull; <a href="https://info.yahoo.com/legal/us/yahoo/utos/terms/" style="text-decoration: none;">Terms of Use</a> </div>
</div>

<!-- |**|end egp html banner|**| -->

  </div> <!-- ygrp-msg -->

   


  <br>

<!-- |**|end egp html banner|**| -->


<div style="color: white; clear: both;"/>__,_._,___</div>
</body>

</html>

--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV--