class Vamp::Ply::PlyObject

Attributes

output[RW]
polygons[R]
vertices[R]

Public Class Methods

new() click to toggle source
# File lib/vamp/ply/ply_object.rb, line 9
def initialize
  @vertices = []
  @polygons = []
  @output = StringIO.new
end

Public Instance Methods

add_polygon(*vertexes) click to toggle source
# File lib/vamp/ply/ply_object.rb, line 19
def add_polygon(*vertexes)
  vertexes.each do |v|
    fail "unknown vertex #{v}" unless vertices[v.to_i]
  end
  polygons << vertexes.map(&:to_i)
end
add_vertex(x, y, z) click to toggle source
# File lib/vamp/ply/ply_object.rb, line 15
def add_vertex(x, y, z)
  vertices << ([x.to_f, y.to_f, z.to_f])
end
to_s() click to toggle source
# File lib/vamp/ply/ply_object.rb, line 26
def to_s
  @output = StringIO.new
  print_header
  print_vertices
  print_polygons
  output.string
end

Private Instance Methods

print_header() click to toggle source
print_polygons() click to toggle source
print_vertices() click to toggle source