lib/shattered_ogrerb/vector.rb in shattered_ogrerb-0.5.0.2 vs lib/shattered_ogrerb/vector.rb in shattered_ogrerb-0.5.1
- old
+ new
@@ -80,24 +80,25 @@
class Vector3
# Iterate through x, y and z with a block. The passed value is the value of each component of
# the vector.
def each(&block)
- self.to_a.each do |component|
+ [x,y,z].each do |component|
yield component
end
end
# Returns self
def to_v
self
end
- # Returns an array with x, y and z dumped into its elements.
+ # Returned an array with x, y and z dumped into its elements.
# v(1, 2, 3).to_a #=> [1.0, 2.0, 3.0]
- def to_a
- [x, y, z]
- end
+ # Deprecated because *v(0,0,0) is [0,0,0] (three arguments) and breaks DSLs
+ #def to_a
+ # raise "Vector#to_a is deprecated. Use vectors as vectors, not as arrays."
+ #end
# Add 2 Vectors together.
# v(1,1,1) + v(1,2,3) #=> v(2,3,4)
alias_method :ogre_plus, :+
def +(*args)
\ No newline at end of file