Class: Ply::PlyFile

Inherits:
Object
  • Object
show all
Defined in:
lib/ply.rb

Overview

module for working with ply file format – see

http://en.wikipedia.org/wiki/PLY_(file_format)

right now, this supports reading, but not writing ply files

Constant Summary collapse

Versions =

versions of the ply file format we know how to parse (this is the only defined version as of the time of writing)

%w{1.0}
Formats =

formats of the ply file format we know about (we don’t yet implement ascii)

%w{binary_big_endian binary_little_endian ascii}
Types =

property types defined by the ply format; we assume ILP32 meaning of types without explicit widths

%w{char uchar short ushort int uint float double int8 uint8 int16 uint16 int32 uint32 float32 float64 list}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(f) ⇒ PlyFile

parse a ply file takes a file name or an IO stream as argument



46
47
48
49
50
51
52
53
54
# File 'lib/ply.rb', line 46

def initialize f
  unless f.instance_of? IO
    f = File.new(f)
  end
  @source = f
  @elements = []
  parse_header f
  parse_body f
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



36
37
38
# File 'lib/ply.rb', line 36

def data
  @data
end

#elementsObject (readonly)

Returns the value of attribute elements.



36
37
38
# File 'lib/ply.rb', line 36

def elements
  @elements
end

#formatObject (readonly)

Returns the value of attribute format.



36
37
38
# File 'lib/ply.rb', line 36

def format
  @format
end

#versionObject (readonly)

Returns the value of attribute version.



36
37
38
# File 'lib/ply.rb', line 36

def version
  @version
end