sketchup-api-stubs 0.7.9 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +157 -151
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +182 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +111 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +423 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +693 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +535 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +500 -476
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +267 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +133 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +547 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +678 -693
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +751 -747
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
  23. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +683 -517
  24. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  26. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +464 -353
  27. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  31. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
  32. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  33. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  34. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
  35. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +614 -567
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  37. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  38. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +282 -183
  39. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +458 -387
  40. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
  41. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +346 -344
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -82
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1565 -1519
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  49. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  50. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  51. data/lib/sketchup-api-stubs/stubs/Length.rb +286 -278
  52. data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +196 -144
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +145 -150
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +294 -281
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +296 -302
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +473 -478
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -121
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +673 -659
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +600 -593
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +252 -257
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +443 -449
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +167 -165
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +403 -406
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1282 -1239
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +122 -125
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1006 -937
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +740 -750
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +289 -282
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +64 -62
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +405 -468
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +432 -406
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +307 -306
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +332 -326
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +380 -422
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +409 -427
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +241 -249
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +55 -48
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -114
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1115 -414
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +330 -317
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1714 -1652
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +372 -357
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +133 -130
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +463 -490
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +104 -116
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +939 -797
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +388 -361
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +501 -478
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +385 -361
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +451 -458
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +211 -212
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +259 -255
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +88 -69
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +263 -217
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +283 -262
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +199 -217
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +924 -834
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +143 -142
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1566 -1311
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +71 -45
  149. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1429 -1377
  150. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
  151. data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
  152. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +399 -389
  153. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +580 -494
  154. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +280 -269
  155. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +258 -241
  156. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +636 -635
  157. data/lib/sketchup-api-stubs/stubs/UI.rb +791 -683
  158. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
  159. data/lib/sketchup-api-stubs.rb +1 -1
  160. metadata +10 -24
@@ -1,509 +1,535 @@
1
- # Copyright:: Copyright 2023 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The {#Geom::PolygonMesh} class contains methods to create polygon mesh
5
- # structures. This is useful if you need to write a custom importer/exporter in
6
- # Ruby that works at the level of triangulated polygons. For example, you can
7
- # determine the triangles that make up a 15-sided {#Sketchup::Face} by using
8
- # this class, or write a {#Sketchup::Importer} that reads a data file, creates
9
- # a mesh from it, 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 {Sketchup::Face#mesh} method. See
13
- # {Sketchup::Entities#add_faces_from_mesh} for an easy way to convert a mesh
14
- # back into faces.
15
- #
16
- # @example
17
- # entities = Sketchup.active_model.active_entities
18
- # face = entities.grep(Sketchup::Face).first
19
- #
20
- # mesh = face.mesh
21
- #
22
- # group = entities.add_group
23
- # group.entities.add_faces_from_mesh(mesh)
24
- #
25
- # @note As of SketchUp 2022.0 the new {Sketchup::EntitiesBuilder} interface
26
- # can be used to generate bulk geometry. It has similar performance as
27
- # {Geom::PolygonMesh}, but with similar degree of per-entity control as
28
- # {Sketchup::Entities}.
29
- #
30
- # @see file:pages/generating_geometry.md
31
- # Guide on Generating Geometry
32
- #
33
- # @version SketchUp 6.0
34
- class Geom::PolygonMesh
35
-
36
- # Constants
37
-
38
- AUTO_SOFTEN = nil # Stub value.
39
- HIDE_BASED_ON_INDEX = nil # Stub value.
40
- NO_SMOOTH_OR_HIDE = nil # Stub value.
41
- SMOOTH_SOFT_EDGES = nil # Stub value.
42
- SOFTEN_BASED_ON_INDEX = nil # Stub value.
43
-
44
- MESH_NORMALS = nil # Stub value.
45
- MESH_POINTS = nil # Stub value.
46
- MESH_UVQ_BACK = nil # Stub value.
47
- MESH_UVQ_FRONT = nil # Stub value.
48
-
49
- # Instance Methods
50
-
51
- # The {#add_point} method is used to add a point to the mesh.
52
- #
53
- # The returned index can be used for creating polygons.
54
- #
55
- # @example
56
- # mesh = Geom::PolygonMesh.new
57
- # point = Geom::Point3d.new(0, 1, 2)
58
- # index = mesh.add_point(point)
59
- #
60
- # @note In SketchUp 2021.1 this method was improved to be faster.
61
- # See {#initialize} for details.
62
- #
63
- # @param [Geom::Point3d] point
64
- #
65
- # @return [Integer] the index in the mesh for the point
66
- #
67
- # @version SketchUp 6.0
68
- def add_point(point)
69
- end
70
-
71
- # The {#add_polygon} method is used for adding a polygon to a
72
- # {Geom::PolygonMesh}. All variations of this method require at least 3 elements
73
- # to define a polygon, although more may be given.
74
- #
75
- # @note In SketchUp 2021.1 this method was improved to be faster.
76
- # See {#initialize} for details.
77
- #
78
- # @overload add_polygon(index, index, index, ...)
79
- #
80
- # Adds a polygon from a list of the mesh's vertex indices.
81
- # @example
82
- # mesh = Geom::PolygonMesh.new
83
- # # add points to mesh...
84
- # mesh.add_point(Geom::Point3d.new(0, 0, 0))
85
- # mesh.add_point(Geom::Point3d.new(1, 0, 0))
86
- # mesh.add_point(Geom::Point3d.new(1, 1, 0))
87
- # polygon_index = mesh.add_polygon(1, 2, 3)
88
- # @param [Integer] index
89
- # An index of a vertex in the mesh. Remember that mesh indices start at 1.
90
- # @param [Integer] ...
91
- # Additional indices (optional)
92
- #
93
- # @overload add_polygon(index_array)
94
- #
95
- # Adds a polygon from an Array of the mesh's vertex indices.
96
- # @example
97
- # mesh = Geom::PolygonMesh.new
98
- # # add points to mesh...
99
- # mesh.add_point(Geom::Point3d.new(0, 0, 0))
100
- # mesh.add_point(Geom::Point3d.new(1, 0, 0))
101
- # mesh.add_point(Geom::Point3d.new(1, 1, 0))
102
- # polygon_index = mesh.add_polygon([1, 2, 3])
103
- # @param [Array<Integer>] index_array
104
- # An {Array} of point indices.
105
- #
106
- # @overload add_polygon(point3d, point3d, point3d, ...)
107
- #
108
- # Adds a polygon from a list of Point3d objects.
109
- # @example
110
- # mesh = Geom::PolygonMesh.new
111
- # point1 = Geom::Point3d.new(0, 1, 2)
112
- # point2 = Geom::Point3d.new(1, 0, 2)
113
- # point3 = Geom::Point3d.new(2, 0, 1)
114
- # polygon_index = mesh.add_polygon(point1, point2, point3)
115
- # @param [Geom::Point3d] point3d
116
- # @raise [ArgumentError] When using Arrays in place of Point3d objects.
117
- # Normally Arrays may be used in place of Point3d objects in most
118
- # SketchUp methods. This method is an exception to that rule.
119
- # @param [Geom::Point3d] ...
120
- # Additional points (optional)
121
- #
122
- # @overload add_polygon(point3d_array)
123
- #
124
- # Adds a polygon from an Array of Point3d objects.
125
- # @example
126
- # mesh = Geom::PolygonMesh.new
127
- # point1 = Geom::Point3d.new(0, 1, 2)
128
- # point2 = Geom::Point3d.new(1, 0, 2)
129
- # point3 = Geom::Point3d.new(2, 0, 1)
130
- # polygon_index = mesh.add_polygon([point1, point2, point3])
131
- # @param [Array<Geom::Point3d>] point3d_array
132
- #
133
- # @return [Integer] The 1-based index of the polygon in the mesh. +0+
134
- # is returned if the method failed to create a polygon.
135
- #
136
- # @version SketchUp 6.0
137
- def add_polygon(*args)
138
- end
139
-
140
- # The {#count_points} method is used to count the number of points in a mesh.
141
- #
142
- # @example
143
- # mesh = Geom::PolygonMesh.new
144
- # point = Geom::Point3d.new(0, 1, 2)
145
- # mesh.add_point(point)
146
- # num = mesh.count_points
147
- #
148
- # @return [Integer] the number of points in a mesh
149
- #
150
- # @version SketchUp 6.0
151
- def count_points
152
- end
153
-
154
- # The {#count_polygons} count the number of polygons in the mesh.
155
- #
156
- # @example
157
- # mesh = Geom::PolygonMesh.new
158
- # point1 = Geom::Point3d.new(0, 1, 2)
159
- # point2 = Geom::Point3d.new(1, 0, 2)
160
- # point3 = Geom::Point3d.new(2, 0, 1)
161
- # mesh.add_polygon(point1, point2, point3)
162
- # nump = mesh.count_polygons
163
- #
164
- # @return [Integer] the number of polygons in the mesh
165
- #
166
- # @version SketchUp 6.0
167
- def count_polygons
168
- end
169
-
170
- # Create a new empty polygon mesh.
171
- #
172
- # The number of points and polygons are optional and are used as a hint to
173
- # decide how much space to pre-allocate to speed up adding points and polygons.
174
- #
175
- # As of SketchUp 2021.1 the performance of looking up and inserting points is
176
- # significantly better provided the mesh was initialized with roughly the
177
- # correct number of total points.
178
- #
179
- # @example
180
- # mesh = Geom::PolygonMesh.new
181
- #
182
- # @note When creating a mesh with normals and/or UVQ data it's critical that
183
- # the number of points estimated is equal to or higher than the final number
184
- # of points added. If fewer points are estimated the normals and UVQ data
185
- # might end up out of sync.
186
- #
187
- # @overload initialize
188
- #
189
- # @return [Geom::PolygonMesh]
190
- #
191
- # @overload initialize(numpts)
192
- #
193
- # @param [Integer] numpts How many points will be in the mesh.
194
- # @return [Geom::PolygonMesh]
195
- #
196
- # @overload initialize(numpts, numpolys)
197
- #
198
- # @param [Integer] numpts How many points will be in the mesh.
199
- # @param [Integer] numpolys How many polygons will be in the mesh.
200
- # @return [Geom::PolygonMesh]
201
- #
202
- # @raise [RangeError] If number of points or polygons are negative numbers.
203
- #
204
- # @version SketchUp 6.0
205
- def initialize(*args)
206
- end
207
-
208
- # The {#normal_at} method is used to determine the vertex normal at a
209
- # particular index in the mesh. This only works for meshes retrieved from
210
- # {Sketchup::Face#mesh} with the +PolygonMeshNormals+ flag.
211
- #
212
- # @example
213
- # flags = 4 # PolygonMeshNormals
214
- # mesh = face.mesh(flags)
215
- # normal = mesh.normal_at(1)
216
- #
217
- # @note Index starts at 1.
218
- #
219
- # @param [Integer] index
220
- # The index in the mesh for the vertex normal to be
221
- # retrieved
222
- #
223
- # @return [Geom::Vector3d, nil]
224
- #
225
- # @version SketchUp 6.0
226
- def normal_at(index)
227
- end
228
-
229
- # The {#point_at} method is used to retrieve the point at a specific index in
230
- # the mesh.
231
- #
232
- # @example
233
- # mesh = Geom::PolygonMesh.new
234
- # point1 = Geom::Point3d.new(0, 1, 2)
235
- # point2 = Geom::Point3d.new(10, 20, 30)
236
- # mesh.add_point(point1)
237
- # mesh.add_point(point2)
238
- # point_from_index = mesh.point_at(1)
239
- #
240
- # @note Index starts at 1.
241
- #
242
- # @param [Integer] index
243
- # The index in the mesh for the point to be retrieved
244
- #
245
- # @return [Geom::Point3d, nil]
246
- #
247
- # @version SketchUp 6.0
248
- def point_at(index)
249
- end
250
-
251
- # The {#point_index} method is used to retrieve the index of a point in the
252
- # mesh.
253
- #
254
- # @example
255
- # mesh = Geom::PolygonMesh.new
256
- # point1 = Geom::Point3d.new(0, 1, 2)
257
- # point2 = Geom::Point3d.new(10, 20, 30)
258
- # mesh.add_point(point1)
259
- # mesh.add_point(point2)
260
- # index = mesh.point_index(point2)
261
- #
262
- # @note Returns 0 if point is not found.
263
- #
264
- # @param [Geom::Point3d] point
265
- #
266
- # @return [Integer] the index in the mesh for the {Geom::Point3d} object
267
- #
268
- # @version SketchUp 6.0
269
- def point_index(point)
270
- end
271
-
272
- # The {#points} method is used to retrieve an array of points (vertices) in the
273
- # mesh
274
- #
275
- # @example
276
- # mesh = Geom::PolygonMesh.new
277
- # point1 = Geom::Point3d.new(0, 1, 2)
278
- # point2 = Geom::Point3d.new(10, 20, 30)
279
- # mesh.add_point(point1)
280
- # mesh.add_point(point2)
281
- # # Returns array of points in the mesh.
282
- # points = mesh.points
283
- #
284
- # @return [Array<Geom::Point3d>]
285
- #
286
- # @version SketchUp 6.0
287
- def points
288
- end
289
-
290
- # The {#polygon_at} method is used to retrieve an array of vertex index values
291
- # for a polygon at a specific index.
292
- #
293
- # @example
294
- # mesh = Geom::PolygonMesh.new
295
- # point1 = Geom::Point3d.new(0, 1, 2)
296
- # point2 = Geom::Point3d.new(1, 0, 2)
297
- # point3 = Geom::Point3d.new(2, 0, 1)
298
- # index = mesh.add_polygon(point1, point2, point3)
299
- # polygon = mesh.polygon_at(index)
300
- #
301
- # @note Index starts at 1.
302
- #
303
- # @note The returned array can contain negative
304
- # values with the sign indicating a hidden edge. For example, a return value
305
- # of +[-1, 2, 3]+ indicates that the edge from +1+ to +2+ is hidden. The
306
- # negative values should not be used as an index for {#point_at}, take the
307
- # absolute value of the index value in the polygon array. So if you
308
- # get +[-1, 2,3]+ use +1+ as the argument to {#point_at}.
309
- #
310
- # @param [Integer] index
311
- # The index of the desired polygon.
312
- #
313
- # @return [Array<Geom::Point3d>, nil]
314
- #
315
- # @version SketchUp 6.0
316
- def polygon_at(index)
317
- end
318
-
319
- # The {#polygon_points_at} method is used to retrieve the points for a polygon
320
- # that is at a specific index in the mesh.
321
- #
322
- # @example
323
- # mesh = Geom::PolygonMesh.new
324
- # point1 = Geom::Point3d.new(0, 1, 2)
325
- # point2 = Geom::Point3d.new(1, 0, 2)
326
- # point3 = Geom::Point3d.new(2, 0, 1)
327
- # index = mesh.add_polygon(point1, point2, point3)
328
- # points = mesh.polygon_points_at(index)
329
- #
330
- # @note Index starts at 1.
331
- #
332
- # @param [Integer] index
333
- # An index for a polygon in the mesh.
334
- #
335
- # @return [Array<Geom::Point3d>, nil]
336
- #
337
- # @version SketchUp 6.0
338
- def polygon_points_at(index)
339
- end
340
-
341
- # The {#polygons} method is used to retrieve an array of all polygons in the
342
- # mesh.
343
- #
344
- # The returned array contains an array that can have a negative value with the
345
- # sign indicating a hidden edge. For example, a return value of +[-1, 2, 3]+
346
- # indicates that the edge from +1+ to +2+ is hidden.
347
- #
348
- # @example
349
- # polygons = polygonmesh.polygons
350
- #
351
- # @return [Array<Array<Integer>>]
352
- #
353
- # @version SketchUp 6.0
354
- def polygons
355
- end
356
-
357
- # The {#set_point} method is used to set the point at a specific index in the
358
- # mesh.
359
- #
360
- # @example
361
- # mesh = Geom::PolygonMesh.new
362
- # point1 = Geom::Point3d.new(0, 1, 2)
363
- # point2 = Geom::Point3d.new(10, 20, 30)
364
- # index = mesh.add_point(point1)
365
- # mesh.set_point(index, point2)
366
- #
367
- # @note Index starts at 1.
368
- #
369
- # @param [Integer] index
370
- # The index where the point will be set.
371
- #
372
- # @param [Geom::Point3d] point
373
- # A Point3d object to set at the index.
374
- #
375
- # @return [Geom::PolygonMesh]
376
- #
377
- # @version SketchUp 6.0
378
- def set_point(index, point)
379
- end
380
-
381
- # The {#set_uv} method is used to define UV mapping coordinates to points in
382
- # the mesh.
383
- #
384
- # Beware that the polygons connected to the point will share UV coordiates so
385
- # UV mapping coordinates needs to be continuous across the polygon mesh.
386
- #
387
- # When setting the UV for a point one need to make sure to have the correct
388
- # index for the point. It's therefore best to add the points using {#add_point}
389
- # and use the index it returns for following calls to set_uv and
390
- # {#add_polygon}.
391
- #
392
- # If you are not able to calculate how many points there will be in your mesh
393
- # make sure to not specify an index in {#set_uv} higher than the number of
394
- # times you have called {#set_uv}.
395
- #
396
- # @example
397
- # mesh = Geom::PolygonMesh.new(4)
398
- # # Create points for a triangle.
399
- # point1 = Geom::Point3d.new(0, 0, 0)
400
- # point2 = Geom::Point3d.new(9, 0, 0)
401
- # point3 = Geom::Point3d.new(9, 9, 0)
402
- # point4 = Geom::Point3d.new(0, 9, 0)
403
- # # Create UV mapping to tile 2x cross triangle.
404
- # uv1 = Geom::Point3d.new(0, 0, 0)
405
- # uv2 = Geom::Point3d.new(2, 0, 0)
406
- # uv3 = Geom::Point3d.new(2, 2, 0)
407
- # uv4 = Geom::Point3d.new(0, 2, 0)
408
- # # Add points and UV data to mesh.
409
- # index1 = mesh.add_point(point1)
410
- # index2 = mesh.add_point(point2)
411
- # index3 = mesh.add_point(point3)
412
- # index4 = mesh.add_point(point4)
413
- # mesh.set_uv(index1, uv1, true)
414
- # mesh.set_uv(index2, uv2, true)
415
- # mesh.set_uv(index3, uv3, true)
416
- # mesh.set_uv(index4, uv4, true)
417
- # # Add polygons.
418
- # mesh.add_polygon(index1, index2, index3)
419
- # mesh.add_polygon(index1, index3, index4)
420
- #
421
- # @note If you don't specify how many points you will be adding to the mesh
422
- # when you initiate it you may risk the UV data becoming out of sync.
423
- #
424
- # @note Index starts at 1.
425
- #
426
- # @param [Integer] index
427
- # An Integer representing the UV index.
428
- #
429
- # @param [Geom::Point3d] point
430
- # A Point3d object representing UV coordinates.
431
- #
432
- # @param [Boolean] front
433
- # A boolean representing the front or back.
434
- #
435
- # @return [nil]
436
- #
437
- # @version SketchUp 2014
438
- def set_uv(index, point, front)
439
- end
440
-
441
- # The {#transform!} method is used to apply a transformation to a mesh.
442
- #
443
- # @example
444
- # point1 = Geom::Point3d.new(100, 200, 300)
445
- # tr = Geom::Transformation.new(point1)
446
- # mesh = Geom::PolygonMesh.new
447
- # point2 = Geom::Point3d.new(0, 1, 2)
448
- # mesh.add_point(point2)
449
- # mesh.transform!(tr)
450
- #
451
- # @param [Geom::Transformation] transformation
452
- #
453
- # @return [Geom::PolygonMesh]
454
- #
455
- # @version SketchUp 6.0
456
- def transform!(transformation)
457
- end
458
-
459
- # The {#uv_at} method is used to access a uv (texture coordinates) at a
460
- # specific index.
461
- #
462
- # "UVs" is a way of referring to the u,v texture coordinates (as
463
- # opposed to the X, Y, and Z axis that you construct your meshes on), which
464
- # are points defining 1-by-1 positions within an image. These coordinates
465
- # connect to points in your 3D model, to position an image texture onto it's
466
- # surface (similar to virtual "thumb tacks")
467
- #
468
- # These coordinates pin an exact spot on an image that you wish to use to
469
- # texture your model to a specific point on an object's surface. Between these
470
- # points, your software will stretch the image smoothly. This is what is
471
- # referred to as UV mapping.
472
- #
473
- # @example
474
- # point = mesh.uv_at(1, true)
475
- #
476
- # @note Index starts at 1.
477
- #
478
- # @param [Integer] index
479
- # The index for the texture coordinate.
480
- #
481
- # @param [Boolean] front
482
- # Set to +true+ to get the UV for the front size,
483
- # +false+ for the back side.
484
- #
485
- # @return [Geom::Point3d, nil] a Point3d object where the x equals the u
486
- # value and the y equals the v value.
487
- # Returns nil on failure.
488
- #
489
- # @version SketchUp 6.0
490
- def uv_at(index, front)
491
- end
492
-
493
- # The {#uvs} method is used to retrieve an array of uv coordinates in the
494
- # mesh.
495
- #
496
- # @example
497
- # # Get a mesh with front and back UVs.
498
- # mesh = face.mesh(1 | 2)
499
- # uvs = mesh.uvs(true)
500
- #
501
- # @param [Boolean] front
502
- #
503
- # @return [Array<Geom::Point3d>]
504
- #
505
- # @version SketchUp 6.0
506
- def uvs(front)
507
- end
508
-
509
- end
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The {#Geom::PolygonMesh} class contains methods to create polygon mesh
5
+ # structures. This is useful if you need to write a custom importer/exporter in
6
+ # Ruby that works at the level of triangulated polygons. For example, you can
7
+ # determine the triangles that make up a 15-sided {#Sketchup::Face} by using
8
+ # this class, or write a {#Sketchup::Importer} that reads a data file, creates
9
+ # a mesh from it, 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 {Sketchup::Face#mesh} method. See
13
+ # {Sketchup::Entities#add_faces_from_mesh} for an easy way to convert a mesh
14
+ # back into faces.
15
+ #
16
+ # @example
17
+ # entities = Sketchup.active_model.active_entities
18
+ # face = entities.add_face([1, 1, 1], [1, 2, 1], [2, 2, 1])
19
+ #
20
+ # mesh = face.mesh
21
+ #
22
+ # group = entities.add_group
23
+ # group.entities.add_faces_from_mesh(mesh)
24
+ #
25
+ # @note As of SketchUp 2022.0 the new {Sketchup::EntitiesBuilder} interface
26
+ # can be used to generate bulk geometry. It has similar performance as
27
+ # {Geom::PolygonMesh}, but with similar degree of per-entity control as
28
+ # {Sketchup::Entities}.
29
+ #
30
+ # @see file:pages/generating_geometry.md
31
+ # Guide on Generating Geometry
32
+ #
33
+ # @version SketchUp 6.0
34
+ class Geom::PolygonMesh
35
+
36
+ # Constants
37
+
38
+ AUTO_SOFTEN = nil # Stub value.
39
+ HIDE_BASED_ON_INDEX = nil # Stub value.
40
+ NO_SMOOTH_OR_HIDE = nil # Stub value.
41
+ SMOOTH_SOFT_EDGES = nil # Stub value.
42
+ SOFTEN_BASED_ON_INDEX = nil # Stub value.
43
+
44
+ MESH_NORMALS = nil # Stub value.
45
+ MESH_POINTS = nil # Stub value.
46
+ MESH_UVQ_BACK = nil # Stub value.
47
+ MESH_UVQ_FRONT = nil # Stub value.
48
+
49
+ # Instance Methods
50
+
51
+ # The {#add_point} method is used to add a point to the mesh.
52
+ #
53
+ # The returned index can be used for creating polygons.
54
+ #
55
+ # @example
56
+ # mesh = Geom::PolygonMesh.new
57
+ # point = Geom::Point3d.new(0, 1, 2)
58
+ # index = mesh.add_point(point)
59
+ #
60
+ # @note In SketchUp 2021.1 this method was improved to be faster.
61
+ # See {#initialize} for details.
62
+ #
63
+ # @param [Geom::Point3d] point
64
+ #
65
+ # @return [Integer] the index in the mesh for the point
66
+ #
67
+ # @version SketchUp 6.0
68
+ def add_point(point)
69
+ end
70
+
71
+ # The {#add_polygon} method is used for adding a polygon to a
72
+ # {Geom::PolygonMesh}. All variations of this method require at least 3 elements
73
+ # to define a polygon, although more may be given.
74
+ #
75
+ # @note In SketchUp 2021.1 this method was improved to be faster.
76
+ # See {#initialize} for details.
77
+ #
78
+ # @overload add_polygon(index, index, index, ...)
79
+ #
80
+ # Adds a polygon from a list of the mesh's vertex indices.
81
+ # @example
82
+ # mesh = Geom::PolygonMesh.new
83
+ # mesh.add_point(Geom::Point3d.new(0, 0, 0))
84
+ # mesh.add_point(Geom::Point3d.new(1, 0, 0))
85
+ # mesh.add_point(Geom::Point3d.new(1, 1, 0))
86
+ # polygon_index = mesh.add_polygon(1, 2, 3)
87
+ # @param [Integer] index
88
+ # An index of a vertex in the mesh. Remember that mesh indices start at 1.
89
+ # @param [Integer] ...
90
+ # Additional indices (optional)
91
+ #
92
+ # @overload add_polygon(index_array)
93
+ #
94
+ # Adds a polygon from an Array of the mesh's vertex indices.
95
+ # @example
96
+ # mesh = Geom::PolygonMesh.new
97
+ # mesh.add_point(Geom::Point3d.new(0, 0, 0))
98
+ # mesh.add_point(Geom::Point3d.new(1, 0, 0))
99
+ # mesh.add_point(Geom::Point3d.new(1, 1, 0))
100
+ # polygon_index = mesh.add_polygon([1, 2, 3])
101
+ # @param [Array<Integer>] index_array
102
+ # An {Array} of point indices.
103
+ #
104
+ # @overload add_polygon(point3d, point3d, point3d, ...)
105
+ #
106
+ # Adds a polygon from a list of Point3d objects.
107
+ # @example
108
+ # mesh = Geom::PolygonMesh.new
109
+ # point1 = Geom::Point3d.new(0, 1, 2)
110
+ # point2 = Geom::Point3d.new(1, 0, 2)
111
+ # point3 = Geom::Point3d.new(2, 0, 1)
112
+ # polygon_index = mesh.add_polygon(point1, point2, point3)
113
+ # @param [Geom::Point3d] point3d
114
+ # @raise [ArgumentError] When using Arrays in place of Point3d objects.
115
+ # Normally Arrays may be used in place of Point3d objects in most
116
+ # SketchUp methods. This method is an exception to that rule.
117
+ # @param [Geom::Point3d] ...
118
+ # Additional points (optional)
119
+ #
120
+ # @overload add_polygon(point3d_array)
121
+ #
122
+ # Adds a polygon from an Array of Point3d objects.
123
+ # @example
124
+ # mesh = Geom::PolygonMesh.new
125
+ # point1 = Geom::Point3d.new(0, 1, 2)
126
+ # point2 = Geom::Point3d.new(1, 0, 2)
127
+ # point3 = Geom::Point3d.new(2, 0, 1)
128
+ # polygon_index = mesh.add_polygon([point1, point2, point3])
129
+ # @param [Array<Geom::Point3d>] point3d_array
130
+ #
131
+ # @return [Integer] The 1-based index of the polygon in the mesh. +0+
132
+ # is returned if the method failed to create a polygon.
133
+ #
134
+ # @version SketchUp 6.0
135
+ def add_polygon(*args)
136
+ end
137
+
138
+ # The {#count_points} method is used to count the number of points in a mesh.
139
+ #
140
+ # @example
141
+ # mesh = Geom::PolygonMesh.new
142
+ # point = Geom::Point3d.new(0, 1, 2)
143
+ # mesh.add_point(point)
144
+ # number_points = mesh.count_points
145
+ #
146
+ # @return [Integer] the number of points in a mesh
147
+ #
148
+ # @version SketchUp 6.0
149
+ def count_points
150
+ end
151
+
152
+ # The {#count_polygons} count the number of polygons in the mesh.
153
+ #
154
+ # @example
155
+ # mesh = Geom::PolygonMesh.new
156
+ # point1 = Geom::Point3d.new(0, 1, 2)
157
+ # point2 = Geom::Point3d.new(1, 0, 2)
158
+ # point3 = Geom::Point3d.new(2, 0, 1)
159
+ # mesh.add_polygon(point1, point2, point3)
160
+ # number_polygons = mesh.count_polygons
161
+ #
162
+ # @return [Integer] the number of polygons in the mesh
163
+ #
164
+ # @version SketchUp 6.0
165
+ def count_polygons
166
+ end
167
+
168
+ # Create a new empty polygon mesh.
169
+ #
170
+ # The number of points and polygons are optional and are used as a hint to
171
+ # decide how much space to pre-allocate to speed up adding points and polygons.
172
+ #
173
+ # As of SketchUp 2021.1 the performance of looking up and inserting points is
174
+ # significantly better provided the mesh was initialized with roughly the
175
+ # correct number of total points.
176
+ #
177
+ # @example
178
+ # mesh = Geom::PolygonMesh.new
179
+ #
180
+ # @note When creating a mesh with normals and/or UVQ data it's critical that
181
+ # the number of points estimated is equal to or higher than the final number
182
+ # of points added. If fewer points are estimated the normals and UVQ data
183
+ # might end up out of sync.
184
+ #
185
+ # @overload initialize
186
+ #
187
+ # @return [Geom::PolygonMesh]
188
+ #
189
+ # @overload initialize(number_points)
190
+ #
191
+ # @param [Integer] number_points How many points will be in the mesh.
192
+ # @return [Geom::PolygonMesh]
193
+ #
194
+ # @overload initialize(number_points, number_polygons)
195
+ #
196
+ # @param [Integer] number_points How many points will be in the mesh.
197
+ # @param [Integer] number_polygons How many polygons will be in the mesh.
198
+ # @return [Geom::PolygonMesh]
199
+ #
200
+ # @raise [RangeError] If number of points or polygons are negative numbers.
201
+ #
202
+ # @version SketchUp 6.0
203
+ def initialize(*args)
204
+ end
205
+
206
+ # The {#normal_at} method is used to determine the vertex normal at a
207
+ # particular index in the mesh. This only works for meshes retrieved from
208
+ # {Sketchup::Face#mesh} with the +PolygonMeshNormals+ flag.
209
+ #
210
+ # @example
211
+ # model = Sketchup.active_model
212
+ # entity = model.active_entities
213
+ # face = entity.add_face([1, 1, 1], [2, 2, 1], [2, 1, 1])
214
+ #
215
+ # flags = 4 # PolygonMeshNormals
216
+ # mesh = face.mesh(flags)
217
+ # # The result is a Vector3d(0, 0, -1)
218
+ # normal = mesh.normal_at(1)
219
+ #
220
+ # @note Index starts at 1.
221
+ #
222
+ # @param [Integer] index
223
+ # The index in the mesh for the vertex normal to be
224
+ # retrieved
225
+ #
226
+ # @return [Geom::Vector3d, nil]
227
+ #
228
+ # @version SketchUp 6.0
229
+ def normal_at(index)
230
+ end
231
+
232
+ # The {#point_at} method is used to retrieve the point at a specific index in
233
+ # the mesh.
234
+ #
235
+ # @example
236
+ # mesh = Geom::PolygonMesh.new
237
+ # point1 = Geom::Point3d.new(0, 1, 2)
238
+ # point2 = Geom::Point3d.new(10, 20, 30)
239
+ # mesh.add_point(point1)
240
+ # mesh.add_point(point2)
241
+ # point_from_index = mesh.point_at(1)
242
+ #
243
+ # @note Index starts at 1.
244
+ #
245
+ # @param [Integer] index
246
+ # The index in the mesh for the point to be retrieved
247
+ #
248
+ # @return [Geom::Point3d, nil]
249
+ #
250
+ # @version SketchUp 6.0
251
+ def point_at(index)
252
+ end
253
+
254
+ # The {#point_index} method is used to retrieve the index of a point 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
+ # index = mesh.point_index(point2)
264
+ #
265
+ # @note Returns 0 if point is not found.
266
+ #
267
+ # @param [Geom::Point3d] point
268
+ #
269
+ # @return [Integer] the index in the mesh for the {Geom::Point3d} object
270
+ #
271
+ # @version SketchUp 6.0
272
+ def point_index(point)
273
+ end
274
+
275
+ # The {#points} method is used to retrieve an array of points (vertices) in the
276
+ # mesh
277
+ #
278
+ # @example
279
+ # mesh = Geom::PolygonMesh.new
280
+ # point1 = Geom::Point3d.new(0, 1, 2)
281
+ # point2 = Geom::Point3d.new(10, 20, 30)
282
+ # mesh.add_point(point1)
283
+ # mesh.add_point(point2)
284
+ # # Returns array of points in the mesh.
285
+ # points = mesh.points
286
+ #
287
+ # @return [Array<Geom::Point3d>]
288
+ #
289
+ # @version SketchUp 6.0
290
+ def points
291
+ end
292
+
293
+ # The {#polygon_at} method is used to retrieve an array of vertex index values
294
+ # for a polygon at a specific index.
295
+ #
296
+ # @example
297
+ # mesh = Geom::PolygonMesh.new
298
+ # point1 = Geom::Point3d.new(0, 1, 2)
299
+ # point2 = Geom::Point3d.new(1, 0, 2)
300
+ # point3 = Geom::Point3d.new(2, 0, 1)
301
+ # index = mesh.add_polygon(point1, point2, point3)
302
+ # polygon = mesh.polygon_at(index)
303
+ #
304
+ # @note Index starts at 1.
305
+ #
306
+ # @note The returned array can contain negative
307
+ # values with the sign indicating a hidden edge. For example, a return value
308
+ # of +[-1, 2, 3]+ indicates that the edge from +1+ to +2+ is hidden. The
309
+ # negative values should not be used as an index for {#point_at}, take the
310
+ # absolute value of the index value in the polygon array. So if you
311
+ # get +[-1, 2,3]+ use +1+ as the argument to {#point_at}.
312
+ #
313
+ # @param [Integer] index
314
+ # The index of the desired polygon.
315
+ #
316
+ # @return [Array<Integer>, nil]
317
+ #
318
+ # @version SketchUp 6.0
319
+ def polygon_at(index)
320
+ end
321
+
322
+ # The {#polygon_points_at} method is used to retrieve the points for a polygon
323
+ # that is at a specific index in the mesh.
324
+ #
325
+ # @example
326
+ # mesh = Geom::PolygonMesh.new
327
+ # point1 = Geom::Point3d.new(0, 1, 2)
328
+ # point2 = Geom::Point3d.new(1, 0, 2)
329
+ # point3 = Geom::Point3d.new(2, 0, 1)
330
+ # index = mesh.add_polygon(point1, point2, point3)
331
+ # points = mesh.polygon_points_at(index)
332
+ #
333
+ # @note Index starts at 1.
334
+ #
335
+ # @param [Integer] index
336
+ # An index for a polygon in the mesh.
337
+ #
338
+ # @return [Array<Geom::Point3d>, nil]
339
+ #
340
+ # @version SketchUp 6.0
341
+ def polygon_points_at(index)
342
+ end
343
+
344
+ # The {#polygons} method is used to retrieve an array of all polygons in the
345
+ # mesh.
346
+ #
347
+ # The returned array contains an array that can have a negative value with the
348
+ # sign indicating a hidden edge. For example, a return value of +[-1, 2, 3]+
349
+ # indicates that the edge from +1+ to +2+ is hidden.
350
+ #
351
+ # @example
352
+ # mesh = Geom::PolygonMesh.new
353
+ # mesh.add_point([0, 0, 0])
354
+ # mesh.add_point([1, 0, 0])
355
+ # mesh.add_point([1, 1, 0])
356
+ #
357
+ # mesh.add_polygon(1, 2, 3)
358
+ # mesh.add_polygon(-1, 3, 2)
359
+ # polygons = mesh.polygons
360
+ #
361
+ # @return [Array<Array<Integer>>]
362
+ #
363
+ # @version SketchUp 6.0
364
+ def polygons
365
+ end
366
+
367
+ # The {#set_point} method is used to set the point at a specific index in the
368
+ # mesh.
369
+ #
370
+ # @example
371
+ # mesh = Geom::PolygonMesh.new
372
+ # point1 = Geom::Point3d.new(0, 1, 2)
373
+ # point2 = Geom::Point3d.new(10, 20, 30)
374
+ # index = mesh.add_point(point1)
375
+ # mesh.set_point(index, point2)
376
+ #
377
+ # @note Index starts at 1.
378
+ #
379
+ # @param [Integer] index
380
+ # The index where the point will be set.
381
+ #
382
+ # @param [Geom::Point3d] point
383
+ # A Point3d object to set at the index.
384
+ #
385
+ # @return [Geom::PolygonMesh]
386
+ #
387
+ # @version SketchUp 6.0
388
+ def set_point(index, point)
389
+ end
390
+
391
+ # The {#set_uv} method is used to define UV mapping coordinates to points in
392
+ # the mesh.
393
+ #
394
+ # Beware that the polygons connected to the point will share UV coordiates so
395
+ # UV mapping coordinates needs to be continuous across the polygon mesh.
396
+ #
397
+ # When setting the UV for a point one need to make sure to have the correct
398
+ # index for the point. It's therefore best to add the points using {#add_point}
399
+ # and use the index it returns for following calls to set_uv and
400
+ # {#add_polygon}.
401
+ #
402
+ # If you are not able to calculate how many points there will be in your mesh
403
+ # make sure to not specify an index in {#set_uv} higher than the number of
404
+ # times you have called {#set_uv}.
405
+ #
406
+ # @example
407
+ # mesh = Geom::PolygonMesh.new(4)
408
+ # point1 = Geom::Point3d.new(0, 0, 0)
409
+ # point2 = Geom::Point3d.new(9, 0, 0)
410
+ # point3 = Geom::Point3d.new(9, 9, 0)
411
+ # point4 = Geom::Point3d.new(0, 9, 0)
412
+ #
413
+ # uv_point1 = Geom::Point3d.new(0, 0, 0)
414
+ # uv_point2 = Geom::Point3d.new(2, 0, 0)
415
+ # uv_point3 = Geom::Point3d.new(2, 2, 0)
416
+ # uv_point4 = Geom::Point3d.new(0, 2, 0)
417
+ #
418
+ # index1 = mesh.add_point(point1)
419
+ # index2 = mesh.add_point(point2)
420
+ # index3 = mesh.add_point(point3)
421
+ # index4 = mesh.add_point(point4)
422
+ # mesh.set_uv(index1, uv_point1, true)
423
+ # mesh.set_uv(index2, uv_point2, true)
424
+ # mesh.set_uv(index3, uv_point3, true)
425
+ # mesh.set_uv(index4, uv_point4, true)
426
+ #
427
+ # mesh.add_polygon(index1, index2, index3)
428
+ # mesh.add_polygon(index1, index3, index4)
429
+ #
430
+ # @note If you don't specify how many points you will be adding to the mesh
431
+ # when you initiate it you may risk the UV data becoming out of sync.
432
+ #
433
+ # @note Index starts at 1.
434
+ #
435
+ # @param [Integer] index
436
+ # An Integer representing the UV index.
437
+ #
438
+ # @param [Geom::Point3d] point
439
+ # A Point3d object representing UV coordinates.
440
+ #
441
+ # @param [Boolean] front
442
+ # A boolean representing the front or back.
443
+ #
444
+ # @return [nil]
445
+ #
446
+ # @version SketchUp 2014
447
+ def set_uv(index, point, front)
448
+ end
449
+
450
+ # The {#transform!} method is used to apply a transformation to a mesh.
451
+ #
452
+ # @example
453
+ # point1 = Geom::Point3d.new(100, 200, 300)
454
+ # transformation = Geom::Transformation.new(point1)
455
+ # mesh = Geom::PolygonMesh.new
456
+ # point2 = Geom::Point3d.new(0, 1, 2)
457
+ # mesh.add_point(point2)
458
+ # # The PolygonMesh contains a Point3d(100, 201, 302)
459
+ # mesh.transform!(transformation)
460
+ #
461
+ # @param [Geom::Transformation] transformation
462
+ #
463
+ # @return [Geom::PolygonMesh]
464
+ #
465
+ # @version SketchUp 6.0
466
+ def transform!(transformation)
467
+ end
468
+
469
+ # The {#uv_at} method is used to access a uv (texture coordinates) at a
470
+ # specific index.
471
+ #
472
+ # "UVs" is a way of referring to the u,v texture coordinates (as
473
+ # opposed to the X, Y, and Z axis that you construct your meshes on), which
474
+ # are points defining 1-by-1 positions within an image. These coordinates
475
+ # connect to points in your 3D model, to position an image texture onto it's
476
+ # surface (similar to virtual "thumb tacks")
477
+ #
478
+ # These coordinates pin an exact spot on an image that you wish to use to
479
+ # texture your model to a specific point on an object's surface. Between these
480
+ # points, your software will stretch the image smoothly. This is what is
481
+ # referred to as UV mapping.
482
+ #
483
+ # @example
484
+ # mesh = Geom::PolygonMesh.new
485
+ # index = mesh.add_point([2, 2, 2])
486
+ # uv_point = Geom::Point3d.new(1, 1, 0)
487
+ #
488
+ # mesh.set_uv(index, uv_point, true)
489
+ # point = mesh.uv_at(index, true)
490
+ #
491
+ # @note Index starts at 1.
492
+ #
493
+ # @param [Integer] index
494
+ # The index for the texture coordinate.
495
+ #
496
+ # @param [Boolean] front
497
+ # Set to +true+ to get the UV for the front size,
498
+ # +false+ for the back side.
499
+ #
500
+ # @return [Geom::Point3d, nil] a Point3d object where the x equals the u
501
+ # value and the y equals the v value.
502
+ # Returns nil on failure.
503
+ #
504
+ # @version SketchUp 6.0
505
+ def uv_at(index, front)
506
+ end
507
+
508
+ # The {#uvs} method is used to retrieve an array of uv coordinates in the
509
+ # mesh.
510
+ #
511
+ # @example
512
+ # model = Sketchup.active_model
513
+ # entity = model.active_entities
514
+ #
515
+ # face = entity.add_face([1, 1, 1], [1, 3, 1], [3, 3, 1])
516
+ # mesh = face.mesh(1 | 2)
517
+ #
518
+ # uv_point1 = Geom::Point3d.new(0, 0, 0)
519
+ # uv_point2 = Geom::Point3d.new(1, 0, 0)
520
+ # uv_point3 = Geom::Point3d.new(1, 1, 0)
521
+ # mesh.set_uv(1, uv_point1, true)
522
+ # mesh.set_uv(2, uv_point2, true)
523
+ # mesh.set_uv(3, uv_point3, true)
524
+ #
525
+ # uv_points = mesh.uvs(true)
526
+ #
527
+ # @param [Boolean] front
528
+ #
529
+ # @return [Array<Geom::Point3d>]
530
+ #
531
+ # @version SketchUp 6.0
532
+ def uvs(front)
533
+ end
534
+
535
+ end