def surface( value, options={} )
opacity = false
color = false
axes = false
options.each{ |key, val|
case key
when 'opacity'
opacity = val
when 'color'
color = val
if !(Array === color) || color.length != 3
raise "color must be Array whose length is three"
end
when 'axes'
axes = val
else
raise "option (#{key}) is invalid"
end
}
surface = Vtk::ContourFilter.new
surface.SetInput( @grid )
surface.SetValue( 0, value )
normals = Vtk::PolyDataNormals.new
normals.SetInput( surface.GetOutput )
mapper = Vtk::PolyDataMapper.new
mapper.SetInput( normals.GetOutput )
mapper.SetScalarModeToUsePointFieldData
actor = Vtk::Actor.new
actor.SetMapper( mapper )
actor.GetProperty.SetOpacity( opacity ) if opacity
actor.GetProperty.SetDiffuseColor( *color ) if color
@ren.AddActor( actor )
draw_axes( surface, axes ) if axes
return nil
end