VTK/Using JRuby: Difference between revisions

From KitwarePublic
< VTK
Jump to navigationJump to search
mNo edit summary
m (Reverted edits by EhiDts (Talk); changed back to last version by Zack)
 
Line 1: Line 1:
[http://mrsrl.stanford.edu/seminar/detailview.php?event_id=281 polyphonic ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=32 buy lipitor] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=24 free free ringtones] [http://climate.msrc.sunysb.edu/1984/messages/333.html phentermine online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=57 sagem ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=75 free ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=302 buy ultracet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=276 buy ortho] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=308 buy vigrx] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,33 nexium] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,28 meridia online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=291 sharp ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=42 free music ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,20 cheap diazepam] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=11 cheap carisoprodol] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=75 but wellbutrin] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=36 cheap meridia] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,23 free free ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,57 buy xanax] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=270 free mtv ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=251 cheap fioricet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=269 free mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=273 nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/288.html adipex online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=311 cheap xanax] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,41 sagem ringtones] [http://climate.msrc.sunysb.edu/1984/messages/302.html diazepam online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=244 cheap clonazepam] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,39 polyphonic ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=45 carisoprodol online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=309 wellbutrin online] [http://climate.msrc.sunysb.edu/1984/messages/313.html free kyocera ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-225502801748.html ativan online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=73 viagra online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,27 lorazepam online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=48 cheap ultram] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=30 kyocera ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,10 alprazolam online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=234 free alltel ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=57 ambien online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=74 cheap vicodin] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,30 motorola ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=62 free sony ericsson ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=53 free punk ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=51 buy viagra] [http://www.bc.edu/apps/bookstore/cards/jun7-224422412742.html but phentermine] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=46 xanax online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=70 ultram online] [http://www.bc.edu/apps/bookstore/cards/jun7-224362564176.html valium online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,17 cingular ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,8 adipex online] [http://climate.msrc.sunysb.edu/1984/messages/301.html cyclobenzaprine online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=51 propecia online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=298 cheap tenuate] [http://www.bc.edu/apps/bookstore/cards/jun7-224512777320.html carisoprodol online] [http://climate.msrc.sunysb.edu/1984/messages/353.html cheap ultracet] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=72 pharmacy online online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=76 free wwe ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=18 diazepam online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=312 xenical online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=45 free nokia ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=285 free qwest ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=79 zanaflex online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=247 cheap diazepam] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=305 free verizon ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-226682379944.html free motorola ringtones] [http://climate.msrc.sunysb.edu/1984/messages/318.html order lortab] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=62 prozac online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=21 free ericsson ringtones] [http://climate.msrc.sunysb.edu/1984/messages/330.html ortho] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,19 cyclobenzaprine online] [http://climate.msrc.sunysb.edu/1984/messages/295.html cheap celexa] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=253 free free ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=49 phentermine online] [http://climate.msrc.sunysb.edu/1984/messages/300.html free cool ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=52 cheap prozac] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,44 free qwest ringtones] [http://climate.msrc.sunysb.edu/1984/messages/296.html cheap cialis] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=297 sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=60 nexium online] [http://climate.msrc.sunysb.edu/1984/messages/339.html free real ringtones] [http://climate.msrc.sunysb.edu/1984/messages/341.html sagem ringtones] [http://climate.msrc.sunysb.edu/1984/messages/351.html free tracfone ringtones] [http://climate.msrc.sunysb.edu/1984/messages/328.html free nokia ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=284 punk ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-226172687200.html mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=295 sony ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,12 buy ativan] [http://climate.msrc.sunysb.edu/1984/messages/309.html but hgh] [http://climate.msrc.sunysb.edu/1984/messages/320.html free midi ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=7 free alltel ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=23 cheap flexeril] [http://climate.msrc.sunysb.edu/1984/messages/346.html sony ericsson ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=39 free motorola ringtones] [http://climate.msrc.sunysb.edu/1984/messages/359.html cheap vicodin] [http://www.bc.edu/apps/bookstore/cards/jun7-226062830562.html free tracfone ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=42 soma online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=260 levitra online] [http://climate.msrc.sunysb.edu/1984/messages/322.html motorola ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=19 didrex online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=84 cheap sildenafil] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=48 pharmacy online online] [http://climate.msrc.sunysb.edu/1984/messages/366.html cheap zoloft] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=257 cheap hydrocodone] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=63 sony ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=82 cingular ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=306 viagra online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=47 buy paxil] [http://climate.msrc.sunysb.edu/1984/messages/292.html ambien online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=264 lortab online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=28 cheap hydrocodone] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=85 vigrx online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=10 cheap ativan] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=26 hgh online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=63 cheap sildenafil] [http://climate.msrc.sunysb.edu/1984/messages/358.html buy viagra] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=71 buy ortho] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=44 free nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/316.html lisinopril online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,24 funny ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,46 free sony ericsson ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=307 buy vicodin] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,25 but hydrocodone] [http://climate.msrc.sunysb.edu/1984/messages/293.html ativan online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=38 free mono ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,18 clonazepam] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=31 online levitra] [http://climate.msrc.sunysb.edu/1984/messages/349.html sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=49 cheap cialis] [http://climate.msrc.sunysb.edu/1984/messages/347.html free sony ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,26 levitra online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=313 cheap zanaflex] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=44 cheap phentermine] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=12 order celexa] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=69 order ultracet] [http://climate.msrc.sunysb.edu/1984/messages/362.html wwe ringtones] [http://climate.msrc.sunysb.edu/1984/messages/343.html free sharp ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,36 norco online] [http://climate.msrc.sunysb.edu/1984/messages/345.html soma] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=61 cheap ultracet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=242 cingular ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=232 cheap adipex] [http://climate.msrc.sunysb.edu/1984/messages/364.html cheap xenical] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=6 order albuterol] [http://climate.msrc.sunysb.edu/1984/messages/350.html tenuate online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=83 ortho online] [http://climate.msrc.sunysb.edu/1984/messages/325.html music ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=288 free sagem ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=262 lisinopril online] [http://climate.msrc.sunysb.edu/1984/messages/319.html cheap meridia] [http://climate.msrc.sunysb.edu/1984/messages/335.html cheap propecia] [http://climate.msrc.sunysb.edu/1984/messages/360.html cheap vigrx] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=20 diethylpropion online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=233 cheap albuterol] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=40 free mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=265 meridia online] [http://climate.msrc.sunysb.edu/1984/messages/307.html free free ringtones] [http://climate.msrc.sunysb.edu/1984/messages/354.html cheap ultram] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=61 soma online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=35 cheap lortab] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=292 cheap sildenafil] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,34 free nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/317.html cheap lorazepam] [http://climate.msrc.sunysb.edu/1984/messages/308.html free funny ringtones] [http://climate.msrc.sunysb.edu/1984/messages/368.html buy diethylpropion] [http://www.bc.edu/apps/bookstore/cards/jun7-226002359520.html free free ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=76 funny ringtones] [http://climate.msrc.sunysb.edu/1984/messages/297.html cingular ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-224302380012.html cheap soma] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=274 nokia ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=55 clonazepam online] [http://climate.msrc.sunysb.edu/1984/messages/367.html cheap zyban] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=64 cheap clomid] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=283 prozac online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,53 valium] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=33 lisinopril online] [http://www.bc.edu/apps/bookstore/cards/jun7-225692379850.html meridia online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=41 tramadol online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=60 free sharp ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=266 free midi ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=252 cheap flexeril] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=55 real ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=240 cheap celexa] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=314 cheap zoloft] [http://climate.msrc.sunysb.edu/1984/messages/327.html nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/304.html free ericsson ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,32 music ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=41 free mtv ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,52 order ultram] [http://climate.msrc.sunysb.edu/1984/messages/356.html buy valium] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,55 cheap viagra] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=58 lorazepam online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=13 cheap cialis] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,38 phentermine online] [http://climate.msrc.sunysb.edu/1984/messages/326.html nexium online] [http://www.bc.edu/apps/bookstore/cards/jun7-226732674842.html samsung ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-225822801712.html norco online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=52 cheap meridia] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,48 sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=74 buy rivotril] = Introduction =
= Introduction =


JRuby is an implementation of a Ruby interpreter in the Java language.  JRuby makes Java classes available for use from the Ruby language, and this includes natively-implemented Java classes, such as the Java bindings for VTK.  This page provides some information about using VTK with JRuby via its Java bindings.
JRuby is an implementation of a Ruby interpreter in the Java language.  JRuby makes Java classes available for use from the Ruby language, and this includes natively-implemented Java classes, such as the Java bindings for VTK.  This page provides some information about using VTK with JRuby via its Java bindings.

Latest revision as of 14:53, 12 June 2007

Introduction

JRuby is an implementation of a Ruby interpreter in the Java language. JRuby makes Java classes available for use from the Ruby language, and this includes natively-implemented Java classes, such as the Java bindings for VTK. This page provides some information about using VTK with JRuby via its Java bindings.

This page is just a quick introduction to document initial work in this area. It is intended to be extended as time progresses. Please contribute!

Setup

VTK Java Bindings

Initially, you will need to compile VTK with Java bindings enabled. Make sure you have the Cone.java tutorial example (available in the Examples/Tutorial/Step1/Java directory) working before proceeding.

TODO: Add more information on compiling the Java bindings.

CLASSPATH and Shared Library Setup

You will need to make sure that your CLASSPATH environment variable includes vtk.jar, otherwise JRuby will not be able to find any of the Java bindings for VTK. You will further need to ensure that your environment is set up so that Java can find any of the shared libraries required for the Java bindings. Under the *nix environment, this is typically achieved by setting the LD_LIBRARY_PATH environment variable.

Example Code

The following example is a translation of the Cone.java tutorial example to run in JRuby. If you have the Java bindings for VTK compiled, and your JRuby CLASSPATH and shared libraries are properly configured then this example should run.

#
# This example creates a polygonal model of a cone, and then renders it to
# the screen.  It will rotate the cone 360 degrees and then exit.  The basic
# setup of source -> mapper -> actor -> renderer -> renderwindow is typical
# of most VTK programs.
# 
# Modified for JRuby from the Java Step1 tutorial example.
# 
# Jonathan Merritt, January 2006.
# 

# We include Java to begin with, so that JRuby can utilise the Java bindings
# to VTK.
require 'java'

# Load JNI libraries via the java.lang.System class.  The libraries must be
# in your path to work.
System = java.lang.System
System.loadLibrary 'vtkCommonJava'
System.loadLibrary 'vtkFilteringJava'
System.loadLibrary 'vtkIOJava'
System.loadLibrary 'vtkImagingJava'
System.loadLibrary 'vtkGraphicsJava'
System.loadLibrary 'vtkRenderingJava'

# Ruby likes its classes to start with capital letters, so here we include
# all required Java classes with capital letters.  There may be a better
# (or at least automated) way to do this.
include_class('vtk.vtkConeSource')     { 'VTKConeSource' }
include_class('vtk.vtkPolyDataMapper') { 'VTKPolyDataMapper' }
include_class('vtk.vtkActor')          { 'VTKActor' }
include_class('vtk.vtkRenderer')       { 'VTKRenderer' }
include_class('vtk.vtkRenderWindow')   { 'VTKRenderWindow' }

# Create an instance of vtkConeSource, and set some of its parameters.
# Ruby doesn't require parentheses around single-argument methods.
cone = VTKConeSource.new
cone.SetHeight     3.0
cone.SetRadius     1.0
cone.SetResolution 10.0

# Map the cone polygon information into graphics primitives.
cone_mapper = VTKPolyDataMapper.new
cone_mapper.SetInputConnection cone.GetOutputPort

# Create an actor to represent the cone.
cone_actor = VTKActor.new
cone_actor.SetMapper cone_mapper

# Create the renderer and assign actors to it.
ren1 = VTKRenderer.new
ren1.AddActor cone_actor
ren1.SetBackground(0.1, 0.2, 0.4)

# Finally, create the render window that will show up on the screen.
ren_win = VTKRenderWindow.new
ren_win.AddRenderer ren1
ren_win.SetSize(300, 300)

# Now we loop over 360 degrees and render the cone each time.
360.times do
  ren_win.Render                   # Render the image
  ren1.GetActiveCamera.azimuth 1   # Rotate active camera by 1 deg
end

Gotchas

Some important notes:

  1. Use java.lang.System.LoadLibrary() to load the native libraries required by VTK's Java bindings.
  2. Ruby likes its classes to start with capital letters. Hence, when importing VTK classes, make sure you change their names so that they start with a capital letter.



VTK: [Welcome | Site Map]