Class: SkippyLib::UV

Inherits:
Geom::Point3d
  • Object
show all
Defined in:
modules/uv.rb

Overview

Alias to make code more readable.

The SketchUp Ruby API deal with Geom::Point3d objects when it comes to UV mapping. But this can make it hard to read the intent of the code when everything is a Geom::Point3d.

Since:

  • 3.0.0

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ UV

Returns a new instance of UV.

Parameters:

  • x (Float)
  • y (Float)

Since:

  • 3.0.0



23
24
25
# File 'modules/uv.rb', line 23

def initialize(x, y)
  super(x, y, 1.0)
end

Class Method Details

.from_uvq(uvq) ⇒ Object

Parameters:

  • uvq (UVQ, Geom::Point3d)

Since:

  • 3.0.0



16
17
18
# File 'modules/uv.rb', line 16

def self.from_uvq(uvq)
  self.new(uvq.x / uvq.z, uvq.y / uvq.z)
end

Instance Method Details

#inspectObject

return [String]

Since:

  • 3.0.0



50
51
52
# File 'modules/uv.rb', line 50

def inspect
  "#{self.class.name}(#{x.to_f}, #{y.to_f}, #{z.to_f})"
end

#to_sObject

return [String]

Since:

  • 3.0.0



44
45
46
# File 'modules/uv.rb', line 44

def to_s
  "#{self.class.name.split('::').last}(#{x.to_f}, #{y.to_f})"
end

#to_uvqUVQ

Returns:

Since:

  • 3.0.0



38
39
40
# File 'modules/uv.rb', line 38

def to_uvq
  UVQ.new(x, y)
end