Class: SkippyLib::UVQ
- Inherits:
-
Geom::Point3d
- Object
- Geom::Point3d
- SkippyLib::UVQ
- 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
.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x, y, z = 1.0) ⇒ UVQ
constructor
A new instance of UVQ.
-
#inspect ⇒ Object
return [String].
-
#to_s ⇒ Object
return [String].
- #to_uv ⇒ UV
Constructor Details
#initialize(x, y, z = 1.0) ⇒ UVQ
Returns a new instance of UVQ.
80 81 82 |
# File 'modules/uv.rb', line 80 def initialize(x, y, z = 1.0) super(x, y, z) end |
Class Method Details
.from_uv(uv) ⇒ Object
68 69 70 71 72 73 74 |
# File 'modules/uv.rb', line 68 def self.from_uv(uv) unless uv.z == 0.0 || uv.z == 1.0 # rubocop:disable Lint/FloatComparison raise ArgumentError, "Q is not 1.0, was: #{uv.z.to_f}" end self.new(uv.x, uv.y) end |
Instance Method Details
#inspect ⇒ Object
return [String]
107 108 109 |
# File 'modules/uv.rb', line 107 def inspect "#{self.class.name}(#{x.to_f}, #{y.to_f}, #{z.to_f})" end |
#to_s ⇒ Object
return [String]
101 102 103 |
# File 'modules/uv.rb', line 101 def to_s "#{self.class.name.split('::').last}(#{x.to_f}, #{y.to_f}, #{z.to_f})" end |