Class: MD2::Vertex
- Inherits:
-
Array
- Object
- Array
- MD2::Vertex
- Defined in:
- lib/md2/vertex.rb
Instance Method Summary collapse
-
#initialize(x, y, z) ⇒ Vertex
constructor
A new instance of Vertex.
- #x ⇒ Object
- #x=(x) ⇒ Object
- #y ⇒ Object
- #y=(y) ⇒ Object
- #z ⇒ Object
- #z=(z) ⇒ Object
Constructor Details
#initialize(x, y, z) ⇒ Vertex
Returns a new instance of Vertex.
2 3 4 5 6 7 8 |
# File 'lib/md2/vertex.rb', line 2 def initialize(x, y, z) super() raise ArgumentError, "x is nil" if x.nil? raise ArgumentError, "y is nil" if y.nil? raise ArgumentError, "z is nil" if z.nil? self << x << y << z end |
Instance Method Details
#x ⇒ Object
10 11 12 |
# File 'lib/md2/vertex.rb', line 10 def x self[0] end |
#x=(x) ⇒ Object
22 23 24 |
# File 'lib/md2/vertex.rb', line 22 def x=(x) self[0] = x end |
#y ⇒ Object
14 15 16 |
# File 'lib/md2/vertex.rb', line 14 def y self[1] end |
#y=(y) ⇒ Object
26 27 28 |
# File 'lib/md2/vertex.rb', line 26 def y=(y) self[1] = y end |
#z ⇒ Object
18 19 20 |
# File 'lib/md2/vertex.rb', line 18 def z self[2] end |
#z=(z) ⇒ Object
30 31 32 |
# File 'lib/md2/vertex.rb', line 30 def z=(z) self[2] = z end |