Class: Face
- Inherits:
-
Object
- Object
- Face
- Defined in:
- lib/glitch3d/objects/face.rb
Instance Attribute Summary collapse
-
#v1 ⇒ Object
Returns the value of attribute v1.
-
#v2 ⇒ Object
Returns the value of attribute v2.
-
#v3 ⇒ Object
Returns the value of attribute v3.
Instance Method Summary collapse
- #fuck(new_vertex) ⇒ Object
-
#initialize(v1, v2, v3) ⇒ Face
constructor
A new instance of Face.
- #rand_attr ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(v1, v2, v3) ⇒ Face
Returns a new instance of Face.
5 6 7 8 9 |
# File 'lib/glitch3d/objects/face.rb', line 5 def initialize(v1, v2, v3) @v1 = v1 @v2 = v2 @v3 = v3 end |
Instance Attribute Details
#v1 ⇒ Object
Returns the value of attribute v1.
3 4 5 |
# File 'lib/glitch3d/objects/face.rb', line 3 def v1 @v1 end |
#v2 ⇒ Object
Returns the value of attribute v2.
3 4 5 |
# File 'lib/glitch3d/objects/face.rb', line 3 def v2 @v2 end |
#v3 ⇒ Object
Returns the value of attribute v3.
3 4 5 |
# File 'lib/glitch3d/objects/face.rb', line 3 def v3 @v3 end |
Instance Method Details
#fuck(new_vertex) ⇒ Object
20 21 22 |
# File 'lib/glitch3d/objects/face.rb', line 20 def fuck(new_vertex) send("#{rand_attr}=", new_vertex) end |
#rand_attr ⇒ Object
16 17 18 |
# File 'lib/glitch3d/objects/face.rb', line 16 def rand_attr [:v1, :v2, :v3].sample end |
#to_s ⇒ Object
11 12 13 14 |
# File 'lib/glitch3d/objects/face.rb', line 11 def to_s return nil unless !v1.nil? && !v2.nil? && !v3.nil? "f #{v1.index} #{v2.index} #{v3.index}" end |