sketchup-api-stubs 0.7.4 → 0.7.8

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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +148 -145
  3. data/lib/sketchup-api-stubs/stubs/{array.rb → Array.rb} +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -318
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +523 -492
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -691
  16. data/lib/sketchup-api-stubs/stubs/{geom.rb → Geom.rb} +351 -348
  17. data/lib/sketchup-api-stubs/stubs/{languagehandler.rb → LanguageHandler.rb} +93 -92
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -573
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +698 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -174
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +516 -514
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -143
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -349
  27. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  28. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  29. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  30. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -371
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  32. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  33. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -220
  34. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
  35. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  37. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
  38. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
  39. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -204
  40. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
  41. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  42. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -694
  43. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  44. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  45. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  48. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  49. data/lib/sketchup-api-stubs/stubs/{length.rb → Length.rb} +278 -278
  50. data/lib/sketchup-api-stubs/stubs/{numeric.rb → Numeric.rb} +249 -249
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -140
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -157
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +286 -281
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -328
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -577
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -281
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +619 -562
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -194
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +426 -329
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -72
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -102
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -312
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -38
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +396 -390
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +502 -508
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1205 -1119
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +272 -0
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -125
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -544
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -59
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +126 -125
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -750
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -697
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +292 -285
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -409
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -226
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -190
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +407 -393
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -82
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -303
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -285
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -244
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -136
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -112
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -416
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +318 -311
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -141
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -95
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1651 -1638
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -356
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +131 -132
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -284
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -770
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +363 -353
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -76
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +477 -456
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -364
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -44
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +459 -454
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +260 -257
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -57
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -211
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -225
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +837 -829
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -154
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -61
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1317 -1301
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -43
  140. data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +1360 -1310
  141. data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +353 -353
  142. data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +24 -24
  143. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -310
  144. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +496 -356
  145. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -229
  146. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
  147. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -633
  148. data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +683 -667
  149. data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -311
  150. data/lib/sketchup-api-stubs.rb +1 -1
  151. metadata +15 -12
@@ -1,577 +1,478 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The Camera class contains methods for creating and manipulating a camera.
5
- # The camera in SketchUp is the "point of view" from which you look at the
6
- # model.
7
- #
8
- # @example
9
- # # Create a camera from scratch with an "eye" position in
10
- # # x, y, z coordinates, a "target" position that
11
- # # defines what to look at, and an "up" vector.
12
- # eye = [1000,1000,1000]
13
- # target = [0,0,0]
14
- # up = [0,0,1]
15
- # my_camera = Sketchup::Camera.new eye, target, up
16
- #
17
- # # Get a handle to the current view and change its camera.
18
- # view = Sketchup.active_model.active_view
19
- # view.camera = my_camera
20
- #
21
- # @version SketchUp 6.0
22
- class Sketchup::Camera
23
-
24
- # Instance Methods
25
-
26
- # The aspect_ratio method is used to retrieve the aspect ratio of the Camera.
27
- #
28
- # @example
29
- # camera = Sketchup::Camera.new
30
- # ar = camera.aspect_ratio
31
- # if (ar)
32
- # UI.messagebox ar.to_s
33
- # else
34
- # UI.messagebox "Failure"
35
- # end
36
- #
37
- # @return aspectratio - an aspect ratio, such as 1.85, if
38
- # successful
39
- #
40
- # @version SketchUp 6.0
41
- def aspect_ratio
42
- end
43
-
44
- # The aspect_ratio= method is used to set the aspect ratio for a Camera.
45
- # Changing this value will cause SketchUp to show gray bars over the screen
46
- # to show the resulting view.
47
- #
48
- # If you set the value to 0.0, then the aspect ratio of the Camera will match
49
- # the aspect ratio of its View.
50
- #
51
- # @example
52
- # camera = Sketchup::Camera.new
53
- # ar = camera.aspect_ratio = 1.85
54
- # if (ar)
55
- # UI.messagebox ar.to_s
56
- # else
57
- # UI.messagebox "Failure"
58
- # end
59
- #
60
- # @param [Float] ratio
61
- #
62
- # @return aspectratio - an aspect ratio, such as 1.85, if
63
- # successful
64
- #
65
- # @version SketchUp 6.0
66
- def aspect_ratio=(ratio)
67
- end
68
-
69
- # The center_2d method returns a point with the x and y offset of the camera
70
- # when it's in 2d mode. When the camera is in two-point perspective and the
71
- # user pans around, the x and y values will change. These values are in
72
- # normalized device coordinates, so for instance, the range [-1.0, 1.0] spans
73
- # the full width or height of the screen.
74
- #
75
- # The z value is unused and it is always zero.
76
- #
77
- # @example
78
- # Sketchup.active_model.active_view.camera.center_2d
79
- #
80
- # @return Point3d
81
- #
82
- # @version SketchUp 2015
83
- def center_2d
84
- end
85
-
86
- # The description method is used to retrieve the description for a Camera
87
- # object.
88
- #
89
- # @example
90
- # camera = Sketchup::Camera.new
91
- # description = camera.description
92
- # if (description)
93
- # UI.messagebox description
94
- # else
95
- # UI.messagebox "Failure"
96
- # end
97
- #
98
- # @return description - a string description for the camera if
99
- # successful
100
- #
101
- # @version SketchUp 6.0
102
- def description
103
- end
104
-
105
- # The description= method is used to set the description for the Camera.
106
- #
107
- # @example
108
- # camera = Sketchup::Camera.new
109
- # description = camera.description = "35 mm Camera"
110
- #
111
- # @param [String] description
112
- #
113
- # @return description - a string description for the camera if
114
- # successful
115
- #
116
- # @version SketchUp 6.0
117
- def description=(description)
118
- end
119
-
120
- # The direction method is used to retrieve a Vector3d object in the direction
121
- # that the Camera is pointing.
122
- #
123
- # @example
124
- # camera = Sketchup::Camera.new
125
- # # Returns 0,0,-1 which indicates it is pointed down the Z axis
126
- # direction = camera.direction
127
- # if (direction)
128
- # UI.messagebox direction.to_s
129
- # else
130
- # UI.messagebox "Failure"
131
- # end
132
- #
133
- # @return direction - a Vector3d object pointing in the direction
134
- # that the Camera is pointing if successful
135
- #
136
- # @version SketchUp 6.0
137
- def direction
138
- end
139
-
140
- # The eye method is used to retrieve the eye Point3d object for the Camera.
141
- #
142
- # @example
143
- # camera = Sketchup::Camera.new
144
- # # Returns 0,0,1 which indicates it is right in line with the Z axis.
145
- # eye = camera.eye
146
- # if (eye)
147
- # UI.messagebox eye
148
- # else
149
- # UI.messagebox "Failure"
150
- # end
151
- #
152
- # @return eye - a Point3d object if successful
153
- #
154
- # @version SketchUp 6.0
155
- def eye
156
- end
157
-
158
- # The focal_length method is used to get the focal length in millimeters of
159
- # perspective Camera.
160
- #
161
- # This value is computed based on the field of view (see the fov method) and
162
- # the image width (see image_width).
163
- #
164
- # @example
165
- # camera = Sketchup::Camera.new
166
- # l = camera.focal_length
167
- # if (l)
168
- # UI.messagebox l.to_s
169
- # else
170
- # UI.messagebox "Failure"
171
- # end
172
- #
173
- # @param length
174
- # The focal length for the camera if successful.
175
- #
176
- # @return nil
177
- #
178
- # @version SketchUp 6.0
179
- def focal_length(length)
180
- end
181
-
182
- # The focal_length= method allows you to sent the focal length (in
183
- # millimeters) of a perspective camera. It must be between 1 and 3000,
184
- # inclusive. This is an alternate way of setting the field of view.
185
- #
186
- # @example
187
- # camera = Sketchup::Camera.new
188
- # l = camera.focal_length=120
189
- # if (l)
190
- # UI.messagebox l
191
- # else
192
- # UI.messagebox "Failure"
193
- # end
194
- #
195
- # @param [Float] value
196
- #
197
- # @return length - the new focal length for the camera if
198
- # successful
199
- #
200
- # @version SketchUp 6.0
201
- def focal_length=(value)
202
- end
203
-
204
- # The fov method retrieves the field of view of the camera (in degrees).
205
- #
206
- # This is only applicable to perspective cameras.
207
- #
208
- # @example
209
- # camera = Sketchup::Camera.new
210
- # fov = camera.fov
211
- # if (fov)
212
- # UI.messagebox fov.to_s
213
- # else
214
- # UI.messagebox "Failure"
215
- # end
216
- #
217
- # @return fov - field of view, in degrees, if successful
218
- #
219
- # @version SketchUp 6.0
220
- def fov
221
- end
222
-
223
- # The fov= method sets the field of view, in millimeters, for a Camera. It
224
- # must be between 1 and 120, inclusive.
225
- #
226
- # This is only valid on a perspective camera.
227
- #
228
- # @example
229
- # camera = Sketchup::Camera.new
230
- # fov = camera.fov = 56.78
231
- # if (fov)
232
- # UI.messagebox fov.to_s
233
- # else
234
- # UI.messagebox "Failure"
235
- # end
236
- #
237
- # @param fov
238
- # A field of view in millimeters.
239
- #
240
- # @return fov - the new field of view if successful
241
- #
242
- # @version SketchUp 6.0
243
- def fov=(fov)
244
- end
245
-
246
- # The fov_is_height? method indicates whether the field of view is horizontal
247
- # or vertical.
248
- #
249
- # @example
250
- # camera = Sketchup.active_model.active_view.camera
251
- # if camera.fov_is_height?
252
- # fov_vertical = camera.fov
253
- # # Compute the horizontal FOV.
254
- # else
255
- # fov_horizontal = camera.fov
256
- # # Compute the vertical FOV.
257
- # end
258
- #
259
- # @return [Boolean] bool - true if vertical, false otherwise
260
- #
261
- # @version SketchUp 2015
262
- def fov_is_height?
263
- end
264
-
265
- # The height method retrieves the height of a Camera in inches.
266
- #
267
- # This is only valid if it is not a perspective camera.
268
- #
269
- # @example
270
- # camera = Sketchup::Camera.new
271
- # camera.perspective = false
272
- # h = camera.height
273
- # if (h)
274
- # UI.messagebox h.to_s
275
- # else
276
- # UI.messagebox "Failure"
277
- # end
278
- #
279
- # @return height - height in current units if successful
280
- #
281
- # @version SketchUp 6.0
282
- def height
283
- end
284
-
285
- # The height= method is used to set the height for the Camera in inches.
286
- #
287
- # This is only valid if it is not a perspective camera.
288
- #
289
- # @example
290
- # camera = Sketchup::Camera.new
291
- # camera.perspective = false
292
- # h = camera.height = 20
293
- # if (h)
294
- # UI.messagebox h.to_s
295
- # else
296
- # UI.messagebox "Failure"
297
- # end
298
- #
299
- # @param [Float] value
300
- #
301
- # @return height - height in current units if successful
302
- #
303
- # @version SketchUp 6.0
304
- def height=(value)
305
- end
306
-
307
- # The image_width method retrieves the size of the image on the image plane of
308
- # the Camera.
309
- #
310
- # By default, this value is not set. If it is set, it is used in the
311
- # calculation of the focal length from the field of view. Unlike most length
312
- # values in SketchUp, the image_width and focal_length values are specified in
313
- # millimeters rather than in inches.
314
- #
315
- # @example
316
- # camera = Sketchup::Camera.new
317
- # w = camera.image_width
318
- # if (w)
319
- # UI.messagebox w.to_s
320
- # else
321
- # UI.messagebox "Failure"
322
- # end
323
- #
324
- # @return width - the width of the camera if successful
325
- #
326
- # @version SketchUp 6.0
327
- def image_width
328
- end
329
-
330
- # The image_width= method is used to set the size of the image on the "film"
331
- # for a perspective camera.
332
- #
333
- # The value is given in millimeters. It is used in the conversions between
334
- # field of view and focal length.
335
- #
336
- # @example
337
- # camera = Sketchup::Camera.new
338
- # w = camera.image_width=1.0
339
- # if (w)
340
- # UI.messagebox w.to_s
341
- # else
342
- # UI.messagebox "Failure"
343
- # end
344
- #
345
- # @param [Float] value
346
- #
347
- # @return width - the width of the camera if successful
348
- #
349
- # @version SketchUp 6.0
350
- def image_width=(value)
351
- end
352
-
353
- # Returns a new camera with eye (where the camera is) and targets (where the
354
- # camera is looking).
355
- #
356
- # @example
357
- # eye = Geom::Point3d.new(20, 5, 30)
358
- # target = Geom::Point3d.new(20, 60, 25)
359
- # up = Z_AXIS
360
- # camera = Sketchup::Camera.new(eye, target, up)
361
- #
362
- # @example Default paramaters
363
- # camera = Sketchup::Camera.new
364
- #
365
- # @overload initialize
366
- #
367
- # @return [Sketchup::Camera]
368
- #
369
- # @overload initialize(eye, target, up, perspective = true, fov = 30.0)
370
- #
371
- # @param [Geom::Point3d] eye See {#eye}.
372
- # @param [Geom::Point3d] target See {#target}.
373
- # @param [Geom::Point3d] up See {#up}.
374
- # @param [Boolean] perspective see {#perspective?}.
375
- # @param [Float] fov see {#fov}.
376
- # @return [Sketchup::Camera]
377
- #
378
- # @version SketchUp 6.0
379
- def initialize(*args)
380
- end
381
-
382
- # The is_2d? method indicates if the camera is in 2d mode. 2 point
383
- # perspective mode and PhotoMatch mode are 2d cameras.
384
- #
385
- # @example
386
- # Sketchup.active_model.active_view.camera.is_2d?
387
- #
388
- # @return [Boolean] Boolean - true if camera is in 2d mode, false otherwise
389
- #
390
- # @version SketchUp 2015
391
- def is_2d?
392
- end
393
-
394
- # The perspective= method is used to set whether or not this is a perspective
395
- # camera or an orthographic camera.
396
- #
397
- # @example
398
- # camera = Sketchup::Camera.new
399
- # status = camera.perspective = false
400
- # if (status)
401
- # UI.messagebox "Perspective"
402
- # else
403
- # UI.messagebox "Orthographic"
404
- # end
405
- #
406
- # @param perspective
407
- # true for perspective, false for orthographic
408
- #
409
- # @return status - true if perspective, false if orthographic
410
- #
411
- # @version SketchUp 6.0
412
- def perspective=(perspective)
413
- end
414
-
415
- # The perspective? method is used to determine whether a camera is a
416
- # perspective or orthographic camera.
417
- #
418
- # @example
419
- # camera = Sketchup::Camera.new
420
- # status = camera.perspective?
421
- # if (status)
422
- # UI.messagebox "Perspective"
423
- # else
424
- # UI.messagebox "Orthographic"
425
- # end
426
- #
427
- # @return [Boolean] status - true if perspective, false if orthographic
428
- #
429
- # @version SketchUp 6.0
430
- def perspective?
431
- end
432
-
433
- # The scale_2d method returns a float indicating the scaling factor of 2d
434
- # cameras.
435
- #
436
- # When the camera is in two-point perspective and the user uses the zoom tools,
437
- # this value will change. Zooming out will produce a value greater than 1.0.
438
- #
439
- # @example
440
- # Sketchup.active_model.active_view.camera.scale_2d
441
- #
442
- # @return float
443
- #
444
- # @version SketchUp 2015
445
- def scale_2d
446
- end
447
-
448
- # The {#set} method sets the camera orientation. You have to set the camera eye,
449
- # target and up parameters at the same time to make sure that you have a valid
450
- # camera definition.
451
- #
452
- # @example
453
- # camera = Sketchup::Camera.new
454
- # eye = Geom::Point3d.new(20, 5, 30)
455
- # target = Geom::Point3d.new(20, 60, 25)
456
- # up = Z_AXIS
457
- # camera.set(eye, target, up)
458
- #
459
- # @param [Geom::Point3d] eye
460
- # See {#eye}.
461
- #
462
- # @param [Geom::Point3d] target
463
- # See {#target}.
464
- #
465
- # @param [Geom::Point3d] up
466
- # See {#up}.
467
- #
468
- # @return [Sketchup::Camera]
469
- #
470
- # @version SketchUp 6.0
471
- def set(eye, target, up)
472
- end
473
-
474
- # The target method retrieves Point3d that the camera is pointing at.
475
- #
476
- # @example
477
- # camera = Sketchup::Camera.new
478
- # # Target point is 0,0,0
479
- # t = camera.target
480
- # if (t)
481
- # UI.messagebox t.to_s
482
- # else
483
- # UI.messagebox "Failure".
484
- # end
485
- #
486
- # @return target - a Point3d object if successful
487
- #
488
- # @version SketchUp 6.0
489
- def target
490
- end
491
-
492
- # The up method is used to retrieve the up vector for the camera. This is the
493
- # direction that the top of the camera is facing.
494
- #
495
- # @example
496
- # camera = Sketchup::Camera.new
497
- # # 0.0, 1.0, 0.0
498
- # up = camera.up
499
- # if (up)
500
- # UI.messagebox up.to_s
501
- # else
502
- # UI.messagebox "Failure"
503
- # end
504
- #
505
- # @return up - a Vector3d object if successful
506
- #
507
- # @version SketchUp 6.0
508
- def up
509
- end
510
-
511
- # The xaxis method is used to retrieve the x axis of the camera coordinate
512
- # system defined by the camera's direction and up vector.
513
- #
514
- # This value is computed from the cross product between the camera direction
515
- # and the up vector.
516
- #
517
- # @example
518
- # camera = Sketchup::Camera.new
519
- # # 1.0, 0.0, 0.0
520
- # v = camera.xaxis
521
- # if (v)
522
- # UI.messagebox v.to_s
523
- # else
524
- # UI.messagebox "Failure"
525
- # end
526
- #
527
- # @return vector - a Vector3d object if successful
528
- #
529
- # @version SketchUp 6.0
530
- def xaxis
531
- end
532
-
533
- # The yaxis method retrieves the y axis of the camera coordinate system
534
- # defined by the camera's direction and up vector.
535
- #
536
- # This value is computed to be perpendicular the camera x and z axes. It is
537
- # equivalent to the up direction, but is computed to make sure that it is
538
- # perpendicular to the direction.
539
- #
540
- # @example
541
- # camera = Sketchup::Camera.new
542
- # # 0.0, 1.0, 0.0
543
- # v = camera.yaxis
544
- # if (v)
545
- # UI.messagebox v.to_s
546
- # else
547
- # UI.messagebox "Failure"
548
- # end
549
- #
550
- # @return vector - a Vector3d object if successful
551
- #
552
- # @version SketchUp 6.0
553
- def yaxis
554
- end
555
-
556
- # The zaxis method retrieves the z axis of the camera coordinate system
557
- # defined by the camera's direction and up vector.
558
- #
559
- # This value is computed. It is the same as Camera.direction
560
- #
561
- # @example
562
- # camera = Sketchup::Camera.new
563
- # # 0.0, 1.0, 0.0
564
- # v = camera.zaxis
565
- # if (v)
566
- # UI.messagebox v.to_s
567
- # else
568
- # UI.messagebox "Failure"
569
- # end
570
- #
571
- # @return vector - a Vector3d object if successful
572
- #
573
- # @version SketchUp 6.0
574
- def zaxis
575
- end
576
-
577
- end
1
+ # Copyright:: Copyright 2022 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The Camera class contains methods for creating and manipulating a camera.
5
+ # The camera in SketchUp is the "point of view" from which you look at the
6
+ # model.
7
+ #
8
+ # @example
9
+ # # Create a camera from scratch with an "eye" position in
10
+ # # x, y, z coordinates, a "target" position that
11
+ # # defines what to look at, and an "up" vector.
12
+ # eye = [1000,1000,1000]
13
+ # target = [0,0,0]
14
+ # up = [0,0,1]
15
+ # my_camera = Sketchup::Camera.new eye, target, up
16
+ #
17
+ # # Get a handle to the current view and change its camera.
18
+ # view = Sketchup.active_model.active_view
19
+ # view.camera = my_camera
20
+ #
21
+ # @version SketchUp 6.0
22
+ class Sketchup::Camera
23
+
24
+ # Instance Methods
25
+
26
+ # The {#aspect_ratio} method is used to retrieve the aspect ratio of the Camera.
27
+ #
28
+ # `0.0` is the default value and denotes an aspect ratio matching that of the
29
+ # View.
30
+ #
31
+ # @example
32
+ # camera = Sketchup.active_model.active_view.camera
33
+ # aspect_ratio = camera.aspect_ratio
34
+ #
35
+ # @return [Float]
36
+ #
37
+ # @version SketchUp 6.0
38
+ def aspect_ratio
39
+ end
40
+
41
+ # The {#aspect_ratio=} method is used to set the aspect ratio for a Camera.
42
+ # Changing this value will cause SketchUp to show gray bars over the screen
43
+ # to show the resulting view.
44
+ #
45
+ # If you set the value to `0.0`, then the aspect ratio of the Camera will match
46
+ # the aspect ratio of its View.
47
+ #
48
+ # @example
49
+ # camera = Sketchup::Camera.new
50
+ # camera.aspect_ratio = 1.85
51
+ #
52
+ # @param [Float] ratio
53
+ #
54
+ # @version SketchUp 6.0
55
+ def aspect_ratio=(ratio)
56
+ end
57
+
58
+ # The {#center_2d} method returns a point with the x and y offset of the camera
59
+ # when it's in two-point perspective or math photo mode. When the camera is
60
+ # in two-point perspective and the user pans around, the x and y values will
61
+ # change. These values are in normalized device coordinates, so for instance,
62
+ # the range [-1.0, 1.0] spans the full width or height of the screen.
63
+ #
64
+ # The z value is unused and it is always zero.
65
+ #
66
+ # @example
67
+ # Sketchup.active_model.active_view.camera.center_2d
68
+ #
69
+ # @return [Geom::Point3d] ]
70
+ #
71
+ # @version SketchUp 2015
72
+ def center_2d
73
+ end
74
+
75
+ # The {#description} method is used to retrieve the description for a Camera.
76
+ #
77
+ # @example
78
+ # camera = Sketchup::Camera.new
79
+ # description = camera.description
80
+ #
81
+ # @return [String]
82
+ #
83
+ # @version SketchUp 6.0
84
+ def description
85
+ end
86
+
87
+ # The {#description=} method is used to set the description for the Camera.
88
+ #
89
+ # @example
90
+ # camera = Sketchup::Camera.new
91
+ # description = camera.description = "35 mm Camera"
92
+ #
93
+ # @param [String] description
94
+ #
95
+ # @version SketchUp 6.0
96
+ def description=(description)
97
+ end
98
+
99
+ # The {#direction} method is used to retrieve a Vector3d object in the
100
+ # direction that the Camera is pointing.
101
+ #
102
+ # @example
103
+ # camera = Sketchup::Camera.new
104
+ # direction = camera.direction
105
+ #
106
+ # @return [Geom::Vector3d]
107
+ #
108
+ # @version SketchUp 6.0
109
+ def direction
110
+ end
111
+
112
+ # The {#eye} method is used to retrieve the eye Point3d object for the Camera.
113
+ #
114
+ # @example
115
+ # camera = Sketchup::Camera.new
116
+ # eye = camera.eye
117
+ #
118
+ # @return [Geom::Point3d]
119
+ #
120
+ # @version SketchUp 6.0
121
+ def eye
122
+ end
123
+
124
+ # The focal_length method is used to get the focal length in millimeters of
125
+ # perspective Camera.
126
+ #
127
+ # This value is computed on the fly based on the camera {#fov} value and
128
+ # the camera {#image_width} value.
129
+ #
130
+ # @example
131
+ # # Calculate focal length based on camera's current #image_width.
132
+ # camera = Sketchup::Camera.new
133
+ # focal_length = camera.focal_length
134
+ #
135
+ # # If you want the 35 mm focal length equivalent, a common measurement of
136
+ # # camera field of view, you can instead calculate it from the #fov angle.
137
+ # camera = Sketchup.active_model.active_view.camera
138
+ # focal_length_35_eqv = 36.0 / (2 * Math.tan(camera.fov.degrees / 2))
139
+ #
140
+ # @return [Float]
141
+ #
142
+ # @version SketchUp 6.0
143
+ def focal_length(length)
144
+ end
145
+
146
+ # The {#focal_length=} method allows you to set the field of view by specifying
147
+ # a focal length in millimeters. Focal length must be between 1 and 3000,
148
+ # inclusive.
149
+ #
150
+ # The camera {#fov} value is set based on the provided +focal_length+ and
151
+ # the current {#image_width} for the camera.
152
+ #
153
+ # @example
154
+ # # Set field of view from focal length using camera's current #image_width.
155
+ # camera = Sketchup.active_model.active_view.camera
156
+ # camera.focal_length = 120
157
+ #
158
+ # # If you instead want to set the 35 mm focal length equivalent, a common
159
+ # # measurement of camera field of view, you can first convert it to an angle
160
+ # # and use #fov=.
161
+ # camera = Sketchup.active_model.active_view.camera
162
+ # focal_length_35_eqv = 120
163
+ # camera.fov = 2 * Math.atan(36.0 / (2 * focal_length_35_eqv)).radians
164
+ #
165
+ # @param [Float] focal_length
166
+ #
167
+ # @version SketchUp 6.0
168
+ def focal_length=(focal_length)
169
+ end
170
+
171
+ # The {#fov} method retrieves the field of view of the Camera.
172
+ #
173
+ # This is only applicable to perspective cameras.
174
+ #
175
+ # @example
176
+ # camera = Sketchup::Camera.new
177
+ # fov = camera.fov
178
+ #
179
+ # @return [Float] Field of view in degrees
180
+ #
181
+ # @version SketchUp 6.0
182
+ def fov
183
+ end
184
+
185
+ # The {#fov=} method sets the field of view for a Camera. Field of view
186
+ # must be between 1 and 120 degrees, inclusive.
187
+ #
188
+ # This is only valid on a perspective camera.
189
+ #
190
+ # @example
191
+ # camera = Sketchup::Camera.new
192
+ # fov = camera.fov = 56.78
193
+ #
194
+ # @param [Numeric] fov
195
+ # Field of view in degrees
196
+ #
197
+ # @version SketchUp 6.0
198
+ def fov=(fov)
199
+ end
200
+
201
+ # The {#fov_is_height?} method indicates whether the field of view is
202
+ # measured vertically, as opposed horizontally.
203
+ #
204
+ # @example
205
+ # camera = Sketchup.active_model.active_view.camera
206
+ # if camera.fov_is_height?
207
+ # fov_vertical = camera.fov
208
+ # # Compute the horizontal FOV.
209
+ # else
210
+ # fov_horizontal = camera.fov
211
+ # # Compute the vertical FOV.
212
+ # end
213
+ #
214
+ # @return [Boolean]
215
+ #
216
+ # @version SketchUp 2015
217
+ def fov_is_height?
218
+ end
219
+
220
+ # The {#height} method retrieves the height of a Camera.
221
+ #
222
+ # This is only valid if it is not a perspective camera.
223
+ #
224
+ # @example
225
+ # camera = Sketchup::Camera.new
226
+ # camera.perspective = false
227
+ # height = camera.height
228
+ #
229
+ # @return [Float] height in inches.
230
+ #
231
+ # @version SketchUp 6.0
232
+ def height
233
+ end
234
+
235
+ # The {#height=} method is used to set the height for the Camera in inches.
236
+ #
237
+ # This is only valid if it is not a perspective camera.
238
+ #
239
+ # @example
240
+ # camera = Sketchup::Camera.new
241
+ # camera.perspective = false
242
+ # camera.height = 20
243
+ #
244
+ # @param [Float] value
245
+ #
246
+ # @version SketchUp 6.0
247
+ def height=(value)
248
+ end
249
+
250
+ # The {#image_width} method returns the width of the image, as used to
251
+ # calculate the {#focal_length}. This value has no effect on how the view
252
+ # is displayed in SketchUp.
253
+ #
254
+ # The default value, 0, is interpreted by SketchUp as 36 mm (the width of
255
+ # traditional 35 mm film).
256
+ #
257
+ # @example
258
+ # camera = Sketchup::Camera.new
259
+ # width = camera.image_width
260
+ #
261
+ # @return [Float] Width in mm.
262
+ #
263
+ # @version SketchUp 6.0
264
+ def image_width
265
+ end
266
+
267
+ # The {#image_width=} method is used to set the width of the image, as used to
268
+ # calculate the {#focal_length}. This value has no effect on how the view
269
+ # is displayed in SketchUp.
270
+ #
271
+ # The default value, 0, is interpreted by SketchUp as 36 mm (the width of
272
+ # traditional 35 mm film).
273
+ #
274
+ # @example
275
+ # camera = Sketchup::Camera.new
276
+ # camera.image_width = 1.0
277
+ # focal_length = camera.focal_length
278
+ #
279
+ # @param [Float] image_width
280
+ # Width in mm.
281
+ #
282
+ # @version SketchUp 6.0
283
+ def image_width=(image_width)
284
+ end
285
+
286
+ # Returns a new camera with eye (where the camera is) and targets (where the
287
+ # camera is looking).
288
+ #
289
+ # @example
290
+ # eye = Geom::Point3d.new(20, 5, 30)
291
+ # target = Geom::Point3d.new(20, 60, 25)
292
+ # up = Z_AXIS
293
+ # camera = Sketchup::Camera.new(eye, target, up)
294
+ #
295
+ # @example Arbitrary camera
296
+ # camera = Sketchup::Camera.new
297
+ #
298
+ # @overload initialize
299
+ #
300
+ # @return [Sketchup::Camera]
301
+ #
302
+ # @overload initialize(eye, target, up, perspective = true, fov = 30.0)
303
+ #
304
+ # @param [Geom::Point3d] eye See {#eye}.
305
+ # @param [Geom::Point3d] target See {#target}.
306
+ # @param [Geom::Point3d] up See {#up}.
307
+ # @param [Boolean] perspective see {#perspective?}.
308
+ # @param [Float] fov see {#fov}.
309
+ # @return [Sketchup::Camera]
310
+ #
311
+ # @version SketchUp 6.0
312
+ def initialize(*args)
313
+ end
314
+
315
+ # The {#is_2d?} method indicates if the camera two-point perspective or match photo
316
+ # mode.
317
+ #
318
+ # @example
319
+ # Sketchup.active_model.active_view.camera.is_2d?
320
+ #
321
+ # @return [Boolean]
322
+ #
323
+ # @version SketchUp 2015
324
+ def is_2d?
325
+ end
326
+
327
+ # The {#perspective=} method is used to set whether or not this is a
328
+ # perspective camera or an orthographic camera.
329
+ #
330
+ # @example
331
+ # camera = Sketchup::Camera.new
332
+ # camera.perspective = false
333
+ #
334
+ # @param [Boolean] perspective
335
+ #
336
+ #
337
+ # @version SketchUp 6.0
338
+ def perspective=(perspective)
339
+ end
340
+
341
+ # The {#perspective?} method is used to determine whether a camera is a
342
+ # perspective or orthographic camera.
343
+ #
344
+ # @example
345
+ # camera = Sketchup::Camera.new
346
+ # status = camera.perspective?
347
+ # if (status)
348
+ # puts "Perspective"
349
+ # else
350
+ # puts "Orthographic"
351
+ # end
352
+ #
353
+ # @return [Boolean]
354
+ #
355
+ # @version SketchUp 6.0
356
+ def perspective?
357
+ end
358
+
359
+ # The {#scale_2d} method returns a float indicating the scaling factor of 2
360
+ # point perspective cameras.
361
+ #
362
+ # When the camera is in two-point perspective and the user uses the zoom tools,
363
+ # this value will change. Zooming out will produce a value greater than 1.0.
364
+ #
365
+ # @example
366
+ # Sketchup.active_model.active_view.camera.scale_2d
367
+ #
368
+ # @return float
369
+ #
370
+ # @version SketchUp 2015
371
+ def scale_2d
372
+ end
373
+
374
+ # The {#set} method sets the camera orientation. You have to set the camera eye,
375
+ # target and up parameters at the same time to make sure that you have a valid
376
+ # camera definition.
377
+ #
378
+ # @example
379
+ # camera = Sketchup::Camera.new
380
+ # eye = Geom::Point3d.new(20, 5, 30)
381
+ # target = Geom::Point3d.new(20, 60, 25)
382
+ # up = Z_AXIS
383
+ # camera.set(eye, target, up)
384
+ #
385
+ # @param [Geom::Point3d] eye
386
+ # See {#eye}.
387
+ #
388
+ # @param [Geom::Point3d] target
389
+ # See {#target}.
390
+ #
391
+ # @param [Geom::Point3d] up
392
+ # See {#up}.
393
+ #
394
+ # @return [Sketchup::Camera]
395
+ #
396
+ # @version SketchUp 6.0
397
+ def set(eye, target, up)
398
+ end
399
+
400
+ # The {#target} method retrieves Point3d that the camera is pointing at.
401
+ #
402
+ # @example
403
+ # camera = Sketchup::Camera.new
404
+ # target = camera.target
405
+ #
406
+ # @return [Geom::Point3d]
407
+ #
408
+ # @version SketchUp 6.0
409
+ def target
410
+ end
411
+
412
+ # The {#up} method is used to retrieve the up vector for the camera. This is
413
+ # the direction that the top of the camera is facing.
414
+ #
415
+ # @example
416
+ # camera = Sketchup::Camera.new
417
+ # up = camera.up
418
+ #
419
+ # @return [Geom::Vector3d]
420
+ #
421
+ # @version SketchUp 6.0
422
+ def up
423
+ end
424
+
425
+ # The {#xaxis} method is used to retrieve the x axis of the camera coordinate
426
+ # system.
427
+ #
428
+ # This value is computed from the cross product between the camera direction
429
+ # and the up vector.
430
+ #
431
+ # @example
432
+ # camera = Sketchup::Camera.new
433
+ # xaxis = camera.xaxis
434
+ #
435
+ # @return [Geom::Vector3d] ]
436
+ #
437
+ # @version SketchUp 6.0
438
+ def xaxis
439
+ end
440
+
441
+ # The {#yaxis} method retrieves the y axis of the camera coordinate system.
442
+ #
443
+ # This value is computed to be perpendicular the camera x and z axes. It is
444
+ # equivalent to the up direction, but is computed to make sure that it is
445
+ # perpendicular to the direction.
446
+ #
447
+ # @example
448
+ # camera = Sketchup::Camera.new
449
+ # # 0.0, 1.0, 0.0
450
+ # yaxis = camera.yaxis
451
+ #
452
+ # @return [Geom::Vector3d] ]
453
+ #
454
+ # @version SketchUp 6.0
455
+ def yaxis
456
+ end
457
+
458
+ # The {#zaxis} method retrieves the z axis of the camera coordinate system.
459
+ #
460
+ # This value is computed. It is the same as Camera.direction
461
+ #
462
+ # @example
463
+ # camera = Sketchup::Camera.new
464
+ # # 0.0, 1.0, 0.0
465
+ # v = camera.zaxis
466
+ # if (v)
467
+ # UI.messagebox v.to_s
468
+ # else
469
+ # UI.messagebox "Failure"
470
+ # end
471
+ #
472
+ # @return vector - a Vector3d object if successful
473
+ #
474
+ # @version SketchUp 6.0
475
+ def zaxis
476
+ end
477
+
478
+ end