sketchup-api-stubs 0.1.2 → 0.2.0
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.
- checksums.yaml +4 -4
- data/SketchUp/Geom/BoundingBox.rb +17 -20
- data/SketchUp/Geom/Bounds2d.rb +172 -0
- data/SketchUp/Geom/LatLong.rb +31 -16
- data/SketchUp/Geom/OrientedBounds2d.rb +102 -0
- data/SketchUp/Geom/Point2d.rb +365 -0
- data/SketchUp/Geom/Point3d.rb +121 -110
- data/SketchUp/Geom/PolygonMesh.rb +30 -21
- data/SketchUp/Geom/Transformation.rb +8 -4
- data/SketchUp/Geom/Transformation2d.rb +125 -0
- data/SketchUp/Geom/UTM.rb +43 -37
- data/SketchUp/Geom/Vector2d.rb +497 -0
- data/SketchUp/Geom/Vector3d.rb +143 -131
- data/SketchUp/Layout.rb +25 -0
- data/SketchUp/Layout/AngularDimension.rb +569 -0
- data/SketchUp/Layout/AutoTextDefinition.rb +417 -0
- data/SketchUp/Layout/AutoTextDefinitions.rb +186 -0
- data/SketchUp/Layout/ConnectionPoint.rb +70 -0
- data/SketchUp/Layout/Document.rb +458 -0
- data/SketchUp/Layout/Ellipse.rb +29 -0
- data/SketchUp/Layout/Entities.rb +155 -0
- data/SketchUp/Layout/Entity.rb +363 -0
- data/SketchUp/Layout/FormattedText.rb +349 -0
- data/SketchUp/Layout/Grid.rb +131 -0
- data/SketchUp/Layout/Group.rb +261 -0
- data/SketchUp/Layout/Image.rb +86 -0
- data/SketchUp/Layout/Label.rb +371 -0
- data/SketchUp/Layout/Layer.rb +222 -0
- data/SketchUp/Layout/LayerInstance.rb +128 -0
- data/SketchUp/Layout/Layers.rb +232 -0
- data/SketchUp/Layout/LinearDimension.rb +563 -0
- data/SketchUp/Layout/LockedEntityError.rb +10 -0
- data/SketchUp/Layout/LockedLayerError.rb +11 -0
- data/SketchUp/Layout/Page.rb +187 -0
- data/SketchUp/Layout/PageInfo.rb +393 -0
- data/SketchUp/Layout/Pages.rb +216 -0
- data/SketchUp/Layout/Path.rb +326 -0
- data/SketchUp/Layout/Rectangle.rb +174 -0
- data/SketchUp/Layout/SketchUpModel.rb +522 -0
- data/SketchUp/Layout/Style.rb +1520 -0
- data/SketchUp/Layout/Table.rb +290 -0
- data/SketchUp/Layout/TableCell.rb +149 -0
- data/SketchUp/Layout/TableColumn.rb +139 -0
- data/SketchUp/Layout/TableRow.rb +135 -0
- data/SketchUp/Sketchup/Animation.rb +7 -4
- data/SketchUp/Sketchup/ArcCurve.rb +10 -10
- data/SketchUp/Sketchup/AttributeDictionaries.rb +13 -4
- data/SketchUp/Sketchup/AttributeDictionary.rb +12 -12
- data/SketchUp/Sketchup/Color.rb +68 -78
- data/SketchUp/Sketchup/ComponentDefinition.rb +60 -60
- data/SketchUp/Sketchup/ComponentInstance.rb +57 -55
- data/SketchUp/Sketchup/DefinitionList.rb +34 -17
- data/SketchUp/Sketchup/Drawingelement.rb +19 -21
- data/SketchUp/Sketchup/Edge.rb +22 -24
- data/SketchUp/Sketchup/Entities.rb +173 -162
- data/SketchUp/Sketchup/Entity.rb +71 -55
- data/SketchUp/Sketchup/Face.rb +45 -44
- data/SketchUp/Sketchup/Group.rb +47 -49
- data/SketchUp/Sketchup/Image.rb +16 -0
- data/SketchUp/Sketchup/ImageRep.rb +226 -0
- data/SketchUp/Sketchup/InstancePath.rb +13 -13
- data/SketchUp/Sketchup/Layer.rb +15 -17
- data/SketchUp/Sketchup/Material.rb +40 -30
- data/SketchUp/Sketchup/Materials.rb +40 -22
- data/SketchUp/Sketchup/Menu.rb +5 -5
- data/SketchUp/Sketchup/Model.rb +230 -228
- data/SketchUp/Sketchup/Page.rb +32 -0
- data/SketchUp/Sketchup/Pages.rb +3 -4
- data/SketchUp/Sketchup/RenderingOptions.rb +21 -16
- data/SketchUp/Sketchup/SectionPlane.rb +64 -0
- data/SketchUp/Sketchup/Selection.rb +20 -28
- data/SketchUp/Sketchup/ShadowInfo.rb +14 -14
- data/SketchUp/Sketchup/Text.rb +24 -26
- data/SketchUp/Sketchup/Texture.rb +28 -12
- data/SketchUp/Sketchup/Vertex.rb +14 -11
- data/SketchUp/Sketchup/View.rb +126 -116
- data/SketchUp/UI/Command.rb +17 -17
- data/SketchUp/UI/HtmlDialog.rb +8 -5
- data/SketchUp/UI/Notification.rb +1 -1
- data/SketchUp/UI/Toolbar.rb +13 -14
- data/SketchUp/UI/WebDialog.rb +55 -59
- data/SketchUp/_top_level.rb +139 -27
- data/SketchUp/{Array.rb → array.rb} +167 -30
- data/SketchUp/{Geom.rb → geom.rb} +9 -7
- data/SketchUp/{LanguageHandler.rb → languagehandler.rb} +15 -15
- data/SketchUp/{Length.rb → length.rb} +15 -15
- data/SketchUp/{Numeric.rb → numeric.rb} +19 -19
- data/SketchUp/sketchup.rb +167 -156
- data/SketchUp/{SketchupExtension.rb → sketchupextension.rb} +27 -27
- data/SketchUp/{String.rb → string.rb} +1 -1
- data/SketchUp/ui.rb +113 -87
- metadata +46 -9
@@ -0,0 +1,365 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The {Geom::Vector2d} class allows you to work with a point in 2D space.
|
5
|
+
# {Geom::Point2d} is basically just a series of values representing x and y
|
6
|
+
# coordinates.
|
7
|
+
#
|
8
|
+
# The values are specified as [x, y]. For example [1, 1].
|
9
|
+
# To create a point call Geom::Point2d.new, where the creation method
|
10
|
+
# can take a variety of arguments:
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# # No arguments, creates a point at the origin [0, 0]
|
14
|
+
# pt1 = Geom::Point2d.new
|
15
|
+
#
|
16
|
+
# # Creates a point at x of 1, y of 2.
|
17
|
+
# pt2 = Geom::Point2d.new(1, 2)
|
18
|
+
#
|
19
|
+
# # You can also create a point directly by simply assigning the x, and y
|
20
|
+
# # values to a variable as an array:
|
21
|
+
# pt3 = [1, 2]
|
22
|
+
#
|
23
|
+
# @version LayOut 2018
|
24
|
+
class Geom::Point2d
|
25
|
+
|
26
|
+
# Instance Methods
|
27
|
+
|
28
|
+
# The {#+} operator is a simple way to add to the current x and y values of the
|
29
|
+
# {Geom::Point2d}, or to set the values of the {Geom::Point2d} by adding a
|
30
|
+
# {Geom::Vector2d} to the {Geom::Point2d}.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# pt = [1, 1]
|
34
|
+
# # the result is a Point2d(2, 3)
|
35
|
+
# pt2 = pt + [1, 2]
|
36
|
+
#
|
37
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
38
|
+
#
|
39
|
+
# @return [Geom::Point2d]
|
40
|
+
#
|
41
|
+
# @version LayOut 2018
|
42
|
+
def +(vector)
|
43
|
+
end
|
44
|
+
|
45
|
+
# The {#-} operator is a simple way to subtract from the current x and y values
|
46
|
+
# of the {Geom::Point2d}.
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# vec = Geom::Vector2d.new(1, 2)
|
50
|
+
# # result is a Point2d(3, 0)
|
51
|
+
# pt = [4, 2] - vec
|
52
|
+
# # result is a Vector2d(1, 2)
|
53
|
+
# vec2 = [4, 2] - pt
|
54
|
+
#
|
55
|
+
# @overload -(vector)
|
56
|
+
#
|
57
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
58
|
+
# @return [Geom::Point2d]
|
59
|
+
#
|
60
|
+
# @overload -(point)
|
61
|
+
#
|
62
|
+
# @param [Geom::Point2d] point2d
|
63
|
+
# @return [Geom::Vector2d] a vector indicating the difference between the two
|
64
|
+
# points
|
65
|
+
#
|
66
|
+
# @version LayOut 2018
|
67
|
+
def -(arg)
|
68
|
+
end
|
69
|
+
|
70
|
+
# The {#==} method compares two points for equality. This uses the standard
|
71
|
+
# SketchUp tolerance to determine if two points are the same.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# point1 = Geom::Point2d.new(1, 1)
|
75
|
+
# point2 = Geom::Point2d.new(0, 1)
|
76
|
+
# status = point1 == point2
|
77
|
+
#
|
78
|
+
# @param [Geom::Point2d, Array(Numeric, Numeric)] point
|
79
|
+
#
|
80
|
+
# @return [Boolean]
|
81
|
+
#
|
82
|
+
# @version LayOut 2018
|
83
|
+
def ==(point)
|
84
|
+
end
|
85
|
+
|
86
|
+
# The {#[]} method returns the value of the {Geom::Point2d} at the specified
|
87
|
+
# index.
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# point = Geom::Point2d.new(1, 2)
|
91
|
+
#
|
92
|
+
# # returns the y value of 2
|
93
|
+
# yvalue = point[1]
|
94
|
+
#
|
95
|
+
# @param [Integer] index
|
96
|
+
# The index for a specific x or y value in the
|
97
|
+
# {Geom::Point2d}
|
98
|
+
#
|
99
|
+
# @return [Length] The new x or y value if successful
|
100
|
+
#
|
101
|
+
# @version LayOut 2018
|
102
|
+
def [](index)
|
103
|
+
end
|
104
|
+
|
105
|
+
# The {#[]=} method sets the x or y value of the {Geom::Point2d} based on the
|
106
|
+
# specific index of the value.
|
107
|
+
#
|
108
|
+
# @example
|
109
|
+
# point = Geom::Point2d.new(1,2)
|
110
|
+
# point[1] = 4
|
111
|
+
#
|
112
|
+
# @param [Integer] index
|
113
|
+
# The index for a specific x or y value in the
|
114
|
+
# {Geom::Point2d} to set
|
115
|
+
#
|
116
|
+
# @param [Numeric] value
|
117
|
+
# The value to set for x or y
|
118
|
+
#
|
119
|
+
# @return [Numeric] The new x or y value if successful
|
120
|
+
#
|
121
|
+
# @version LayOut 2018
|
122
|
+
def []=(index, value)
|
123
|
+
end
|
124
|
+
|
125
|
+
# The {#clone} method creates another point identical to the {Geom::Point2d}
|
126
|
+
# being cloned.
|
127
|
+
#
|
128
|
+
# @example
|
129
|
+
# point = Geom::Point2d.new(1, 2)
|
130
|
+
# newpoint = point.clone
|
131
|
+
#
|
132
|
+
# @return [Geom::Point2d] the cloned {Geom::Point2d} object
|
133
|
+
#
|
134
|
+
# @version LayOut 2018
|
135
|
+
def clone
|
136
|
+
end
|
137
|
+
|
138
|
+
# The {#distance} method computes the distance from the {Geom::Point2d} to
|
139
|
+
# another {Geom::Point2d}.
|
140
|
+
#
|
141
|
+
# @example
|
142
|
+
# point1 = Geom::Point2d.new(1, 1)
|
143
|
+
# point2 = Geom::Point2d.new(1, 4)
|
144
|
+
# # result is a value of 3
|
145
|
+
# distance = point1.distance(point2)
|
146
|
+
#
|
147
|
+
# @param [Geom::Point2d, Array(Numeric, Numeric)] point
|
148
|
+
#
|
149
|
+
# @return [Numeric] the distance between the points in the current units
|
150
|
+
#
|
151
|
+
# @version LayOut 2018
|
152
|
+
def distance(point)
|
153
|
+
end
|
154
|
+
|
155
|
+
# The {.new} method creates a new {Geom::Point2d}.
|
156
|
+
#
|
157
|
+
# @example
|
158
|
+
# # No arguments, creates a point at the origin [0, 0]
|
159
|
+
# pt1 = Geom::Point2d.new
|
160
|
+
#
|
161
|
+
# # Creates a point at x of 1 and y of 2.
|
162
|
+
# pt2 = Geom::Point2d.new(1, 2)
|
163
|
+
#
|
164
|
+
# # You can also create a point directly by simply assigning the x and y
|
165
|
+
# # values to a variable as an array:
|
166
|
+
# pt3 = [1, 2]
|
167
|
+
#
|
168
|
+
# @overload initialize
|
169
|
+
#
|
170
|
+
# @return [Geom::Point2d]
|
171
|
+
#
|
172
|
+
# @overload initialize(point)
|
173
|
+
#
|
174
|
+
# @param [Geom::Point2d, Array(Numeric, Numeric)] point
|
175
|
+
# @return [Geom::Point2d]
|
176
|
+
#
|
177
|
+
# @overload initialize(x, y)
|
178
|
+
#
|
179
|
+
# @param [Numeric] x The location along the x axis
|
180
|
+
# @param [Numeric] y The location along the y axis
|
181
|
+
# @return [Geom::Point2d]
|
182
|
+
#
|
183
|
+
# @version LayOut 2018
|
184
|
+
def initialize(*args)
|
185
|
+
end
|
186
|
+
|
187
|
+
# The {#inspect} method formats the {Geom::Point2d} as a string.
|
188
|
+
#
|
189
|
+
# @example
|
190
|
+
# point = Geom::Point2d.new(1, 2)
|
191
|
+
# string = point.inspect
|
192
|
+
#
|
193
|
+
# @return [String]
|
194
|
+
#
|
195
|
+
# @version LayOut 2018
|
196
|
+
def inspect
|
197
|
+
end
|
198
|
+
|
199
|
+
# The {#offset} method offsets the {Geom::Point2d} by a {Geom::Vector2d} and
|
200
|
+
# returns a new {Geom::Point2d}. If distance is provided, it must be non-zero.
|
201
|
+
#
|
202
|
+
# @example
|
203
|
+
# point = Geom::Point2d.new
|
204
|
+
# vector = Geom::Vector2d.new(0, 2)
|
205
|
+
# # result is a Point2d(0, 1)
|
206
|
+
# point2 = point1.offset(vector, 1)
|
207
|
+
#
|
208
|
+
# @overload offset(vector)
|
209
|
+
#
|
210
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
211
|
+
# @return [Geom::Point2d]
|
212
|
+
#
|
213
|
+
# @overload offset(vector, distance)
|
214
|
+
#
|
215
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
216
|
+
# @param [Numeric] distance The how far along the vector to offset
|
217
|
+
# @return [Geom::Point2d]
|
218
|
+
#
|
219
|
+
# @version LayOut 2018
|
220
|
+
def offset(*args)
|
221
|
+
end
|
222
|
+
|
223
|
+
# The {#offset!} method offsets the {Geom::Point2d} by a {Geom::Vector2d}.
|
224
|
+
# The {Geom::Point2d} itself is modified. The length of the vector must not be
|
225
|
+
# zero.
|
226
|
+
#
|
227
|
+
# @example
|
228
|
+
# point = Geom::Point2d.new
|
229
|
+
# vector = Geom::Vector2d.new(0, 2)
|
230
|
+
# # result is a Point2d(0, 1)
|
231
|
+
# point1.offset!(vector, 1)
|
232
|
+
#
|
233
|
+
# @overload offset!(vector)
|
234
|
+
#
|
235
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
236
|
+
# @return [Geom::Point2d]
|
237
|
+
#
|
238
|
+
# @overload offset!(vector, distance)
|
239
|
+
#
|
240
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
241
|
+
# @param [Numeric] distance The distance along the vector to offset
|
242
|
+
# @return [Geom::Point2d]
|
243
|
+
#
|
244
|
+
# @version LayOut 2018
|
245
|
+
def offset!(*args)
|
246
|
+
end
|
247
|
+
|
248
|
+
# The {#set!} method sets the values of the {Geom::Point2d}.
|
249
|
+
#
|
250
|
+
# @example
|
251
|
+
# point = Geom::Point2d.new(1, 2)
|
252
|
+
# point = point.set!([4, 5])
|
253
|
+
#
|
254
|
+
# @overload set!(point)
|
255
|
+
#
|
256
|
+
# @param [Geom::Point2d, Array(Numeric, Numeric)] point
|
257
|
+
# @return [Geom::Point2d]
|
258
|
+
#
|
259
|
+
# @overload set!(x, y)
|
260
|
+
#
|
261
|
+
# @param [Numeric] x
|
262
|
+
# @param [Numeric] y
|
263
|
+
# @return [Geom::Point2d]
|
264
|
+
#
|
265
|
+
# @version LayOut 2018
|
266
|
+
def set!(*args)
|
267
|
+
end
|
268
|
+
|
269
|
+
# The {#to_a} method converts the {Geom::Point2d} to an array of 2 numbers.
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# point = Geom::Point2d.new(1, 2)
|
273
|
+
# array = point.to_a
|
274
|
+
#
|
275
|
+
# @return [Array(Numeric, Numeric)] an array of two numbers representing x, y
|
276
|
+
# of the {Geom::Point2d}
|
277
|
+
#
|
278
|
+
# @version LayOut 2018
|
279
|
+
def to_a
|
280
|
+
end
|
281
|
+
|
282
|
+
# The {#to_s} method returns a string representation of the {Geom::Point2d}.
|
283
|
+
#
|
284
|
+
# @example
|
285
|
+
# point = Geom::Point2d.new(1, 2)
|
286
|
+
# str = point.to_s
|
287
|
+
#
|
288
|
+
# @return [String]
|
289
|
+
#
|
290
|
+
# @version LayOut 2018
|
291
|
+
def to_s
|
292
|
+
end
|
293
|
+
|
294
|
+
# The {#vector_to} method returns the vector between points.
|
295
|
+
#
|
296
|
+
# @example
|
297
|
+
# pt1 = Geom::Point2d.new(1, 1)
|
298
|
+
# pt2 = Geom::Point2d.new(3, 1)
|
299
|
+
#
|
300
|
+
# # result is a Vector2d(2, 0)
|
301
|
+
# vec = pt1.vector_to(pt2) # is equivalent to (pt2 - pt1)
|
302
|
+
#
|
303
|
+
# @param [Geom::Point2d] point
|
304
|
+
#
|
305
|
+
# @return [Geom::Vector2d]
|
306
|
+
#
|
307
|
+
# @version LayOut 2018
|
308
|
+
def vector_to(point)
|
309
|
+
end
|
310
|
+
|
311
|
+
# The {#x} method returns the x value of the {Geom::Point2d}.
|
312
|
+
#
|
313
|
+
# @example
|
314
|
+
# point = Geom::Point2d.new(1, 2)
|
315
|
+
# x = point.x
|
316
|
+
#
|
317
|
+
# @return [Length] the x value of the {Geom::Point2d}
|
318
|
+
#
|
319
|
+
# @version LayOut 2018
|
320
|
+
def x
|
321
|
+
end
|
322
|
+
|
323
|
+
# The {#x=} method sets the x value of the {Geom::Point2d}.
|
324
|
+
#
|
325
|
+
# @example
|
326
|
+
# point = Geom::Point2d.new(1, 2)
|
327
|
+
# point.x = 7
|
328
|
+
#
|
329
|
+
# @param [Numeric] x
|
330
|
+
# The desired x value of the {Geom::Point2d}
|
331
|
+
#
|
332
|
+
# @return [Numeric] The new x value of the {Geom::Point2d}
|
333
|
+
#
|
334
|
+
# @version LayOut 2018
|
335
|
+
def x=(x)
|
336
|
+
end
|
337
|
+
|
338
|
+
# The {#y} method returns the y value of the {Geom::Point2d}.
|
339
|
+
#
|
340
|
+
# @example
|
341
|
+
# point = Geom::Point2d.new(1, 2)
|
342
|
+
# y = point.y
|
343
|
+
#
|
344
|
+
# @return [Length] The y value of the {Geom::Point2d}
|
345
|
+
#
|
346
|
+
# @version LayOut 2018
|
347
|
+
def y
|
348
|
+
end
|
349
|
+
|
350
|
+
# The {#y=} method sets the y value of the {Geom::Point2d}.
|
351
|
+
#
|
352
|
+
# @example
|
353
|
+
# point = Geom::Point2d.new(1, 2)
|
354
|
+
# point.y = 7
|
355
|
+
#
|
356
|
+
# @param [Numeric] y
|
357
|
+
# The desired y value of the {Geom::Point2d}
|
358
|
+
#
|
359
|
+
# @return [Numeric] The new y value of the {Geom::Point2d}
|
360
|
+
#
|
361
|
+
# @version LayOut 2018
|
362
|
+
def y=(y)
|
363
|
+
end
|
364
|
+
|
365
|
+
end
|
data/SketchUp/Geom/Point3d.rb
CHANGED
@@ -39,30 +39,30 @@ class Geom::Point3d
|
|
39
39
|
# point = weight1 * point1 + weight2 * point2.
|
40
40
|
#
|
41
41
|
# @example
|
42
|
-
# point1 = Geom::Point3d.new
|
43
|
-
# point2 = Geom::Point3d.new
|
42
|
+
# point1 = Geom::Point3d.new(1,1,1)
|
43
|
+
# point2 = Geom::Point3d.new(10,10,10)
|
44
44
|
# # Gets the point on the line segment connecting point1 and point2 that is
|
45
45
|
# # 3/4 the way from point1 to point2.
|
46
|
-
# point = Geom::Point3d.linear_combination
|
46
|
+
# point = Geom::Point3d.linear_combination(0.25, point1, 0.75, point2)
|
47
47
|
# if (point)
|
48
|
-
# UI.messagebox
|
48
|
+
# UI.messagebox(point)
|
49
49
|
# else
|
50
|
-
# UI.messagebox
|
50
|
+
# UI.messagebox("Failure")
|
51
51
|
# end
|
52
52
|
#
|
53
|
-
# @param weight1
|
53
|
+
# @param [Float] weight1
|
54
54
|
# A weight or percentage.
|
55
55
|
#
|
56
|
-
# @param
|
57
|
-
# The start point on the line.
|
58
|
-
#
|
59
|
-
# @param point2
|
56
|
+
# @param [Float] point2
|
60
57
|
# The end point of the line.
|
61
58
|
#
|
62
|
-
# @param weight2
|
59
|
+
# @param [Float] weight2
|
63
60
|
# A weight or percentage.
|
64
61
|
#
|
65
|
-
# @
|
62
|
+
# @param [Float] point1
|
63
|
+
# The start point on the line.
|
64
|
+
#
|
65
|
+
# @return [Geom::Point3d]
|
66
66
|
#
|
67
67
|
# @version SketchUp 6.0
|
68
68
|
def self.linear_combination(weight1, point1, weight2, point2)
|
@@ -77,10 +77,10 @@ class Geom::Point3d
|
|
77
77
|
# pt2 = pt + vec
|
78
78
|
# pt = pt + [10,10,10]
|
79
79
|
#
|
80
|
-
# @param point2
|
80
|
+
# @param [Geom::Point3d] point2
|
81
81
|
# A Point3d object.
|
82
82
|
#
|
83
|
-
# @return
|
83
|
+
# @return [Geom::Point3d]
|
84
84
|
#
|
85
85
|
# @version SketchUp 6.0
|
86
86
|
def +(point2)
|
@@ -93,10 +93,10 @@ class Geom::Point3d
|
|
93
93
|
# pt2 = pt - vec
|
94
94
|
# pt = pt - [10,10,10]
|
95
95
|
#
|
96
|
-
# @param point2
|
96
|
+
# @param [Geom::Point3d] point2
|
97
97
|
# A Point3d object.
|
98
98
|
#
|
99
|
-
# @return
|
99
|
+
# @return [Geom::Vector3d]
|
100
100
|
#
|
101
101
|
# @version SketchUp 6.0
|
102
102
|
def -(point2)
|
@@ -110,10 +110,10 @@ class Geom::Point3d
|
|
110
110
|
# pt2 = Geom::Point3d.new(20,20,20)
|
111
111
|
# result = pt1 < pt2
|
112
112
|
#
|
113
|
-
# @param point2
|
113
|
+
# @param [Geom::Point3d] point2
|
114
114
|
# A Point3d object.
|
115
115
|
#
|
116
|
-
# @return true if the point2 is closer to the origin.
|
116
|
+
# @return [Boolean] true if the point2 is closer to the origin.
|
117
117
|
#
|
118
118
|
# @version SketchUp 6.0
|
119
119
|
def <(point2)
|
@@ -138,14 +138,14 @@ class Geom::Point3d
|
|
138
138
|
# end
|
139
139
|
#
|
140
140
|
# @example
|
141
|
-
# point1 = Geom::Point3d.new
|
142
|
-
# point2 = Geom::Point3d.new
|
141
|
+
# point1 = Geom::Point3d.new(1,1,1)
|
142
|
+
# point2 = Geom::Point3d.new(10,10,10)
|
143
143
|
# status = point1 == point2
|
144
144
|
#
|
145
|
-
# @param point2
|
145
|
+
# @param [Geom::Point3d] point2
|
146
146
|
# A Point3d object.
|
147
147
|
#
|
148
|
-
# @return
|
148
|
+
# @return [Boolean] true if both points are equal; false if points are not
|
149
149
|
# equal
|
150
150
|
#
|
151
151
|
# @version SketchUp 6.0
|
@@ -156,16 +156,16 @@ class Geom::Point3d
|
|
156
156
|
# index.
|
157
157
|
#
|
158
158
|
# @example
|
159
|
-
# point = Geom::Point3d.new
|
159
|
+
# point = Geom::Point3d.new(1, 2, 3)
|
160
160
|
#
|
161
161
|
# # retrieves the y value of 2
|
162
162
|
# yvalue = point[1]
|
163
163
|
#
|
164
|
-
# @param index
|
164
|
+
# @param [Integer] index
|
165
165
|
# The index for a specific x, y, or z value within the
|
166
166
|
# Point3d.
|
167
167
|
#
|
168
|
-
# @return
|
168
|
+
# @return [Length] an x, y, or z value if successful
|
169
169
|
#
|
170
170
|
# @version SketchUp 6.0
|
171
171
|
def [](index)
|
@@ -175,26 +175,30 @@ class Geom::Point3d
|
|
175
175
|
# specific index of the value.
|
176
176
|
#
|
177
177
|
# @example
|
178
|
-
# point = Geom::Point3d.new
|
178
|
+
# point = Geom::Point3d.new(1,2,3)
|
179
179
|
# yvalue = point[1] = 4
|
180
180
|
#
|
181
|
-
# @param
|
181
|
+
# @param [Integer] index
|
182
|
+
# The index for a specific x, y, or z value within the
|
183
|
+
# Point3d.
|
184
|
+
#
|
185
|
+
# @param [Numeric] new_value
|
182
186
|
# New x, y, or z value.
|
183
187
|
#
|
184
|
-
# @return
|
188
|
+
# @return [Numeric] the newly set x, y, or z value if successful
|
185
189
|
#
|
186
190
|
# @version SketchUp 6.0
|
187
|
-
def []=(new_value)
|
191
|
+
def []=(index, new_value)
|
188
192
|
end
|
189
193
|
|
190
194
|
# The clone method is used to create another point identical to the point
|
191
195
|
# being cloned.
|
192
196
|
#
|
193
197
|
# @example
|
194
|
-
# point = Geom::Point3d.new
|
198
|
+
# point = Geom::Point3d.new(1,2,3)
|
195
199
|
# newpoint = point.clone
|
196
200
|
#
|
197
|
-
# @return
|
201
|
+
# @return [Geom::Point3d] the cloned Point3d object
|
198
202
|
#
|
199
203
|
# @version SketchUp 6.0
|
200
204
|
def clone
|
@@ -204,14 +208,14 @@ class Geom::Point3d
|
|
204
208
|
# point.
|
205
209
|
#
|
206
210
|
# @example
|
207
|
-
# point1 = Geom::Point3d.new
|
208
|
-
# point2 = Geom::Point3d.new
|
209
|
-
# distance = point1.distance
|
211
|
+
# point1 = Geom::Point3d.new(1,1,1)
|
212
|
+
# point2 = Geom::Point3d.new(10,10,10)
|
213
|
+
# distance = point1.distance(point2)
|
210
214
|
#
|
211
|
-
# @param point2
|
215
|
+
# @param [Geom::Point3d] point2
|
212
216
|
# The Point3d object to compute the distance to.
|
213
217
|
#
|
214
|
-
# @return
|
218
|
+
# @return [Length] the distance in current units
|
215
219
|
#
|
216
220
|
# @version SketchUp 6.0
|
217
221
|
def distance(point2)
|
@@ -223,15 +227,17 @@ class Geom::Point3d
|
|
223
227
|
# See Geom module for how to specify a line.
|
224
228
|
#
|
225
229
|
# @example
|
226
|
-
# point1 = Geom::Point3d.new
|
230
|
+
# point1 = Geom::Point3d.new(1,1,1)
|
227
231
|
# line = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]
|
228
|
-
# distance = point1.distance_to_line
|
232
|
+
# distance = point1.distance_to_line(line)
|
233
|
+
#
|
234
|
+
# @note This function returns a `Float` value, not a `Length`.
|
229
235
|
#
|
230
236
|
# @param line
|
231
237
|
# A line (see Geom for information on creating lines).
|
232
238
|
#
|
233
|
-
# @return
|
234
|
-
#
|
239
|
+
# @return [Float] the distance between a point and line in
|
240
|
+
# internal units if successful
|
235
241
|
#
|
236
242
|
# @version SketchUp 6.0
|
237
243
|
def distance_to_line(line)
|
@@ -243,13 +249,15 @@ class Geom::Point3d
|
|
243
249
|
# See module Geom for how to specify a plane.
|
244
250
|
#
|
245
251
|
# @example
|
246
|
-
# distance = point.distance_to_plane
|
252
|
+
# distance = point.distance_to_plane(plane)
|
253
|
+
#
|
254
|
+
# @note This function returns a `Float` value, not a `Length`.
|
247
255
|
#
|
248
256
|
# @param plane
|
249
257
|
# A plane (see Geom for how to create a plane).
|
250
258
|
#
|
251
|
-
# @return
|
252
|
-
#
|
259
|
+
# @return [Float] a distance between a point and a plane in
|
260
|
+
# internal units if successful
|
253
261
|
#
|
254
262
|
# @version SketchUp 6.0
|
255
263
|
def distance_to_plane(plane)
|
@@ -315,10 +323,10 @@ class Geom::Point3d
|
|
315
323
|
# which writes to the Ruby console.
|
316
324
|
#
|
317
325
|
# @example
|
318
|
-
# point = Geom::Point3d.new
|
326
|
+
# point = Geom::Point3d.new(10,10,10)
|
319
327
|
# string = point.inspect
|
320
328
|
#
|
321
|
-
# @return
|
329
|
+
# @return [String] a string point representation
|
322
330
|
#
|
323
331
|
# @version SketchUp 6.0
|
324
332
|
def inspect
|
@@ -332,14 +340,14 @@ class Geom::Point3d
|
|
332
340
|
# vector = Geom::Vector3d.new(0, 0, 1)
|
333
341
|
# point2 = point1.offset(vector)
|
334
342
|
#
|
335
|
-
# @param vector
|
343
|
+
# @param [Geom::Vector3d] vector
|
336
344
|
# A Vector3d object to offset the point by.
|
337
345
|
#
|
338
|
-
# @param length
|
346
|
+
# @param [Numeric] length
|
339
347
|
# the distance to offset. If not provided, the
|
340
348
|
# offset is my a distance equal to the vector length.
|
341
349
|
#
|
342
|
-
# @return
|
350
|
+
# @return [Geom::Point3d] - a new Point3d object
|
343
351
|
#
|
344
352
|
# @version SketchUp 6.0
|
345
353
|
def offset(vector, length = vector.length)
|
@@ -353,16 +361,16 @@ class Geom::Point3d
|
|
353
361
|
# @example
|
354
362
|
# point1 = Geom::Point3d.new(10,10,10)
|
355
363
|
# vector = Geom::Vector3d.new(0,0,1)
|
356
|
-
# point2 = point1.offset!
|
364
|
+
# point2 = point1.offset!(vector)
|
357
365
|
#
|
358
|
-
# @param vector
|
366
|
+
# @param [Geom::Vector3d] vector
|
359
367
|
# A Vector3d object to offset the point by.
|
360
368
|
#
|
361
|
-
# @param length
|
369
|
+
# @param [Numeric] length
|
362
370
|
# the distance to offset. If not provided, the
|
363
371
|
# offset is my a distance equal to the vector length.
|
364
372
|
#
|
365
|
-
# @return
|
373
|
+
# @return [Geom::Point3d] a new Point3d object
|
366
374
|
#
|
367
375
|
# @version SketchUp 6.0
|
368
376
|
def offset!(vector, length = vector.length)
|
@@ -374,14 +382,13 @@ class Geom::Point3d
|
|
374
382
|
#
|
375
383
|
# @example
|
376
384
|
# line = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]
|
377
|
-
# point = Geom::Point3d.new
|
378
|
-
# status = point.on_line?
|
385
|
+
# point = Geom::Point3d.new(10,10,10)
|
386
|
+
# status = point.on_line?(line)
|
379
387
|
#
|
380
388
|
# @param line
|
381
389
|
# A line (see Geom for how to create a line).
|
382
390
|
#
|
383
|
-
# @return
|
384
|
-
# point is not on the line
|
391
|
+
# @return [Boolean]
|
385
392
|
#
|
386
393
|
# @return [Boolean]
|
387
394
|
#
|
@@ -395,13 +402,12 @@ class Geom::Point3d
|
|
395
402
|
#
|
396
403
|
# @example
|
397
404
|
# plane = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]
|
398
|
-
# point = Geom::Point3d.new
|
399
|
-
# status = point.on_plane?
|
405
|
+
# point = Geom::Point3d.new(10,10,10)
|
406
|
+
# status = point.on_plane?(plane)
|
400
407
|
#
|
401
408
|
# @param plane
|
402
409
|
#
|
403
|
-
# @return
|
404
|
-
# the point is not on the plane
|
410
|
+
# @return [Boolean]
|
405
411
|
#
|
406
412
|
# @return [Boolean]
|
407
413
|
#
|
@@ -416,13 +422,13 @@ class Geom::Point3d
|
|
416
422
|
#
|
417
423
|
# @example
|
418
424
|
# line = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]
|
419
|
-
# point = Geom::Point3d.new
|
420
|
-
# projected_point = point.project_to_line
|
425
|
+
# point = Geom::Point3d.new(10,10,10)
|
426
|
+
# projected_point = point.project_to_line(line)
|
421
427
|
#
|
422
428
|
# @param line
|
423
|
-
#
|
429
|
+
# see Geom for how to specify a line
|
424
430
|
#
|
425
|
-
# @return
|
431
|
+
# @return [Geom::Point3d] the Point3d that is on a line closest to the
|
426
432
|
# point
|
427
433
|
#
|
428
434
|
# @version SketchUp 6.0
|
@@ -438,13 +444,13 @@ class Geom::Point3d
|
|
438
444
|
#
|
439
445
|
# @example
|
440
446
|
# plane = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]
|
441
|
-
# point = Geom::Point3d.new
|
442
|
-
# projected_point = point.project_to_plane
|
447
|
+
# point = Geom::Point3d.new(10,10,10)
|
448
|
+
# projected_point = point.project_to_plane(plane)
|
443
449
|
#
|
444
450
|
# @param plane
|
445
451
|
# A plane (see Geom for how to create a plane).
|
446
452
|
#
|
447
|
-
# @return
|
453
|
+
# @return [Geom::Point3d] the Point3d that is on a plane closest to the
|
448
454
|
# point
|
449
455
|
#
|
450
456
|
# @version SketchUp 6.0
|
@@ -454,12 +460,19 @@ class Geom::Point3d
|
|
454
460
|
# The {#set!} method is used to set the values of the Point3d.
|
455
461
|
#
|
456
462
|
# @example
|
457
|
-
# point = Geom::Point3d.new
|
458
|
-
# point = point.set!
|
463
|
+
# point = Geom::Point3d.new(10,10,10)
|
464
|
+
# point = point.set!(100,200,300)
|
465
|
+
#
|
466
|
+
# @overload set!(x, y, z)
|
467
|
+
#
|
468
|
+
# @param [Numeric] x The x value for the point.
|
469
|
+
# @param [Numeric] y The y value for the point.
|
470
|
+
# @param [Numeric] z The z value for the point.
|
471
|
+
# @return [Geom::Point3d] The newly set Point3d object
|
459
472
|
#
|
460
473
|
# @overload set!(point3d)
|
461
474
|
#
|
462
|
-
# @param [Geom::Point3d]
|
475
|
+
# @param point3d [Geom::Point3d]
|
463
476
|
# @return [Geom::Point3d]
|
464
477
|
#
|
465
478
|
# @overload set!(array3d)
|
@@ -474,14 +487,14 @@ class Geom::Point3d
|
|
474
487
|
# The to_a method is used to convert the point to an array of 3 numbers
|
475
488
|
#
|
476
489
|
# @example
|
477
|
-
# point = Geom::Point3d.new
|
490
|
+
# point = Geom::Point3d.new(10,20,30)
|
478
491
|
# array = point.to_a
|
479
492
|
#
|
480
493
|
# pt = [100,200,300]
|
481
494
|
# # outputs [100.0,200.0,300.0]
|
482
495
|
# UI.messagebox(pt.to_a)
|
483
496
|
#
|
484
|
-
# @return
|
497
|
+
# @return [Array(Length, Length, Length)] an array of three numbers representing x,y,z of
|
485
498
|
# the Point3d
|
486
499
|
#
|
487
500
|
# @version SketchUp 6.0
|
@@ -491,47 +504,45 @@ class Geom::Point3d
|
|
491
504
|
# The to_s method is used to retrieve a string representation of a point.
|
492
505
|
#
|
493
506
|
# @example
|
494
|
-
# point = Geom::Point3d.new
|
507
|
+
# point = Geom::Point3d.new(10,10,10)
|
495
508
|
# str = point.to_s
|
496
509
|
#
|
497
|
-
# @return
|
510
|
+
# @return [String] the string representation of the Point3d
|
498
511
|
#
|
499
512
|
# @version SketchUp 6.0
|
500
513
|
def to_s
|
501
514
|
end
|
502
515
|
|
503
|
-
#
|
504
|
-
#
|
505
|
-
# Unlike the transform method, the point itself is modified.
|
516
|
+
# Apply a Transformation to a point, returning a new point. The original
|
517
|
+
# vector is unchanged by this method.
|
506
518
|
#
|
507
519
|
# @example
|
508
520
|
# transform = Geom::Transformation.new(point2)
|
509
|
-
# point2 = Geom::Point3d.new
|
510
|
-
# point1 = Geom::Point3d.new
|
511
|
-
# point1.transform
|
521
|
+
# point2 = Geom::Point3d.new(100,200,300)
|
522
|
+
# point1 = Geom::Point3d.new(10,10,10)
|
523
|
+
# point3 = point1.transform(transform)
|
512
524
|
#
|
513
|
-
# @param transform
|
525
|
+
# @param [Geom::Transformation] transform
|
514
526
|
# A Transformation object.
|
515
527
|
#
|
516
|
-
# @return
|
528
|
+
# @return [Geom::Point3d] the newly transformed point
|
517
529
|
#
|
518
530
|
# @version SketchUp 6.0
|
519
531
|
def transform(transform)
|
520
532
|
end
|
521
533
|
|
522
|
-
#
|
523
|
-
# a new point.
|
534
|
+
# Apply a Transformation to a point. The point itself is modified.
|
524
535
|
#
|
525
536
|
# @example
|
526
537
|
# transform = Geom::Transformation.new(point2)
|
527
|
-
# point2 = Geom::Point3d.new
|
528
|
-
# point1 = Geom::Point3d.new
|
529
|
-
#
|
538
|
+
# point2 = Geom::Point3d.new(100,200,300)
|
539
|
+
# point1 = Geom::Point3d.new(10,10,10)
|
540
|
+
# point1.transform!(transform)
|
530
541
|
#
|
531
|
-
# @param transform
|
542
|
+
# @param [Geom::Transformation] transform
|
532
543
|
# A Transformation object.
|
533
544
|
#
|
534
|
-
# @return
|
545
|
+
# @return [Geom::Point3d] the transformed point
|
535
546
|
#
|
536
547
|
# @version SketchUp 6.0
|
537
548
|
def transform!(transform)
|
@@ -540,20 +551,20 @@ class Geom::Point3d
|
|
540
551
|
# The vector_to team method retrieves the vector between points.
|
541
552
|
#
|
542
553
|
# @example
|
543
|
-
# point2 = Geom::Point3d.new
|
544
|
-
# point1 = Geom::Point3d.new
|
545
|
-
# vector = point1.vector_to
|
554
|
+
# point2 = Geom::Point3d.new(100,200,300)
|
555
|
+
# point1 = Geom::Point3d.new(10,10,10)
|
556
|
+
# vector = point1.vector_to(point2)
|
546
557
|
#
|
547
558
|
# # Another example...
|
548
559
|
# pt1 = [1,1,0]
|
549
560
|
# pt2 = [3,1,0]
|
550
|
-
# pt1.vector_to(
|
561
|
+
# pt1.vector_to(pt2) # returns the vector (2,0,0)
|
551
562
|
# pt1.vector_to(pt2) # is equivalent to (pt2 - pt1)
|
552
563
|
#
|
553
|
-
# @param point2
|
564
|
+
# @param [Geom::Point3d] point2
|
554
565
|
# A Point3d object.
|
555
566
|
#
|
556
|
-
# @return
|
567
|
+
# @return [Geom::Vector3d] a Vector object
|
557
568
|
#
|
558
569
|
# @version SketchUp 6.0
|
559
570
|
def vector_to(point2)
|
@@ -562,10 +573,10 @@ class Geom::Point3d
|
|
562
573
|
# The x method retrieves the x value of the 3D point.
|
563
574
|
#
|
564
575
|
# @example
|
565
|
-
# point = Geom::Point3d.new
|
576
|
+
# point = Geom::Point3d.new(1,2,3)
|
566
577
|
# x = point.x
|
567
578
|
#
|
568
|
-
# @return
|
579
|
+
# @return [Length] the x value
|
569
580
|
#
|
570
581
|
# @version SketchUp 6.0
|
571
582
|
def x
|
@@ -574,13 +585,13 @@ class Geom::Point3d
|
|
574
585
|
# The x= method is used to set the x value of a 3D point.
|
575
586
|
#
|
576
587
|
# @example
|
577
|
-
# point = Geom::Point3d.new
|
588
|
+
# point = Geom::Point3d.new(1,2,3)
|
578
589
|
# x = point.x = 2
|
579
590
|
#
|
580
|
-
# @param value
|
591
|
+
# @param [Numeric] value
|
581
592
|
# The new x value.
|
582
593
|
#
|
583
|
-
# @return
|
594
|
+
# @return [Numeric] the newly set x value
|
584
595
|
#
|
585
596
|
# @version SketchUp 6.0
|
586
597
|
def x=(value)
|
@@ -589,10 +600,10 @@ class Geom::Point3d
|
|
589
600
|
# The y method retrieves the y value of the 3D point.
|
590
601
|
#
|
591
602
|
# @example
|
592
|
-
# point = Geom::Point3d.new
|
603
|
+
# point = Geom::Point3d.new(1,2,3)
|
593
604
|
# y = point.y
|
594
605
|
#
|
595
|
-
# @return
|
606
|
+
# @return [Length] the y value
|
596
607
|
#
|
597
608
|
# @version SketchUp 6.0
|
598
609
|
def y
|
@@ -601,13 +612,13 @@ class Geom::Point3d
|
|
601
612
|
# The y= method is used to set the y value of a 3D point.
|
602
613
|
#
|
603
614
|
# @example
|
604
|
-
# point = Geom::Point3d.new
|
615
|
+
# point = Geom::Point3d.new(1,2,3)
|
605
616
|
# y = point.y = 2
|
606
617
|
#
|
607
|
-
# @param value
|
618
|
+
# @param [Numeric] value
|
608
619
|
# The new y value.
|
609
620
|
#
|
610
|
-
# @return
|
621
|
+
# @return [Numeric] the newly set y value
|
611
622
|
#
|
612
623
|
# @version SketchUp 6.0
|
613
624
|
def y=(value)
|
@@ -616,10 +627,10 @@ class Geom::Point3d
|
|
616
627
|
# The z method retrieves the z value of the 3D point.
|
617
628
|
#
|
618
629
|
# @example
|
619
|
-
# point = Geom::Point3d.new
|
630
|
+
# point = Geom::Point3d.new(1,2,3)
|
620
631
|
# z = point.x
|
621
632
|
#
|
622
|
-
# @return
|
633
|
+
# @return [Length] the z value
|
623
634
|
#
|
624
635
|
# @version SketchUp 6.0
|
625
636
|
def z
|
@@ -628,13 +639,13 @@ class Geom::Point3d
|
|
628
639
|
# The z= method is used to set the z value of a 3D point.
|
629
640
|
#
|
630
641
|
# @example
|
631
|
-
# point = Geom::Point3d.new
|
642
|
+
# point = Geom::Point3d.new(1,2,3)
|
632
643
|
# z = point.z = 2
|
633
644
|
#
|
634
|
-
# @param value
|
645
|
+
# @param [Numeric] value
|
635
646
|
# The new z value.
|
636
647
|
#
|
637
|
-
# @return
|
648
|
+
# @return [Numeric] the newly set z value
|
638
649
|
#
|
639
650
|
# @version SketchUp 6.0
|
640
651
|
def z=(value)
|