Anonymous user
Talk:Sutherland-Hodgman polygon clipping: Difference between revisions
Talk:Sutherland-Hodgman polygon clipping (view source)
Revision as of 19:31, 19 August 2011
, 12 years ago→Ruby: new section
(→Winding: new section) |
(→Ruby: new section) |
||
Line 6:
Implementations probably should be required to test if the clipper is winding clockwise or not. Some of the current code crash if the rectangle is reversed. Testing direction of a convex poly is pretty easy anyway, just checking any one vertex should be enough. --[[User:Ledrug|Ledrug]] 01:23, 7 July 2011 (UTC)
== Ruby ==
With Ruby 1.9, a block parameter must be a local variable.
<pre>$ ruby scratch.rb
scratch.rb:22: formal argument cannot be an instance variable
clipPolygon.each do |@cp2| # WP clipEdge is cp1,cp2 here
^
scratch.rb:26: formal argument cannot be an instance variable
inputList.each do |@e|
^</pre>
[http://rosettacode.org/mw/index.php?title=Sutherland-Hodgman_polygon_clipping&diff=118024&oldid=118006 My change to the Ruby code] fixes it for Ruby 1.9 but keeps it working with Ruby 1.8. --[[User:Kernigh|Kernigh]] 19:31, 19 August 2011 (UTC)
|