mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
defining methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5dad18386e
commit
8fbffe61cc
2 changed files with 9 additions and 20 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Jun 20 16:57:19 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* benchmark/bm_app_aobench.rb: use attr_accessor/reader instead of
|
||||
defining methods.
|
||||
|
||||
Thu Jun 20 16:46:46 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* benchmark/bm_app_aobench.rb: added.
|
||||
|
|
|
@ -17,12 +17,7 @@ class Vec
|
|||
@z = z
|
||||
end
|
||||
|
||||
def x=(v); @x = v; end
|
||||
def y=(v); @y = v; end
|
||||
def z=(v); @z = v; end
|
||||
def x; @x; end
|
||||
def y; @y; end
|
||||
def z; @z; end
|
||||
attr_accessor :x, :y, :z
|
||||
|
||||
def vadd(b)
|
||||
Vec.new(@x + b.x, @y + b.y, @z + b.z)
|
||||
|
@ -65,8 +60,7 @@ class Sphere
|
|||
@radius = radius
|
||||
end
|
||||
|
||||
def center; @center; end
|
||||
def radius; @radius; end
|
||||
attr_reader :center, :radius
|
||||
|
||||
def intersect(ray, isect)
|
||||
rs = ray.org.vsub(@center)
|
||||
|
@ -129,10 +123,7 @@ class Ray
|
|||
@dir = dir
|
||||
end
|
||||
|
||||
def org; @org; end
|
||||
def org=(v); @org = v; end
|
||||
def dir; @dir; end
|
||||
def dir=(v); @dir = v; end
|
||||
attr_accessor :org, :dir
|
||||
end
|
||||
|
||||
class Isect
|
||||
|
@ -143,14 +134,7 @@ class Isect
|
|||
@n = Vec.new(0.0, 0.0, 0.0)
|
||||
end
|
||||
|
||||
def t; @t; end
|
||||
def t=(v); @t = v; end
|
||||
def hit; @hit; end
|
||||
def hit=(v); @hit = v; end
|
||||
def pl; @pl; end
|
||||
def pl=(v); @pl = v; end
|
||||
def n; @n; end
|
||||
def n=(v); @n = v; end
|
||||
attr_accessor :t, :hit, :pl, :n
|
||||
end
|
||||
|
||||
def clamp(f)
|
||||
|
|
Loading…
Reference in a new issue