sketchup-api-stubs 0.7.7 → 0.7.9

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +151 -147
  3. data/lib/sketchup-api-stubs/stubs/{array.rb → 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 +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 +509 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -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 -351
  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 +747 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -179
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -515
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  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 -370
  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 -225
  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 -209
  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/ReferenceEntity.rb +82 -0
  43. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -694
  44. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  45. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  49. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  50. data/lib/sketchup-api-stubs/stubs/{length.rb → Length.rb} +278 -278
  51. data/lib/sketchup-api-stubs/stubs/{numeric.rb → Numeric.rb} +249 -249
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -157
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -577
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -594
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -425
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1126
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -0
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -917
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -405
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -327
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1654
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -478
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -257
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -835
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -71
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1307
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
  143. data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +1377 -1353
  144. data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +353 -353
  145. data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +24 -24
  146. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -317
  147. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -478
  148. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
  149. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
  150. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -633
  151. data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +683 -672
  152. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
  153. data/lib/sketchup-api-stubs.rb +1 -1
  154. metadata +20 -16
@@ -1,478 +1,478 @@
1
- # Copyright:: Copyright 2021 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
1
+ # Copyright:: Copyright 2023 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