Class: ObjParser::Point

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(point_data = [0, 0, 0]) ⇒ Point

Returns a new instance of Point.



14
15
16
17
18
19
# File 'lib/obj_parser/point.rb', line 14

def initialize(point_data = [0, 0, 0])
  self.data = point_data.map(&:to_f)
  self.textures = []
  self.normals = []
  self.tangents = []
end

Instance Attribute Details

#current_binormalObject

Returns the value of attribute current_binormal.



5
6
7
# File 'lib/obj_parser/point.rb', line 5

def current_binormal
  @current_binormal
end

#current_normalObject

Returns the value of attribute current_normal.



6
7
8
# File 'lib/obj_parser/point.rb', line 6

def current_normal
  @current_normal
end

#current_tangentObject

Returns the value of attribute current_tangent.



4
5
6
# File 'lib/obj_parser/point.rb', line 4

def current_tangent
  @current_tangent
end

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/obj_parser/point.rb', line 3

def data
  @data
end

#flagObject

Returns the value of attribute flag.



12
13
14
# File 'lib/obj_parser/point.rb', line 12

def flag
  @flag
end

#normalsObject

Returns the value of attribute normals.



8
9
10
# File 'lib/obj_parser/point.rb', line 8

def normals
  @normals
end

#tangentsObject

Returns the value of attribute tangents.



10
11
12
# File 'lib/obj_parser/point.rb', line 10

def tangents
  @tangents
end

#texturesObject

Returns the value of attribute textures.



9
10
11
# File 'lib/obj_parser/point.rb', line 9

def textures
  @textures
end

Instance Method Details

#binormalObject



25
26
27
# File 'lib/obj_parser/point.rb', line 25

def binormal
  self.current_binormal ||= Point.new
end

#normalObject



29
30
31
# File 'lib/obj_parser/point.rb', line 29

def normal
  self.current_normal ||= Point.new
end

#tangentObject



21
22
23
# File 'lib/obj_parser/point.rb', line 21

def tangent
  self.current_tangent ||= Point.new
end

#uObject



37
# File 'lib/obj_parser/point.rb', line 37

def u; self.data[0]; end

#vObject



38
# File 'lib/obj_parser/point.rb', line 38

def v; self.data[1]; end

#xObject



33
# File 'lib/obj_parser/point.rb', line 33

def x; self.data[0]; end

#yObject



34
# File 'lib/obj_parser/point.rb', line 34

def y; self.data[1]; end

#zObject



35
# File 'lib/obj_parser/point.rb', line 35

def z; self.data[2]; end