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
data/SketchUp/Geom/Vector3d.rb
CHANGED
@@ -11,16 +11,12 @@ class Geom::Vector3d
|
|
11
11
|
|
12
12
|
# Class Methods
|
13
13
|
|
14
|
-
# The linear_combination method is used to create a new vector as a linear
|
14
|
+
# The {.linear_combination} method is used to create a new vector as a linear
|
15
15
|
# combination of other vectors. This method is generally used to get a vector
|
16
16
|
# at some percentage between two vectors.
|
17
17
|
#
|
18
18
|
# A linear combination is a standard term for vector math. It is defined as
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# In addition to the 4-argument form detailed here, you may also call this
|
22
|
-
# method with 6 parameters in the form of:
|
23
|
-
# - vec = Geom::Vector3d.linear_combination(x, xaxis, y, yaxis, z, zaxis)
|
19
|
+
# vector = weight1 * vector1 + weight2 * vector2.
|
24
20
|
#
|
25
21
|
# @example
|
26
22
|
# # Create a vector that is a 50%/50% linear combination of two others.
|
@@ -29,22 +25,26 @@ class Geom::Vector3d
|
|
29
25
|
# new_vector = Geom::Vector3d.linear_combination(0.5, vec1, 0.5, vec2)
|
30
26
|
# # new_vector will now contain a Vector3d(1.5, 1.5, 0)
|
31
27
|
#
|
32
|
-
# @
|
33
|
-
# A weight or percentage.
|
34
|
-
#
|
35
|
-
# @param vector1
|
36
|
-
# The first vector.
|
28
|
+
# @overload linear_combination(weight1, vector1, weight2, vector2)
|
37
29
|
#
|
38
|
-
#
|
39
|
-
#
|
30
|
+
# @param [Numeric] weight1 A weight or percentage.
|
31
|
+
# @param [Geom::Vector3d] vector1 The first vector.
|
32
|
+
# @param [Numeric] weight2 A weight or percentage.
|
33
|
+
# @param [Geom::Vector3d] vector2 The second vector.
|
34
|
+
# @return [Geom::Vector3d]
|
40
35
|
#
|
41
|
-
# @
|
42
|
-
# A weight or percentage.
|
36
|
+
# @overload linear_combination(x, xaxis, y, yaxis, z, zaxis)
|
43
37
|
#
|
44
|
-
#
|
38
|
+
# @param [Numeric] x A weight or percentage for the x axis.
|
39
|
+
# @param [Geom::Vector3d] xaxis The x axis vector.
|
40
|
+
# @param [Numeric] y A weight or percentage for the y axis.
|
41
|
+
# @param [Geom::Vector3d] yaxis The y axis vector.
|
42
|
+
# @param [Numeric] z A weight or percentage for the z axis.
|
43
|
+
# @param [Geom::Vector3d] zaxis The z axis vector.
|
44
|
+
# @return [Geom::Vector3d]
|
45
45
|
#
|
46
46
|
# @version SketchUp 6.0
|
47
|
-
def self.linear_combination(
|
47
|
+
def self.linear_combination(*args)
|
48
48
|
end
|
49
49
|
|
50
50
|
# Instance Methods
|
@@ -68,25 +68,28 @@ class Geom::Vector3d
|
|
68
68
|
def %(vector)
|
69
69
|
end
|
70
70
|
|
71
|
-
# The {
|
71
|
+
# The {#cross} method is used to compute the cross product between two vectors.
|
72
72
|
#
|
73
73
|
# The cross product, also called the vector product, is an operation on two
|
74
74
|
# vectors. The cross product of two vectors produces a third vector which is
|
75
75
|
# perpendicular to the plane in which the first two lie.
|
76
76
|
#
|
77
|
-
# This is an alias of the {#cross} method.
|
78
|
-
#
|
79
77
|
# @example
|
80
|
-
# vector1 = Geom::Vector3d.new
|
81
|
-
# vector2 = Geom::Vector3d.new
|
78
|
+
# vector1 = Geom::Vector3d.new(1,0,0)
|
79
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
82
80
|
# vector3 = vector1 * vector2
|
83
81
|
#
|
84
|
-
# @
|
82
|
+
# @example
|
83
|
+
# vector = Geom::Vector3d.new(1,0,0)
|
84
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
85
|
+
# vector3 = vector.cross(vector2)
|
86
|
+
#
|
87
|
+
# @param [Geom::Vector3d] vector
|
85
88
|
# A Vector3d object.
|
86
89
|
#
|
87
|
-
# @return
|
90
|
+
# @return [Geom::Vector3d] the cross of vector1 and vector2
|
88
91
|
#
|
89
|
-
# @see
|
92
|
+
# @see #*
|
90
93
|
#
|
91
94
|
# @version SketchUp 6.0
|
92
95
|
def *(vector)
|
@@ -95,14 +98,14 @@ class Geom::Vector3d
|
|
95
98
|
# The - method is used to add a vector to this one.
|
96
99
|
#
|
97
100
|
# @example
|
98
|
-
# vector = Geom::Vector3d.new
|
99
|
-
# vector2 = Geom::Vector3d.new
|
101
|
+
# vector = Geom::Vector3d.new(0,0,2)
|
102
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
100
103
|
# new_vector = vector + vector2
|
101
104
|
#
|
102
105
|
# @param vector2
|
103
106
|
# A Vector3d object.
|
104
107
|
#
|
105
|
-
# @return
|
108
|
+
# @return [Geom::Vector3d] the new vector.
|
106
109
|
#
|
107
110
|
# @version SketchUp 6.0
|
108
111
|
def +(vector2)
|
@@ -111,14 +114,14 @@ class Geom::Vector3d
|
|
111
114
|
# The - method is used to subtract a vector from this one.
|
112
115
|
#
|
113
116
|
# @example
|
114
|
-
# vector = Geom::Vector3d.new
|
115
|
-
# vector2 = Geom::Vector3d.new
|
117
|
+
# vector = Geom::Vector3d.new(0,0,2)
|
118
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
116
119
|
# new_vector = vector - vector2
|
117
120
|
#
|
118
121
|
# @param vector2
|
119
122
|
# A Vector3d object.
|
120
123
|
#
|
121
|
-
# @return
|
124
|
+
# @return [Geom::Vector3d] the new vector.
|
122
125
|
#
|
123
126
|
# @version SketchUp 6.0
|
124
127
|
def -(vector2)
|
@@ -128,14 +131,14 @@ class Geom::Vector3d
|
|
128
131
|
# than another vector's x, y or z value.
|
129
132
|
#
|
130
133
|
# @example
|
131
|
-
# vector = Geom::Vector3d.new
|
132
|
-
# vector2 = Geom::Vector3d.new
|
134
|
+
# vector = Geom::Vector3d.new(0,0,2)
|
135
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
133
136
|
# lt = vector < vector2
|
134
137
|
#
|
135
138
|
# @param vector2
|
136
139
|
# A Vector3d object.
|
137
140
|
#
|
138
|
-
# @return true if the vector's x, y or z component is less
|
141
|
+
# @return [Boolean] true if the vector's x, y or z component is less
|
139
142
|
#
|
140
143
|
# @version SketchUp 6.0
|
141
144
|
def <(vector2)
|
@@ -145,8 +148,8 @@ class Geom::Vector3d
|
|
145
148
|
# tolerance.
|
146
149
|
#
|
147
150
|
# @example
|
148
|
-
# vector = Geom::Vector3d.new
|
149
|
-
# vector2 = Geom::Vector3d.new
|
151
|
+
# vector = Geom::Vector3d.new(1,0,0)
|
152
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
150
153
|
# status = vector == vector2
|
151
154
|
# # Returns false
|
152
155
|
# UI.messagebox status
|
@@ -154,8 +157,7 @@ class Geom::Vector3d
|
|
154
157
|
# @param vector2
|
155
158
|
# A Vector3d object.
|
156
159
|
#
|
157
|
-
# @return
|
158
|
-
# they are not equal.
|
160
|
+
# @return [Boolean]
|
159
161
|
#
|
160
162
|
# @version SketchUp 6.0
|
161
163
|
def ==(vector2)
|
@@ -171,7 +173,7 @@ class Geom::Vector3d
|
|
171
173
|
# x = vector[0]
|
172
174
|
#
|
173
175
|
# @example
|
174
|
-
# vector = Geom::Vector3d.new
|
176
|
+
# vector = Geom::Vector3d.new(1,0,0)
|
175
177
|
# value = vector[0]
|
176
178
|
# if (value)
|
177
179
|
# UI.messagebox value
|
@@ -179,10 +181,10 @@ class Geom::Vector3d
|
|
179
181
|
# UI.messagebox "Failure"
|
180
182
|
# end
|
181
183
|
#
|
182
|
-
# @param i
|
184
|
+
# @param [Integer] i
|
183
185
|
# An index into an array of three coordinates.
|
184
186
|
#
|
185
|
-
# @return
|
187
|
+
# @return [Length] the value for the x, y, or z coordinate.
|
186
188
|
#
|
187
189
|
# @version SketchUp 6.0
|
188
190
|
def [](i)
|
@@ -194,13 +196,13 @@ class Geom::Vector3d
|
|
194
196
|
# @example
|
195
197
|
# vector[i] = coordinate
|
196
198
|
#
|
197
|
-
# @param index
|
199
|
+
# @param [Integer] index
|
198
200
|
# The index for the x, y, or z coordinate.
|
199
201
|
#
|
200
|
-
# @param value
|
202
|
+
# @param [Numeric] value
|
201
203
|
# The value for the x, y, or z coordinate.
|
202
204
|
#
|
203
|
-
# @return the newly set coordinate value
|
205
|
+
# @return [Numeric] the newly set coordinate value
|
204
206
|
#
|
205
207
|
# @version SketchUp 6.0
|
206
208
|
def []=(index, value)
|
@@ -210,14 +212,14 @@ class Geom::Vector3d
|
|
210
212
|
# this vector and another vector.
|
211
213
|
#
|
212
214
|
# @example
|
213
|
-
# vector1 = Geom::Vector3d.new
|
214
|
-
# vector2 = Geom::Vector3d.new
|
215
|
+
# vector1 = Geom::Vector3d.new(1,0,0)
|
216
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
215
217
|
# angle = vector1.angle_between vector2
|
216
218
|
#
|
217
|
-
# @param vector2
|
219
|
+
# @param [Geom::Vector3d] vector2
|
218
220
|
# A Vector3d object.
|
219
221
|
#
|
220
|
-
# @return
|
222
|
+
# @return [Float] an angle (in radians)
|
221
223
|
#
|
222
224
|
# @version SketchUp 6.0
|
223
225
|
def angle_between(vector2)
|
@@ -229,10 +231,10 @@ class Geom::Vector3d
|
|
229
231
|
# Returns an Array of three vectors [xaxis, yaxis, zaxis]
|
230
232
|
#
|
231
233
|
# @example
|
232
|
-
# vector = Geom::Vector3d.new
|
234
|
+
# vector = Geom::Vector3d.new(1,0,0)
|
233
235
|
# a = vector.axes
|
234
236
|
#
|
235
|
-
# @return
|
237
|
+
# @return [Array(Geom::Vector3d, Geom::Vector3d, Geom::Vector3d)] an Array object containing three Vector3d objects
|
236
238
|
#
|
237
239
|
# @version SketchUp 6.0
|
238
240
|
def axes
|
@@ -243,10 +245,10 @@ class Geom::Vector3d
|
|
243
245
|
# This method is equivalent to vec2 = Geom::Vector3d.new(vec)
|
244
246
|
#
|
245
247
|
# @example
|
246
|
-
# vector = Geom::Vector3d.new
|
248
|
+
# vector = Geom::Vector3d.new(1,0,0)
|
247
249
|
# vector2 = vector.clone
|
248
250
|
#
|
249
|
-
# @return
|
251
|
+
# @return [Geom::Vector3d] a Vector3d object which is the clone of
|
250
252
|
# vector
|
251
253
|
#
|
252
254
|
# @version SketchUp 6.0
|
@@ -269,10 +271,10 @@ class Geom::Vector3d
|
|
269
271
|
# vector2 = Geom::Vector3d.new(0,1,0)
|
270
272
|
# vector3 = vector.cross(vector2)
|
271
273
|
#
|
272
|
-
# @param vector
|
274
|
+
# @param [Geom::Vector3d] vector
|
273
275
|
# A Vector3d object.
|
274
276
|
#
|
275
|
-
# @return
|
277
|
+
# @return [Geom::Vector3d] the cross of vector1 and vector2
|
276
278
|
#
|
277
279
|
# @see #*
|
278
280
|
#
|
@@ -301,7 +303,7 @@ class Geom::Vector3d
|
|
301
303
|
#
|
302
304
|
# @example
|
303
305
|
# # A vector that runs up the Z axis.
|
304
|
-
# vector = Geom::Vector3d.new
|
306
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
305
307
|
# if (vector)
|
306
308
|
# UI.messagebox vector
|
307
309
|
# else
|
@@ -312,16 +314,26 @@ class Geom::Vector3d
|
|
312
314
|
#
|
313
315
|
# @return [Geom::Vector3d]
|
314
316
|
#
|
315
|
-
# @overload initialize(
|
317
|
+
# @overload initialize(x, y, z)
|
316
318
|
#
|
317
|
-
# @param
|
319
|
+
# @param [Numeric] x
|
320
|
+
# @param [Numeric] y
|
321
|
+
# @param [Numeric] z
|
318
322
|
# @return [Geom::Vector3d]
|
319
323
|
#
|
320
|
-
# @overload initialize(
|
324
|
+
# @overload initialize(vector)
|
325
|
+
#
|
326
|
+
# @param vector [Geom::Vector3d] A Vector3d object.
|
327
|
+
# @return [Geom::Vector3d]
|
328
|
+
#
|
329
|
+
# @overload initialize(array2d)
|
330
|
+
#
|
331
|
+
# @param [Array(Numeric, Numeric)] array2d
|
332
|
+
# @return [Geom::Vector3d]
|
321
333
|
#
|
322
|
-
#
|
323
|
-
#
|
324
|
-
# @param
|
334
|
+
# @overload initialize(array3d)
|
335
|
+
#
|
336
|
+
# @param [Array(Numeric, Numeric, Numeric)] array3d
|
325
337
|
# @return [Geom::Vector3d]
|
326
338
|
#
|
327
339
|
# @version SketchUp 6.0
|
@@ -332,11 +344,11 @@ class Geom::Vector3d
|
|
332
344
|
# friendly string.
|
333
345
|
#
|
334
346
|
# @example
|
335
|
-
# vector = Geom::Vector3d.new
|
347
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
336
348
|
# out_string = vector.inspect
|
337
349
|
# puts out_string
|
338
350
|
#
|
339
|
-
# @return
|
351
|
+
# @return [Geom::Vector3d] the Vector3d object
|
340
352
|
#
|
341
353
|
# @version SketchUp 6.0
|
342
354
|
def inspect
|
@@ -345,10 +357,10 @@ class Geom::Vector3d
|
|
345
357
|
# The length method is used to retrieve the length of the vector.
|
346
358
|
#
|
347
359
|
# @example
|
348
|
-
# vector = Geom::Vector3d.new
|
360
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
349
361
|
# l = vector.length
|
350
362
|
#
|
351
|
-
# @return
|
363
|
+
# @return [Length] the length of the vector
|
352
364
|
#
|
353
365
|
# @version SketchUp 6.0
|
354
366
|
def length
|
@@ -358,15 +370,15 @@ class Geom::Vector3d
|
|
358
370
|
# be greater than 0.
|
359
371
|
#
|
360
372
|
# @example
|
361
|
-
# vector = Geom::Vector3d.new
|
373
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
362
374
|
# l = vector.length
|
363
|
-
# UI.messagebox
|
375
|
+
# UI.messagebox(l)
|
364
376
|
# newl = vector.length = 2
|
365
377
|
#
|
366
|
-
# @param length
|
378
|
+
# @param [Numeric] length
|
367
379
|
# A length for the vector.
|
368
380
|
#
|
369
|
-
# @return
|
381
|
+
# @return [Numeric] a newly set length
|
370
382
|
#
|
371
383
|
# @version SketchUp 6.0
|
372
384
|
def length=(length)
|
@@ -376,10 +388,10 @@ class Geom::Vector3d
|
|
376
388
|
# of another.
|
377
389
|
#
|
378
390
|
# @example
|
379
|
-
# vector = Geom::Vector3d.new
|
391
|
+
# vector = Geom::Vector3d.new(0,0,2)
|
380
392
|
# vector2 = vector.normalize
|
381
393
|
#
|
382
|
-
# @return
|
394
|
+
# @return [Geom::Vector3d] a new normalized Vector3d object
|
383
395
|
#
|
384
396
|
# @version SketchUp 6.0
|
385
397
|
def normalize
|
@@ -391,10 +403,10 @@ class Geom::Vector3d
|
|
391
403
|
# Another way to do this is vec.length = 1
|
392
404
|
#
|
393
405
|
# @example
|
394
|
-
# vector = Geom::Vector3d.new
|
406
|
+
# vector = Geom::Vector3d.new(0,0,2)
|
395
407
|
# vector.normalize!
|
396
408
|
#
|
397
|
-
# @return
|
409
|
+
# @return [Geom::Vector3d] a normalized Vector3d object
|
398
410
|
#
|
399
411
|
# @version SketchUp 6.0
|
400
412
|
def normalize!
|
@@ -404,13 +416,12 @@ class Geom::Vector3d
|
|
404
416
|
# another vector to within tolerance.
|
405
417
|
#
|
406
418
|
# @example
|
407
|
-
# status = vector.parallel?
|
419
|
+
# status = vector.parallel?(vector2)
|
408
420
|
#
|
409
|
-
# @param vector2
|
421
|
+
# @param [Geom::Vector3d] vector2
|
410
422
|
# A Vector3d object.
|
411
423
|
#
|
412
|
-
# @return
|
413
|
-
# if they are not parallel.
|
424
|
+
# @return [Boolean]
|
414
425
|
#
|
415
426
|
# @return [Boolean]
|
416
427
|
#
|
@@ -422,15 +433,14 @@ class Geom::Vector3d
|
|
422
433
|
# perpendicular to another vector to within tolerance.
|
423
434
|
#
|
424
435
|
# @example
|
425
|
-
# vector = Geom::Vector3d.new
|
426
|
-
# vector2 = Geom::Vector3d.new
|
427
|
-
# status = vector.perpendicular?
|
436
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
437
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
438
|
+
# status = vector.perpendicular?(vector2)
|
428
439
|
#
|
429
|
-
# @param vector2
|
440
|
+
# @param [Geom::Vector3d] vector2
|
430
441
|
# A Vector3d object.
|
431
442
|
#
|
432
|
-
# @return
|
433
|
-
# if they are not parallel.
|
443
|
+
# @return [Boolean]
|
434
444
|
#
|
435
445
|
# @return [Boolean]
|
436
446
|
#
|
@@ -444,7 +454,7 @@ class Geom::Vector3d
|
|
444
454
|
# @example
|
445
455
|
# vector2 = vector.reverse
|
446
456
|
#
|
447
|
-
# @return
|
457
|
+
# @return [Geom::Vector3d] a Vector3d object that is the reverse of
|
448
458
|
# vector
|
449
459
|
#
|
450
460
|
# @version SketchUp 6.0
|
@@ -456,7 +466,7 @@ class Geom::Vector3d
|
|
456
466
|
# @example
|
457
467
|
# vector.reverse!
|
458
468
|
#
|
459
|
-
# @return
|
469
|
+
# @return [Geom::Vector3d] a Vector3d object that is the reverse of
|
460
470
|
# vector
|
461
471
|
#
|
462
472
|
# @version SketchUp 6.0
|
@@ -467,15 +477,14 @@ class Geom::Vector3d
|
|
467
477
|
# and in the same direction as another vector to within tolerance.
|
468
478
|
#
|
469
479
|
# @example
|
470
|
-
# vector = Geom::Vector3d.new
|
471
|
-
# vector2 = Geom::Vector3d.new
|
472
|
-
# status = vector.samedirection?
|
480
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
481
|
+
# vector2 = Geom::Vector3d.new(0,1,0)
|
482
|
+
# status = vector.samedirection?(vector2)
|
473
483
|
#
|
474
|
-
# @param vector2
|
484
|
+
# @param [Geom::Vector3d] vector2
|
475
485
|
# A Vector3d object.
|
476
486
|
#
|
477
|
-
# @return
|
478
|
-
# direction. False if they are not in the same direction.
|
487
|
+
# @return [Boolean]
|
479
488
|
#
|
480
489
|
# @return [Boolean]
|
481
490
|
#
|
@@ -496,20 +505,25 @@ class Geom::Vector3d
|
|
496
505
|
# vec.set!(vec2)
|
497
506
|
#
|
498
507
|
# @example
|
499
|
-
# vector = Geom::Vector3d.new
|
508
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
500
509
|
# vector.set! 1,0,0
|
501
510
|
#
|
502
511
|
# @overload set!(x, y, z)
|
503
512
|
#
|
504
|
-
# @param
|
505
|
-
# @param
|
506
|
-
# @param
|
507
|
-
# @return
|
513
|
+
# @param [Numeric] x
|
514
|
+
# @param [Numeric] y
|
515
|
+
# @param [Numeric] z
|
516
|
+
# @return [Geom::Vector3d]
|
517
|
+
#
|
518
|
+
# @overload set!(vector)
|
508
519
|
#
|
509
|
-
#
|
520
|
+
# @param vector [Geom::Vector3d]
|
521
|
+
# @return [Geom::Vector3d]
|
522
|
+
#
|
523
|
+
# @overload set!(array3d)
|
510
524
|
#
|
511
|
-
# @param
|
512
|
-
# @return
|
525
|
+
# @param array3d [Array(Numeric, Numeric, Numeric)]
|
526
|
+
# @return [Geom::Vector3d]
|
513
527
|
#
|
514
528
|
# @version SketchUp 6.0
|
515
529
|
def set!(*args)
|
@@ -521,7 +535,7 @@ class Geom::Vector3d
|
|
521
535
|
# @example
|
522
536
|
# a = vector.to_a
|
523
537
|
#
|
524
|
-
# @return
|
538
|
+
# @return [Array(Length, Length, Length)] the coordinates of the vector in an array
|
525
539
|
#
|
526
540
|
# @version SketchUp 6.0
|
527
541
|
def to_a
|
@@ -530,40 +544,40 @@ class Geom::Vector3d
|
|
530
544
|
# The to_s method is used to format the vector as a String.
|
531
545
|
#
|
532
546
|
# @example
|
533
|
-
# vector = Geom::Vector3d.new
|
547
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
534
548
|
# out_string = vector.to_s
|
535
549
|
# puts out_string
|
536
550
|
#
|
537
|
-
# @return
|
551
|
+
# @return [String] a string representation of vector
|
538
552
|
#
|
539
553
|
# @version SketchUp 6.0
|
540
554
|
def to_s
|
541
555
|
end
|
542
556
|
|
543
|
-
# Apply a Transformation to a vector
|
557
|
+
# Apply a Transformation to a vector, returning a new vector. The original
|
558
|
+
# vector is unchanged by this method.
|
544
559
|
#
|
545
560
|
# @example
|
546
|
-
# vector.transform
|
561
|
+
# vector2 = vector.transform(transformation)
|
547
562
|
#
|
548
|
-
# @param transform
|
563
|
+
# @param [Geom::Transformation] transform
|
549
564
|
# A Transformation object to apply to the vector.
|
550
565
|
#
|
551
|
-
# @return
|
566
|
+
# @return [Geom::Vector3d] the newly transformed vector
|
552
567
|
#
|
553
568
|
# @version SketchUp 6.0
|
554
569
|
def transform(transform)
|
555
570
|
end
|
556
571
|
|
557
|
-
# Apply a Transformation to a vector
|
558
|
-
# vector is unchanged by this method.
|
572
|
+
# Apply a Transformation to a vector. The vector itself is modified.
|
559
573
|
#
|
560
574
|
# @example
|
561
|
-
#
|
575
|
+
# vector.transform!(transformation)
|
562
576
|
#
|
563
|
-
# @param transform
|
577
|
+
# @param [Geom::Transformation] transform
|
564
578
|
# A Transformation object to apply to the vector.
|
565
579
|
#
|
566
|
-
# @return
|
580
|
+
# @return [Geom::Vector3d] the transformed vector
|
567
581
|
#
|
568
582
|
# @version SketchUp 6.0
|
569
583
|
def transform!(transform)
|
@@ -574,11 +588,10 @@ class Geom::Vector3d
|
|
574
588
|
# This is equivalent to vec.length == 1.0
|
575
589
|
#
|
576
590
|
# @example
|
577
|
-
# vector = Geom::Vector3d.new
|
591
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
578
592
|
# status = vector.unitvector?
|
579
593
|
#
|
580
|
-
# @return
|
581
|
-
# the vector is not a unit vector.
|
594
|
+
# @return [Boolean]
|
582
595
|
#
|
583
596
|
# @return [Boolean]
|
584
597
|
#
|
@@ -591,14 +604,13 @@ class Geom::Vector3d
|
|
591
604
|
#
|
592
605
|
# @example
|
593
606
|
# # A zero length vector will be invalid
|
594
|
-
# vector = Geom::Vector3d.new
|
607
|
+
# vector = Geom::Vector3d.new(0,0,0)
|
595
608
|
# status = vector.valid?
|
596
609
|
# # A non-zero length vector is valid
|
597
|
-
# vector = Geom::Vector3d.new
|
610
|
+
# vector = Geom::Vector3d.new(0,0,1)
|
598
611
|
# status = vector.valid?
|
599
612
|
#
|
600
|
-
# @return
|
601
|
-
# vector is not valid.
|
613
|
+
# @return [Boolean]
|
602
614
|
#
|
603
615
|
# @return [Boolean]
|
604
616
|
#
|
@@ -611,7 +623,7 @@ class Geom::Vector3d
|
|
611
623
|
# @example
|
612
624
|
# x = vector.x
|
613
625
|
#
|
614
|
-
# @return
|
626
|
+
# @return [Length] the x coordinate of the vector
|
615
627
|
#
|
616
628
|
# @version SketchUp 6.0
|
617
629
|
def x
|
@@ -623,10 +635,10 @@ class Geom::Vector3d
|
|
623
635
|
# vector = Geom::Vector3d.new 1,2,3
|
624
636
|
# x = vector.x = 10
|
625
637
|
#
|
626
|
-
# @param x
|
638
|
+
# @param [Numeric] x
|
627
639
|
# The x coordinate for the vector.
|
628
640
|
#
|
629
|
-
# @return
|
641
|
+
# @return [Numeric] the newly set x coordinate for the vector
|
630
642
|
#
|
631
643
|
# @version SketchUp 6.0
|
632
644
|
def x=(x)
|
@@ -635,10 +647,10 @@ class Geom::Vector3d
|
|
635
647
|
# The y method is used to retrieve the y coordinate of the vector.
|
636
648
|
#
|
637
649
|
# @example
|
638
|
-
# vector = Geom::Vector3d.new
|
650
|
+
# vector = Geom::Vector3d.new(1,2,3)
|
639
651
|
# y = vector.y
|
640
652
|
#
|
641
|
-
# @return
|
653
|
+
# @return [Length] the y coordinate of the vector
|
642
654
|
#
|
643
655
|
# @version SketchUp 6.0
|
644
656
|
def y
|
@@ -647,13 +659,13 @@ class Geom::Vector3d
|
|
647
659
|
# Set the y coordinate of the vector.
|
648
660
|
#
|
649
661
|
# @example
|
650
|
-
# vector = Geom::Vector3d.new
|
662
|
+
# vector = Geom::Vector3d.new(1,2,3)
|
651
663
|
# y = vector.y = 10
|
652
664
|
#
|
653
|
-
# @param y
|
665
|
+
# @param [Numeric] y
|
654
666
|
# The y coordinate for the vector.
|
655
667
|
#
|
656
|
-
# @return
|
668
|
+
# @return [Numeric] the newly set y coordinate for the vector
|
657
669
|
#
|
658
670
|
# @version SketchUp 6.0
|
659
671
|
def y=(y)
|
@@ -662,10 +674,10 @@ class Geom::Vector3d
|
|
662
674
|
# Get the z coordinate of the vector.
|
663
675
|
#
|
664
676
|
# @example
|
665
|
-
# vector = Geom::Vector3d.new
|
677
|
+
# vector = Geom::Vector3d.new(1,2,3)
|
666
678
|
# z = vector.z
|
667
679
|
#
|
668
|
-
# @return
|
680
|
+
# @return [Length] the z coordinate of the vector
|
669
681
|
#
|
670
682
|
# @version SketchUp 6.0
|
671
683
|
def z
|
@@ -674,13 +686,13 @@ class Geom::Vector3d
|
|
674
686
|
# Set the z coordinate of the vector.
|
675
687
|
#
|
676
688
|
# @example
|
677
|
-
# vector = Geom::Vector3d.new
|
689
|
+
# vector = Geom::Vector3d.new(1,2,3)
|
678
690
|
# z = vector.z = 10
|
679
691
|
#
|
680
|
-
# @param z
|
692
|
+
# @param [Numeric] z
|
681
693
|
# The z coordinate for the vector.
|
682
694
|
#
|
683
|
-
# @return
|
695
|
+
# @return [Numeric] the newly set z coordinate for the vector
|
684
696
|
#
|
685
697
|
# @version SketchUp 6.0
|
686
698
|
def z=(z)
|