Skip to content

Commit

Permalink
Added pretty_print to vector2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-Ouie committed Aug 18, 2011
1 parent 262ab3c commit 237bc82
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ray/vector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ def to_s
"(%g, %g)" % [x, y]
end

def pretty_print(q)
q.text "("
q.pp ("%g" % x).to_f # hides simple-precision inacurracy
q.text ", "
q.pp ("%g" % y).to_f
q.text ")"
end

alias :w :x
alias :h :y

Expand Down

0 comments on commit 237bc82

Please sign in to comment.