Class: Sketchup::UVHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb

Overview

The UV Helper class contains methods allowing you to determine the location (UV coordinates) of a texture on a face. This class is particularly useful in determining how textures that have been manipulated using the Texture Tweaker should appear when exported to another file type

Use the Face.get_UVHelper method to create a UVHelper for a given face. See the TextureWriter class as well.

Version:

  • SketchUp 6.0

Instance Method Summary collapse

Instance Method Details

#get_back_UVQ(point) ⇒ Geom::Point3d

Note:

To convert UVQ coordinates to UV, divide U and V by Q.

u = uvq.u / uvq.q
v = uvq.v / uvq.q

The #get_back_UVQ method is used to get the UV texture coordinates on the back of a face.

Examples:

uv_helper = face.get_UVHelper(true, true, my_texture_writer)
face.outer_loop.vertices.each do |vert|
  uvq = uv_helper.get_back_UVQ(vert.position)
  # "Normalize" UVQ to UV.
  u = uvq.u / unq.q
  v = uvq.v / unq.q
  puts "u=#{u} v=#{v}""
end

Parameters:

Returns:

  • (Geom::Point3d)

    Point where X represents U, Y represents V and Z represents Q.

Version:

  • SketchUp 6.0



41
42
# File 'lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb', line 41

def get_back_UVQ(point)
end

#get_front_UVQ(point) ⇒ Geom::Point3d

Note:

To convert UVQ coordinates to UV, divide U and V by Q.

u = uvq.u / uvq.q
v = uvq.v / uvq.q

The #get_front_UVQ method is used to get the UV texture coordinates on the front of a face.

Examples:

uv_helper = face.get_UVHelper(true, true, my_texture_writer)
face.outer_loop.vertices.each do |vert|
  uvq = uv_helper.get_front_UVQ(vert.position)
  # "Normalize" UVQ to UV.
  u = uvq.u / unq.q
  v = uvq.v / unq.q
  puts "u=#{u} v=#{v}""
end

Parameters:

Returns:

  • (Geom::Point3d)

    Point where X represents U, Y represents V and Z represents Q.

Version:

  • SketchUp 6.0



68
69
# File 'lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb', line 68

def get_front_UVQ(point)
end