sketchup-api-stubs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/SketchUp/Geom/BoundingBox.rb +335 -0
- data/SketchUp/Geom/LatLong.rb +123 -0
- data/SketchUp/Geom/Point3d.rb +643 -0
- data/SketchUp/Geom/PolygonMesh.rb +478 -0
- data/SketchUp/Geom/Transformation.rb +476 -0
- data/SketchUp/Geom/UTM.rb +135 -0
- data/SketchUp/Geom/Vector3d.rb +684 -0
- data/SketchUp/Sketchup/Animation.rb +137 -0
- data/SketchUp/Sketchup/AppObserver.rb +157 -0
- data/SketchUp/Sketchup/ArcCurve.rb +209 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +146 -0
- data/SketchUp/Sketchup/AttributeDictionary.rb +280 -0
- data/SketchUp/Sketchup/Axes.rb +149 -0
- data/SketchUp/Sketchup/Behavior.rb +338 -0
- data/SketchUp/Sketchup/Camera.rb +594 -0
- data/SketchUp/Sketchup/ClassificationSchema.rb +63 -0
- data/SketchUp/Sketchup/Classifications.rb +118 -0
- data/SketchUp/Sketchup/Color.rb +291 -0
- data/SketchUp/Sketchup/ComponentDefinition.rb +562 -0
- data/SketchUp/Sketchup/ComponentInstance.rb +597 -0
- data/SketchUp/Sketchup/Console.rb +78 -0
- data/SketchUp/Sketchup/ConstructionLine.rb +257 -0
- data/SketchUp/Sketchup/ConstructionPoint.rb +32 -0
- data/SketchUp/Sketchup/Curve.rb +196 -0
- data/SketchUp/Sketchup/DefinitionList.rb +312 -0
- data/SketchUp/Sketchup/DefinitionObserver.rb +73 -0
- data/SketchUp/Sketchup/DefinitionsObserver.rb +102 -0
- data/SketchUp/Sketchup/Dimension.rb +167 -0
- data/SketchUp/Sketchup/DimensionLinear.rb +232 -0
- data/SketchUp/Sketchup/DimensionObserver.rb +38 -0
- data/SketchUp/Sketchup/DimensionRadial.rb +87 -0
- data/SketchUp/Sketchup/Drawingelement.rb +400 -0
- data/SketchUp/Sketchup/Edge.rb +517 -0
- data/SketchUp/Sketchup/EdgeUse.rb +213 -0
- data/SketchUp/Sketchup/Entities.rb +1011 -0
- data/SketchUp/Sketchup/EntitiesObserver.rb +125 -0
- data/SketchUp/Sketchup/Entity.rb +522 -0
- data/SketchUp/Sketchup/EntityObserver.rb +59 -0
- data/SketchUp/Sketchup/ExtensionsManager.rb +129 -0
- data/SketchUp/Sketchup/Face.rb +737 -0
- data/SketchUp/Sketchup/FrameChangeObserver.rb +104 -0
- data/SketchUp/Sketchup/Group.rb +705 -0
- data/SketchUp/Sketchup/Http.rb +27 -0
- data/SketchUp/Sketchup/Http/Request.rb +285 -0
- data/SketchUp/Sketchup/Http/Response.rb +62 -0
- data/SketchUp/Sketchup/Image.rb +393 -0
- data/SketchUp/Sketchup/Importer.rb +192 -0
- data/SketchUp/Sketchup/InputPoint.rb +393 -0
- data/SketchUp/Sketchup/InstanceObserver.rb +82 -0
- data/SketchUp/Sketchup/InstancePath.rb +297 -0
- data/SketchUp/Sketchup/Layer.rb +240 -0
- data/SketchUp/Sketchup/Layers.rb +235 -0
- data/SketchUp/Sketchup/LayersObserver.rb +136 -0
- data/SketchUp/Sketchup/Licensing.rb +47 -0
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +88 -0
- data/SketchUp/Sketchup/Loop.rb +141 -0
- data/SketchUp/Sketchup/Material.rb +384 -0
- data/SketchUp/Sketchup/Materials.rb +283 -0
- data/SketchUp/Sketchup/MaterialsObserver.rb +141 -0
- data/SketchUp/Sketchup/Menu.rb +97 -0
- data/SketchUp/Sketchup/Model.rb +1459 -0
- data/SketchUp/Sketchup/ModelObserver.rb +356 -0
- data/SketchUp/Sketchup/OptionsManager.rb +135 -0
- data/SketchUp/Sketchup/OptionsProvider.rb +277 -0
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +58 -0
- data/SketchUp/Sketchup/Page.rb +636 -0
- data/SketchUp/Sketchup/Pages.rb +349 -0
- data/SketchUp/Sketchup/PagesObserver.rb +76 -0
- data/SketchUp/Sketchup/PickHelper.rb +457 -0
- data/SketchUp/Sketchup/RegionalSettings.rb +43 -0
- data/SketchUp/Sketchup/RenderingOptions.rb +337 -0
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +44 -0
- data/SketchUp/Sketchup/SectionPlane.rb +88 -0
- data/SketchUp/Sketchup/Selection.rb +470 -0
- data/SketchUp/Sketchup/SelectionObserver.rb +115 -0
- data/SketchUp/Sketchup/Set.rb +253 -0
- data/SketchUp/Sketchup/ShadowInfo.rb +257 -0
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +57 -0
- data/SketchUp/Sketchup/Style.rb +77 -0
- data/SketchUp/Sketchup/Styles.rb +204 -0
- data/SketchUp/Sketchup/Text.rb +241 -0
- data/SketchUp/Sketchup/Texture.rb +211 -0
- data/SketchUp/Sketchup/TextureWriter.rb +237 -0
- data/SketchUp/Sketchup/Tool.rb +808 -0
- data/SketchUp/Sketchup/Tools.rb +120 -0
- data/SketchUp/Sketchup/ToolsObserver.rb +154 -0
- data/SketchUp/Sketchup/UVHelper.rb +61 -0
- data/SketchUp/Sketchup/Vertex.rb +143 -0
- data/SketchUp/Sketchup/View.rb +965 -0
- data/SketchUp/Sketchup/ViewObserver.rb +40 -0
- data/SketchUp/UI/Command.rb +307 -0
- data/SketchUp/UI/HtmlDialog.rb +346 -0
- data/SketchUp/UI/Notification.rb +229 -0
- data/SketchUp/UI/Toolbar.rb +243 -0
- data/SketchUp/UI/WebDialog.rb +623 -0
- data/SketchUp/_top_level.rb +193 -0
- data/SketchUp/array.rb +593 -0
- data/SketchUp/geom.rb +231 -0
- data/SketchUp/languagehandler.rb +92 -0
- data/SketchUp/length.rb +210 -0
- data/SketchUp/numeric.rb +249 -0
- data/SketchUp/sketchup.rb +1290 -0
- data/SketchUp/sketchupextension.rb +355 -0
- data/SketchUp/string.rb +24 -0
- data/SketchUp/ui.rb +637 -0
- metadata +176 -0
@@ -0,0 +1,478 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The PolygonMesh class contains methods to create polygon mesh structures.
|
5
|
+
# This is useful if you need to write a custom importer/exporter in Ruby that
|
6
|
+
# works at the level of triangulated polygons. For example, you can determine
|
7
|
+
# the triangles that make up a 15-sided SketchUp face by using this class, or
|
8
|
+
# write a SketchupImporter that reads a data file, creates a mesh from it,
|
9
|
+
# and draws faces based on the mesh.
|
10
|
+
#
|
11
|
+
# You can construct a mesh manually using the methods of this class, or you
|
12
|
+
# can get a mesh from a face by calling the Face.mesh method. See
|
13
|
+
# Entities.add_faces_from_mesh for an easy way to convert a mesh back into
|
14
|
+
# faces.
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# # Grab a mesh from a given face.
|
18
|
+
# my_mesh = some_face.mesh
|
19
|
+
#
|
20
|
+
# # Create a new group that we will populate with the mesh.
|
21
|
+
# group = Sketchup.active_model.entities.add_group
|
22
|
+
# group.add_faces_from_mesh(my_mesh)
|
23
|
+
#
|
24
|
+
# @version SketchUp 6.0
|
25
|
+
class Geom::PolygonMesh
|
26
|
+
|
27
|
+
# Constants
|
28
|
+
|
29
|
+
AUTO_SOFTEN = nil # Stub value.
|
30
|
+
HIDE_BASED_ON_INDEX = nil # Stub value.
|
31
|
+
NO_SMOOTH_OR_HIDE = nil # Stub value.
|
32
|
+
SMOOTH_SOFT_EDGES = nil # Stub value.
|
33
|
+
SOFTEN_BASED_ON_INDEX = nil # Stub value.
|
34
|
+
|
35
|
+
# Instance Methods
|
36
|
+
|
37
|
+
# The {#add_point} method is used to add a point to the mesh.
|
38
|
+
#
|
39
|
+
# The index can be used for creating polygons.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# mesh = Geom::PolygonMesh.new
|
43
|
+
# point = Geom::Point3d.new(0, 1, 2)
|
44
|
+
# index = mesh.add_point(point)
|
45
|
+
#
|
46
|
+
# @param [Geom::Point3d] point
|
47
|
+
#
|
48
|
+
# @return [Integer] the index in the mesh for the point
|
49
|
+
#
|
50
|
+
# @version SketchUp 6.0
|
51
|
+
def add_point(point)
|
52
|
+
end
|
53
|
+
|
54
|
+
# The +add_polygon+ method is used for adding a polygon to a
|
55
|
+
# PolygonMesh. All variations of this method require at least 3 elements
|
56
|
+
# to define a polygon, although more may be given.
|
57
|
+
#
|
58
|
+
# @overload add_polygon(index, index, index, ...)
|
59
|
+
#
|
60
|
+
# Adds a polygon from a list of the mesh's vertex indices.
|
61
|
+
# @example
|
62
|
+
# mesh = Geom::PolygonMesh.new
|
63
|
+
# # add points to mesh...
|
64
|
+
# mesh.add_point(Geom::Point3d.new(0, 0, 0))
|
65
|
+
# mesh.add_point(Geom::Point3d.new(1, 0, 0))
|
66
|
+
# mesh.add_point(Geom::Point3d.new(1, 1, 0))
|
67
|
+
# polygon_index = mesh.add_polygon(1, 2, 3)
|
68
|
+
# @param [Integer] index
|
69
|
+
# An index of a vertex in the mesh. Remember that mesh indices start at 1.
|
70
|
+
# @param [Integer] ...
|
71
|
+
# Additional indices (optional)
|
72
|
+
#
|
73
|
+
# @overload add_polygon(index_array)
|
74
|
+
#
|
75
|
+
# Adds a polygon from an Array of the mesh's vertex indices.
|
76
|
+
# @example
|
77
|
+
# mesh = Geom::PolygonMesh.new
|
78
|
+
# # add points to mesh...
|
79
|
+
# mesh.add_point(Geom::Point3d.new(0, 0, 0))
|
80
|
+
# mesh.add_point(Geom::Point3d.new(1, 0, 0))
|
81
|
+
# mesh.add_point(Geom::Point3d.new(1, 1, 0))
|
82
|
+
# polygon_index = mesh.add_polygon([1, 2, 3])
|
83
|
+
# @param [Array<Integer>] index_array
|
84
|
+
# An {Array} of point indices.
|
85
|
+
#
|
86
|
+
# @overload add_polygon(point3d, point3d, point3d, ...)
|
87
|
+
#
|
88
|
+
# Adds a polygon from a list of Point3d objects.
|
89
|
+
# @example
|
90
|
+
# mesh = Geom::PolygonMesh.new
|
91
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
92
|
+
# point2 = Geom::Point3d.new(1, 0, 2)
|
93
|
+
# point3 = Geom::Point3d.new(2, 0, 1)
|
94
|
+
# polygon_index = mesh.add_polygon(point1, point2, point3)
|
95
|
+
# @param [Geom::Point3d] point3d
|
96
|
+
# @raise [ArgumentError] When using Arrays in place of Point3d objects.
|
97
|
+
# Normally Arrays may be used in place of Point3d objects in most
|
98
|
+
# SketchUp methods. This method is an exception to that rule.
|
99
|
+
# @param [Geom::Point3d] ...
|
100
|
+
# Additional points (optional)
|
101
|
+
#
|
102
|
+
# @overload add_polygon(point3d_array)
|
103
|
+
#
|
104
|
+
# Adds a polygon from an Array of Point3d objects.
|
105
|
+
# @example
|
106
|
+
# mesh = Geom::PolygonMesh.new
|
107
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
108
|
+
# point2 = Geom::Point3d.new(1, 0, 2)
|
109
|
+
# point3 = Geom::Point3d.new(2, 0, 1)
|
110
|
+
# polygon_index = mesh.add_polygon([point1, point2, point3])
|
111
|
+
# @param [Array<Geom::Point3d>] point3d_array
|
112
|
+
#
|
113
|
+
# @overload add_polygon(array)
|
114
|
+
#
|
115
|
+
# Adds a polygon from an Array of 3-element Arrays.
|
116
|
+
# @example
|
117
|
+
# pts = [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0.5, 2, 0], [0, 1, 0]]
|
118
|
+
# mesh = Geom::PolygonMesh.new
|
119
|
+
# polygon_index = mesh.add_polygon(pts)
|
120
|
+
# Sketchup.active_model.entities.add_faces_from_mesh(mesh)
|
121
|
+
# @param [Array<Array(3)>] array
|
122
|
+
# An array of arrays of length 3, where the inner arrays are used as if
|
123
|
+
# they were Point3d objects.
|
124
|
+
#
|
125
|
+
# @return [Integer] The index of the polygon in the mesh.
|
126
|
+
#
|
127
|
+
# @return [0] Invalid index. Returned if the method failed to create a
|
128
|
+
# polygon.
|
129
|
+
#
|
130
|
+
# @version SketchUp 6.0
|
131
|
+
def add_polygon(*args)
|
132
|
+
end
|
133
|
+
|
134
|
+
# The {#count_points} method is used to count the number of points in a mesh.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# mesh = Geom::PolygonMesh.new
|
138
|
+
# point = Geom::Point3d.new(0, 1, 2)
|
139
|
+
# mesh.add_point(point)
|
140
|
+
# num = mesh.count_points
|
141
|
+
#
|
142
|
+
# @return [Integer] the number of points in a mesh
|
143
|
+
#
|
144
|
+
# @version SketchUp 6.0
|
145
|
+
def count_points
|
146
|
+
end
|
147
|
+
|
148
|
+
# The {#count_polygons} count the number of polygons in the mesh.
|
149
|
+
#
|
150
|
+
# @example
|
151
|
+
# mesh = Geom::PolygonMesh.new
|
152
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
153
|
+
# point2 = Geom::Point3d.new(1, 0, 2)
|
154
|
+
# point3 = Geom::Point3d.new(2, 0, 1)
|
155
|
+
# mesh.add_polygon(point1, point2, point3)
|
156
|
+
# nump = mesh.count_polygons
|
157
|
+
#
|
158
|
+
# @return [Integer] the number of polygons in the mesh
|
159
|
+
#
|
160
|
+
# @version SketchUp 6.0
|
161
|
+
def count_polygons
|
162
|
+
end
|
163
|
+
|
164
|
+
# Create a new empty polygon mesh. The number of points and polygons are
|
165
|
+
# optional and are just used as a hint to decide how much space to
|
166
|
+
# pre-allocate to speed up adding points and polygons.
|
167
|
+
#
|
168
|
+
# @example
|
169
|
+
# mesh = Geom::PolygonMesh.new
|
170
|
+
#
|
171
|
+
# @overload initialize
|
172
|
+
#
|
173
|
+
# @return [Geom::PolygonMesh]
|
174
|
+
#
|
175
|
+
# @overload initialize(numpts, numpolys)
|
176
|
+
#
|
177
|
+
# @param [Integer] numpts How many points will be in the mesh.
|
178
|
+
# @param [Integer] numpolys How many polygons will be in the mesh.
|
179
|
+
# @return [Geom::PolygonMesh]
|
180
|
+
#
|
181
|
+
# @overload initialize(numpts)
|
182
|
+
#
|
183
|
+
# @param [Integer] numpts How many points will be in the mesh.
|
184
|
+
# @return [Geom::PolygonMesh]
|
185
|
+
#
|
186
|
+
# @version SketchUp 6.0
|
187
|
+
def initialize(*args)
|
188
|
+
end
|
189
|
+
|
190
|
+
# The {#normal_at} method is used to determine the vertex normal at a
|
191
|
+
# particular index in the mesh. This only works for meshes retrieved from
|
192
|
+
# {Sketchup::Face#mesh} with the +PolygonMeshNormals+ flag.
|
193
|
+
#
|
194
|
+
# @example
|
195
|
+
# flags = 4 # PolygonMeshNormals
|
196
|
+
# mesh = face.mesh(flags)
|
197
|
+
# normal = mesh.normal_at(1)
|
198
|
+
#
|
199
|
+
# @note Index is 1 based (starts at 1).
|
200
|
+
#
|
201
|
+
# @param [Integer] index
|
202
|
+
# The index in the mesh for the vertex normal to be
|
203
|
+
# retrieved
|
204
|
+
#
|
205
|
+
# @return [Geom::Vector3d, nil]
|
206
|
+
#
|
207
|
+
# @version SketchUp 6.0
|
208
|
+
def normal_at(index)
|
209
|
+
end
|
210
|
+
|
211
|
+
# The {#point_at} method is used to retrieve the point at a specific index in
|
212
|
+
# the mesh.
|
213
|
+
#
|
214
|
+
# @example
|
215
|
+
# mesh = Geom::PolygonMesh.new
|
216
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
217
|
+
# point2 = Geom::Point3d.new(10, 20, 30)
|
218
|
+
# mesh.add_point(point1)
|
219
|
+
# mesh.add_point(point2)
|
220
|
+
# point_from_index = mesh.point_at(1)
|
221
|
+
#
|
222
|
+
# @note Index is 1 based (starts at 1).
|
223
|
+
#
|
224
|
+
# @param [Integer] index
|
225
|
+
# The index in the mesh for the point to be retrieved
|
226
|
+
#
|
227
|
+
# @return [Geom::Point3d, nil]
|
228
|
+
#
|
229
|
+
# @version SketchUp 6.0
|
230
|
+
def point_at(index)
|
231
|
+
end
|
232
|
+
|
233
|
+
# The {#point_index} method is used to retrieve the index of a point in the
|
234
|
+
# mesh.
|
235
|
+
#
|
236
|
+
# @example
|
237
|
+
# mesh = Geom::PolygonMesh.new
|
238
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
239
|
+
# point2 = Geom::Point3d.new(10, 20, 30)
|
240
|
+
# mesh.add_point(point1)
|
241
|
+
# mesh.add_point(point2)
|
242
|
+
# index = mesh.point_index(point2)
|
243
|
+
#
|
244
|
+
# @note Returns 0 if point is not found.
|
245
|
+
#
|
246
|
+
# @param [Geom::Point3d] point
|
247
|
+
#
|
248
|
+
# @return [Integer] the index in the mesh for the {Geom::Point3d} object
|
249
|
+
#
|
250
|
+
# @version SketchUp 6.0
|
251
|
+
def point_index(point)
|
252
|
+
end
|
253
|
+
|
254
|
+
# The {#points} method is used to retrieve an array of points (vertices) in the
|
255
|
+
# mesh
|
256
|
+
#
|
257
|
+
# @example
|
258
|
+
# mesh = Geom::PolygonMesh.new
|
259
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
260
|
+
# point2 = Geom::Point3d.new(10, 20, 30)
|
261
|
+
# mesh.add_point(point1)
|
262
|
+
# mesh.add_point(point2)
|
263
|
+
# # Returns array of points in the mesh.
|
264
|
+
# points = mesh.points
|
265
|
+
#
|
266
|
+
# @return [Array<Geom::Point3d>]
|
267
|
+
#
|
268
|
+
# @version SketchUp 6.0
|
269
|
+
def points
|
270
|
+
end
|
271
|
+
|
272
|
+
# The {#polygon_at} method is used to retrieve an array of vertex index values
|
273
|
+
# for a polygon at a specific index.
|
274
|
+
#
|
275
|
+
# Index is 1 based (starts at 1). The returned array can contain negative
|
276
|
+
# values with the sign indicating a hidden edge. For example, a return value
|
277
|
+
# of +[-1, 2, 3]+ indicates that the edge from +1+ to +2+ is hidden.
|
278
|
+
# The negative values should not be used as an index for point_at, take the
|
279
|
+
# positive value of the index value in the polygon array. So if you
|
280
|
+
# get +[-1, 2,3]+ use +1+ as the argument to {#point_at}.
|
281
|
+
#
|
282
|
+
# @example
|
283
|
+
# mesh = Geom::PolygonMesh.new
|
284
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
285
|
+
# point2 = Geom::Point3d.new(1, 0, 2)
|
286
|
+
# point3 = Geom::Point3d.new(2, 0, 1)
|
287
|
+
# index = mesh.add_polygon(point1, point2, point3)
|
288
|
+
# polygon = mesh.polygon_at(index)
|
289
|
+
#
|
290
|
+
# @param [Integer] index
|
291
|
+
# The index of the desired polygon.
|
292
|
+
#
|
293
|
+
# @return [Array<Geom::Point3d>, nil]
|
294
|
+
#
|
295
|
+
# @version SketchUp 6.0
|
296
|
+
def polygon_at(index)
|
297
|
+
end
|
298
|
+
|
299
|
+
# The {#polygon_points_at} method is used to retrieve the points for a polygon
|
300
|
+
# that is at a specific index in the mesh.
|
301
|
+
#
|
302
|
+
# @example
|
303
|
+
# mesh = Geom::PolygonMesh.new
|
304
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
305
|
+
# point2 = Geom::Point3d.new(1, 0, 2)
|
306
|
+
# point3 = Geom::Point3d.new(2, 0, 1)
|
307
|
+
# index = mesh.add_polygon(point1, point2, point3)
|
308
|
+
# points = mesh.polygon_points_at(index)
|
309
|
+
#
|
310
|
+
# @param [Integer] index
|
311
|
+
# An index for a polygon in the mesh.
|
312
|
+
#
|
313
|
+
# @return [Array<Geom::Point3d>, nil]
|
314
|
+
#
|
315
|
+
# @version SketchUp 6.0
|
316
|
+
def polygon_points_at(index)
|
317
|
+
end
|
318
|
+
|
319
|
+
# The {#polygons} method is used to retrieve an array of all polygons in the
|
320
|
+
# mesh.
|
321
|
+
#
|
322
|
+
# The returned array can contain negative values with the sign indicating a
|
323
|
+
# hidden edge. For example, a return value of +[-1, 2, 3]+ indicates that the
|
324
|
+
# edge from +1+ to +2+ is hidden.
|
325
|
+
#
|
326
|
+
# @example
|
327
|
+
# polygons = polygonmesh.polygons
|
328
|
+
#
|
329
|
+
# @return [Array<Integer>]
|
330
|
+
#
|
331
|
+
# @version SketchUp 6.0
|
332
|
+
def polygons
|
333
|
+
end
|
334
|
+
|
335
|
+
# The {#set_point} method is used to set the point at a specific index in the
|
336
|
+
# mesh.
|
337
|
+
#
|
338
|
+
# @example
|
339
|
+
# mesh = Geom::PolygonMesh.new
|
340
|
+
# point1 = Geom::Point3d.new(0, 1, 2)
|
341
|
+
# point2 = Geom::Point3d.new(10, 20, 30)
|
342
|
+
# index = mesh.add_point(point1)
|
343
|
+
# mesh.set_point(index, point2)
|
344
|
+
#
|
345
|
+
# @param [Integer] index
|
346
|
+
# The index where the point will be set.
|
347
|
+
#
|
348
|
+
# @param [Geom::Point3d] point
|
349
|
+
# A Point3d object to set at the index.
|
350
|
+
#
|
351
|
+
# @return [Geom::PolygonMesh]
|
352
|
+
#
|
353
|
+
# @version SketchUp 6.0
|
354
|
+
def set_point(index, point)
|
355
|
+
end
|
356
|
+
|
357
|
+
# The {#set_uv} method is used to define UV mapping coordinates to points in
|
358
|
+
# the mesh.
|
359
|
+
#
|
360
|
+
# Beware that the polygons connected to the point will share UV coordiates so
|
361
|
+
# UV mapping coordinates needs to be continuous across the polygon mesh.
|
362
|
+
#
|
363
|
+
# When setting the UV for a point one need to make sure to have the correct
|
364
|
+
# index for the point. It's therefore best to add the points using {#add_point}
|
365
|
+
# and use the index it returns for following calls to set_uv and
|
366
|
+
# {#add_polygon}.
|
367
|
+
#
|
368
|
+
# If you are not able to calculate how many points there will be in your mesh
|
369
|
+
# make sure to not specify an index in {#set_uv} higher than the number of
|
370
|
+
# times you have called {#set_uv}.
|
371
|
+
#
|
372
|
+
# @example
|
373
|
+
# mesh = Geom::PolygonMesh.new(4)
|
374
|
+
# # Create points for a triangle.
|
375
|
+
# point1 = Geom::Point3d.new(0, 0, 0)
|
376
|
+
# point2 = Geom::Point3d.new(9, 0, 0)
|
377
|
+
# point3 = Geom::Point3d.new(9, 9, 0)
|
378
|
+
# point4 = Geom::Point3d.new(0, 9, 0)
|
379
|
+
# # Create UV mapping to tile 2x cross triangle.
|
380
|
+
# uv1 = Geom::Point3d.new(0, 0, 0)
|
381
|
+
# uv2 = Geom::Point3d.new(2, 0, 0)
|
382
|
+
# uv3 = Geom::Point3d.new(2, 2, 0)
|
383
|
+
# uv4 = Geom::Point3d.new(0, 2, 0)
|
384
|
+
# # Add points and UV data to mesh.
|
385
|
+
# index1 = mesh.add_point(point1)
|
386
|
+
# index2 = mesh.add_point(point2)
|
387
|
+
# index3 = mesh.add_point(point3)
|
388
|
+
# index4 = mesh.add_point(point4)
|
389
|
+
# mesh.set_uv(index1, uv1, true)
|
390
|
+
# mesh.set_uv(index2, uv2, true)
|
391
|
+
# mesh.set_uv(index3, uv3, true)
|
392
|
+
# mesh.set_uv(index4, uv4, true)
|
393
|
+
# # Add polygons.
|
394
|
+
# mesh.add_polygon(index1, index2, index3)
|
395
|
+
# mesh.add_polygon(index1, index3, index4)
|
396
|
+
#
|
397
|
+
# @note If you don't specify how many points you will be adding to the mesh
|
398
|
+
# when you initiate it you may risk the UV data becoming out of sync.
|
399
|
+
#
|
400
|
+
# @param [Geom::Point3d] point
|
401
|
+
# A Point3d object representing UV coordinates.
|
402
|
+
#
|
403
|
+
# @param [Integer] index
|
404
|
+
# An Integer representing the UV index.
|
405
|
+
#
|
406
|
+
# @return [nil]
|
407
|
+
#
|
408
|
+
# @version SketchUp 2014
|
409
|
+
def set_uv(index, point)
|
410
|
+
end
|
411
|
+
|
412
|
+
# The {#transform!} method is used to apply a transformation to a mesh.
|
413
|
+
#
|
414
|
+
# @example
|
415
|
+
# point1 = Geom::Point3d.new(100, 200, 300)
|
416
|
+
# tr = Geom::Transformation.new(point1)
|
417
|
+
# mesh = Geom::PolygonMesh.new
|
418
|
+
# point2 = Geom::Point3d.new(0, 1, 2)
|
419
|
+
# mesh.add_point(point2)
|
420
|
+
# mesh.transform!(tr)
|
421
|
+
#
|
422
|
+
# @param [Geom::Transformation] transformation
|
423
|
+
#
|
424
|
+
# @return [Geom::PolygonMesh]
|
425
|
+
#
|
426
|
+
# @version SketchUp 6.0
|
427
|
+
def transform!(transformation)
|
428
|
+
end
|
429
|
+
|
430
|
+
# The {#uv_at} method is used to access a uv (texture coordinates) at a
|
431
|
+
# specific index.
|
432
|
+
#
|
433
|
+
# "UVs" is a way of referring to the u,v texture coordinates (as
|
434
|
+
# opposed to the X, Y, and Z axis that you construct your meshes on), which
|
435
|
+
# are points defining 1-by-1 positions within an image. These coordinates
|
436
|
+
# connect to points in your 3D model, to position an image texture onto it's
|
437
|
+
# surface (similar to virtual "thumb tacks")
|
438
|
+
#
|
439
|
+
# These coordinates pin an exact spot on an image that you wish to use to
|
440
|
+
# texture your model to a specific point on an object's surface. Between these
|
441
|
+
# points, your software will stretch the image smoothly. This is what is
|
442
|
+
# referred to as UV mapping.
|
443
|
+
#
|
444
|
+
# @example
|
445
|
+
# point = mesh.uv_at(1, true)
|
446
|
+
#
|
447
|
+
# @param [Integer] index
|
448
|
+
# The index for the texture coordinate.
|
449
|
+
#
|
450
|
+
# @param [Boolean] front
|
451
|
+
# Set to +true+ to get the UV for the front size,
|
452
|
+
# +false+ for the back side.
|
453
|
+
#
|
454
|
+
# @return [Geom::Point3d, nil] a Point3d object where the x equals the u
|
455
|
+
# value and the y equals the v value.
|
456
|
+
# Returns nil on failure.
|
457
|
+
#
|
458
|
+
# @version SketchUp 6.0
|
459
|
+
def uv_at(index, front)
|
460
|
+
end
|
461
|
+
|
462
|
+
# The {#uvs} method is used to retrieve an array of uv coordinates in the
|
463
|
+
# mesh.
|
464
|
+
#
|
465
|
+
# @example
|
466
|
+
# # Get a mesh with front and back UVs.
|
467
|
+
# mesh = face.mesh(1 | 2)
|
468
|
+
# uvs = mesh.uvs
|
469
|
+
#
|
470
|
+
# @param [Boolean] front
|
471
|
+
#
|
472
|
+
# @return [Array<Geom::Point3d>]
|
473
|
+
#
|
474
|
+
# @version SketchUp 6.0
|
475
|
+
def uvs(front)
|
476
|
+
end
|
477
|
+
|
478
|
+
end
|