Class: Gsplat::IO::ColmapBinary::Cursor
- Inherits:
-
Object
- Object
- Gsplat::IO::ColmapBinary::Cursor
- Defined in:
- lib/gsplat/io/colmap_binary.rb
Overview
Bounds-checked little-endian binary cursor.
Instance Method Summary collapse
- #array(format, width, count) ⇒ Object
- #cstring ⇒ Object
-
#initialize(data) ⇒ Cursor
constructor
A new instance of Cursor.
- #scalar(format, width) ⇒ Object
Constructor Details
#initialize(data) ⇒ Cursor
Returns a new instance of Cursor.
14 15 16 17 |
# File 'lib/gsplat/io/colmap_binary.rb', line 14 def initialize(data) @data = data @offset = 0 end |
Instance Method Details
#array(format, width, count) ⇒ Object
27 28 29 |
# File 'lib/gsplat/io/colmap_binary.rb', line 27 def array(format, width, count) Array.new(count) { scalar(format, width) } end |
#cstring ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/gsplat/io/colmap_binary.rb', line 31 def cstring finish = @data.index("\0", @offset) raise Gsplat::Error, "unterminated COLMAP image name" unless finish value = @data.byteslice(@offset, finish - @offset) @offset = finish + 1 value.force_encoding(Encoding::UTF_8) end |