Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Tuesday, 12 May 2009

Nautilus shell using vertex function

Here is sketch produced using 'magic numbers' calculated using a spreadsheet, iffy method but I like the result.

# vert.rb
require 'ruby-processing'
class Vert < Processing::App
        def setup  
                no_fill  
                smooth  
                stroke_weight 4 
                stroke 255, 0, 0 
                background 0 
                begin_shape # begin spiral 'shell' shape
                vertex 202.5, 200 
                vertex 202.07, 202.07 
                vertex 200, 203.42 
                vertex 197.17, 202.83 
                vertex 195.31, 200 
                vertex 196.12, 196.12 
                vertex 200, 193.58 
                vertex 205.31, 194.69 
                vertex 208.78, 200 
                vertex 207.27, 207.27 
                vertex 200, 212.03 
                vertex 190.05, 209.95 
                vertex 183.53, 200 
                vertex 186.38, 186.38 
                vertex 200, 177.46 
                vertex 218.65, 181.35 
                vertex 230.86, 200 
                vertex 225.54, 225.54 
                vertex 200, 242.26 
                vertex 165.04, 234.96 
                vertex 142.15, 200 
                vertex 152.13, 152.13 
                vertex 200, 120.79 
                vertex 265.53, 134.47 
                vertex 308.44, 200 
                vertex 289.72, 289.72 
                vertex 200, 348.47 
                vertex 77.16, 322.84 
                end_shape  # end spiral 'shell' shape
                stroke_weight 1 # draw the segment lines
                stroke 255         # in lighter color and lighter weight
                line 77.16, 322.84, 165.04, 234.96 
                line 200, 242.26, 200, 348.47 
                line 289.72, 289.72, 225.54, 225.54 
                line 308.44, 200, 230.86, 200 
                line 265.53, 134.47, 218.65, 181.35 
                line 200, 177.46, 200, 120.79 
                line 186.38, 186.38, 152.13, 152.13 
                line 183.53, 200, 142.15, 200 
                line 190.05, 209.95, 165.04, 234.96 
                line 200, 212.03, 200, 242.26 
                line 207.27, 207.27, 225.54, 225.54 
                line 230.86, 200, 208.78, 200 
                line 205.31, 194.69, 218.65, 181.35 
                line 200, 193.58, 200, 177.46 
                line 196.12, 196.12, 186.38, 186.38 
                line 195.31, 200, 183.53, 200 
                line 197.17, 202.83, 190.05, 209.95 
                save_frame "spiral.png" 
        end
end

Vert.new :width => 350, :height => 350, :title => "Nautilus?"


Here is the image, which I think manages that nautilus shell look:-

No comments:

Post a Comment

Followers

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2