Class: Vamp::Ply::Cube

Inherits:
PlyObject show all
Defined in:
lib/vamp/ply/cube.rb

Instance Attribute Summary

Attributes inherited from PlyObject

#polygons, #vertices

Instance Method Summary collapse

Methods inherited from PlyObject

#add_polygon, #add_vertex, #to_s

Constructor Details

#initialize(file, number = 31) ⇒ Cube

Returns a new instance of Cube.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vamp/ply/cube.rb', line 9

def initialize(file, number = 31)
  super()
  @file = file
  @number = number
  add_vertex(1, 1, 1)
  add_vertex(-1, 1, 1)
  add_vertex(1, -1, 1)
  add_vertex(1, 1, -1)
  add_vertex(1, -1, -1)
  add_vertex(-1, -1, 1)
  add_vertex(-1, 1, -1)
  add_vertex(-1, -1, -1)
  add_polygon(0, 1, 5, 2)
  add_polygon(0, 1, 6, 3)
  add_polygon(0, 3, 4, 2)
  add_polygon(2, 5, 7, 4)
  add_polygon(1, 6, 7, 5)
  add_polygon(3, 6, 7, 4)
end