sketchup-api-stubs 0.7.9 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +157 -151
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +182 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +111 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +423 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +693 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +535 -509
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +500 -476
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +267 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +133 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +547 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +678 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +751 -747
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +683 -517
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +464 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +614 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +282 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +458 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +346 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -82
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1565 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +286 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +196 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +145 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +294 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +296 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +473 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -121
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +673 -659
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +600 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +252 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +443 -449
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +167 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +403 -406
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1282 -1239
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +122 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1006 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +740 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +289 -282
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +64 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +405 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +432 -406
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +307 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +332 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +380 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +409 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +241 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +55 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -114
- data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1115 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +330 -317
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1714 -1652
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +372 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +133 -130
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +463 -490
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +104 -116
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +939 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +388 -361
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +501 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +385 -361
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +451 -458
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +211 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +259 -255
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +88 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +263 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +283 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +199 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +924 -834
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +143 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1566 -1311
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +71 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1429 -1377
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +399 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +580 -494
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +280 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +258 -241
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +636 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +791 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -24
|
@@ -1,693 +1,678 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
2
|
-
# License:: The MIT License (MIT)
|
|
3
|
-
|
|
4
|
-
# The Vector3d class is used to represent vectors in a 3 dimensional space.
|
|
5
|
-
# Vectors in SketchUp have a direction and a length, but not a starting point.
|
|
6
|
-
#
|
|
7
|
-
# There are numerous tutorials on 3D vectors available on the internet.
|
|
8
|
-
#
|
|
9
|
-
# @version SketchUp 6.0
|
|
10
|
-
class Geom::Vector3d
|
|
11
|
-
|
|
12
|
-
# Class Methods
|
|
13
|
-
|
|
14
|
-
# The {.linear_combination} method is used to create a new vector as a linear
|
|
15
|
-
# combination of other vectors. This method is generally used to get a vector
|
|
16
|
-
# at some percentage between two vectors.
|
|
17
|
-
#
|
|
18
|
-
# A linear combination is a standard term for vector math. It is defined as
|
|
19
|
-
# vector = weight1 * vector1 + weight2 * vector2
|
|
20
|
-
#
|
|
21
|
-
# @example
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
# new_vector = Geom::Vector3d.linear_combination(0.5,
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
# @param [
|
|
31
|
-
# @param [
|
|
32
|
-
# @param [
|
|
33
|
-
# @
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
# @param [
|
|
39
|
-
# @param [
|
|
40
|
-
# @param [
|
|
41
|
-
# @param [
|
|
42
|
-
# @param [
|
|
43
|
-
# @
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
# dot = vector1 % vector2
|
|
60
|
-
#
|
|
61
|
-
# @param [Geom::Vector3d]
|
|
62
|
-
#
|
|
63
|
-
# @return [Float]
|
|
64
|
-
#
|
|
65
|
-
# @see #dot
|
|
66
|
-
#
|
|
67
|
-
# @version SketchUp 6.0
|
|
68
|
-
def %(
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# The {#*} method is used to compute the cross product between two vectors.
|
|
72
|
-
#
|
|
73
|
-
# The cross product, also called the vector product, is an operation on two
|
|
74
|
-
# vectors. The cross product of two vectors produces a third vector which is
|
|
75
|
-
# perpendicular to the plane in which the first two lie.
|
|
76
|
-
#
|
|
77
|
-
# This is an alias of the {#cross} method.
|
|
78
|
-
#
|
|
79
|
-
# @example
|
|
80
|
-
# vector1 = Geom::Vector3d.new(1, 0,
|
|
81
|
-
# vector2 = Geom::Vector3d.new(
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
# @
|
|
90
|
-
#
|
|
91
|
-
# @
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
#
|
|
100
|
-
#
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
# @
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
#
|
|
111
|
-
#
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
#
|
|
116
|
-
#
|
|
117
|
-
# @
|
|
118
|
-
#
|
|
119
|
-
#
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
#
|
|
132
|
-
#
|
|
133
|
-
#
|
|
134
|
-
# @
|
|
135
|
-
#
|
|
136
|
-
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
#
|
|
143
|
-
#
|
|
144
|
-
#
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
#
|
|
149
|
-
#
|
|
150
|
-
#
|
|
151
|
-
# @
|
|
152
|
-
#
|
|
153
|
-
#
|
|
154
|
-
#
|
|
155
|
-
#
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
#
|
|
162
|
-
#
|
|
163
|
-
#
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
#
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
#
|
|
173
|
-
#
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
#
|
|
178
|
-
#
|
|
179
|
-
#
|
|
180
|
-
#
|
|
181
|
-
#
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
#
|
|
185
|
-
# @param [Integer]
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
# @
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
#
|
|
198
|
-
#
|
|
199
|
-
#
|
|
200
|
-
# @
|
|
201
|
-
#
|
|
202
|
-
#
|
|
203
|
-
#
|
|
204
|
-
#
|
|
205
|
-
#
|
|
206
|
-
#
|
|
207
|
-
#
|
|
208
|
-
#
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
#
|
|
214
|
-
#
|
|
215
|
-
#
|
|
216
|
-
#
|
|
217
|
-
#
|
|
218
|
-
#
|
|
219
|
-
#
|
|
220
|
-
# @
|
|
221
|
-
#
|
|
222
|
-
#
|
|
223
|
-
#
|
|
224
|
-
#
|
|
225
|
-
#
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
#
|
|
231
|
-
#
|
|
232
|
-
#
|
|
233
|
-
#
|
|
234
|
-
#
|
|
235
|
-
#
|
|
236
|
-
# @
|
|
237
|
-
# vector
|
|
238
|
-
#
|
|
239
|
-
#
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
# The
|
|
247
|
-
#
|
|
248
|
-
#
|
|
249
|
-
#
|
|
250
|
-
#
|
|
251
|
-
#
|
|
252
|
-
#
|
|
253
|
-
#
|
|
254
|
-
#
|
|
255
|
-
#
|
|
256
|
-
#
|
|
257
|
-
# @
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
#
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
#
|
|
266
|
-
#
|
|
267
|
-
# @example
|
|
268
|
-
# vector1 = Geom::Vector3d.new(
|
|
269
|
-
# vector2 = Geom::Vector3d.new(0, 1,
|
|
270
|
-
#
|
|
271
|
-
#
|
|
272
|
-
#
|
|
273
|
-
#
|
|
274
|
-
#
|
|
275
|
-
#
|
|
276
|
-
#
|
|
277
|
-
# @
|
|
278
|
-
#
|
|
279
|
-
# @
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
#
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
#
|
|
288
|
-
#
|
|
289
|
-
#
|
|
290
|
-
#
|
|
291
|
-
#
|
|
292
|
-
#
|
|
293
|
-
#
|
|
294
|
-
#
|
|
295
|
-
#
|
|
296
|
-
#
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
#
|
|
300
|
-
#
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
#
|
|
305
|
-
#
|
|
306
|
-
#
|
|
307
|
-
#
|
|
308
|
-
#
|
|
309
|
-
#
|
|
310
|
-
#
|
|
311
|
-
#
|
|
312
|
-
#
|
|
313
|
-
#
|
|
314
|
-
#
|
|
315
|
-
#
|
|
316
|
-
#
|
|
317
|
-
#
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
#
|
|
322
|
-
#
|
|
323
|
-
#
|
|
324
|
-
#
|
|
325
|
-
#
|
|
326
|
-
#
|
|
327
|
-
#
|
|
328
|
-
#
|
|
329
|
-
#
|
|
330
|
-
#
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
#
|
|
335
|
-
#
|
|
336
|
-
# @
|
|
337
|
-
#
|
|
338
|
-
#
|
|
339
|
-
#
|
|
340
|
-
#
|
|
341
|
-
#
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
#
|
|
347
|
-
#
|
|
348
|
-
#
|
|
349
|
-
#
|
|
350
|
-
#
|
|
351
|
-
#
|
|
352
|
-
#
|
|
353
|
-
# @
|
|
354
|
-
#
|
|
355
|
-
#
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
#
|
|
363
|
-
#
|
|
364
|
-
#
|
|
365
|
-
# @
|
|
366
|
-
#
|
|
367
|
-
#
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
#
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
#
|
|
376
|
-
#
|
|
377
|
-
#
|
|
378
|
-
#
|
|
379
|
-
#
|
|
380
|
-
# @
|
|
381
|
-
#
|
|
382
|
-
#
|
|
383
|
-
#
|
|
384
|
-
#
|
|
385
|
-
#
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
#
|
|
391
|
-
#
|
|
392
|
-
#
|
|
393
|
-
#
|
|
394
|
-
#
|
|
395
|
-
#
|
|
396
|
-
#
|
|
397
|
-
#
|
|
398
|
-
#
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
#
|
|
403
|
-
#
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
#
|
|
408
|
-
#
|
|
409
|
-
#
|
|
410
|
-
#
|
|
411
|
-
#
|
|
412
|
-
#
|
|
413
|
-
#
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
#
|
|
418
|
-
#
|
|
419
|
-
#
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
#
|
|
424
|
-
#
|
|
425
|
-
#
|
|
426
|
-
# @
|
|
427
|
-
#
|
|
428
|
-
#
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
#
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
#
|
|
437
|
-
#
|
|
438
|
-
#
|
|
439
|
-
#
|
|
440
|
-
#
|
|
441
|
-
#
|
|
442
|
-
#
|
|
443
|
-
#
|
|
444
|
-
#
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
#
|
|
450
|
-
#
|
|
451
|
-
#
|
|
452
|
-
#
|
|
453
|
-
# vector2 =
|
|
454
|
-
#
|
|
455
|
-
#
|
|
456
|
-
#
|
|
457
|
-
#
|
|
458
|
-
#
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
#
|
|
466
|
-
#
|
|
467
|
-
# @
|
|
468
|
-
# vector
|
|
469
|
-
#
|
|
470
|
-
#
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
#
|
|
475
|
-
#
|
|
476
|
-
#
|
|
477
|
-
#
|
|
478
|
-
#
|
|
479
|
-
#
|
|
480
|
-
#
|
|
481
|
-
#
|
|
482
|
-
# @
|
|
483
|
-
#
|
|
484
|
-
#
|
|
485
|
-
#
|
|
486
|
-
#
|
|
487
|
-
# @
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
#
|
|
492
|
-
#
|
|
493
|
-
#
|
|
494
|
-
#
|
|
495
|
-
#
|
|
496
|
-
#
|
|
497
|
-
#
|
|
498
|
-
#
|
|
499
|
-
#
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
#
|
|
504
|
-
#
|
|
505
|
-
#
|
|
506
|
-
#
|
|
507
|
-
#
|
|
508
|
-
#
|
|
509
|
-
#
|
|
510
|
-
#
|
|
511
|
-
#
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
#
|
|
516
|
-
#
|
|
517
|
-
# @
|
|
518
|
-
#
|
|
519
|
-
#
|
|
520
|
-
#
|
|
521
|
-
#
|
|
522
|
-
#
|
|
523
|
-
#
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
#
|
|
529
|
-
#
|
|
530
|
-
#
|
|
531
|
-
#
|
|
532
|
-
#
|
|
533
|
-
#
|
|
534
|
-
#
|
|
535
|
-
#
|
|
536
|
-
#
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
#
|
|
541
|
-
#
|
|
542
|
-
# @
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
#
|
|
547
|
-
#
|
|
548
|
-
#
|
|
549
|
-
#
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
#
|
|
554
|
-
#
|
|
555
|
-
#
|
|
556
|
-
#
|
|
557
|
-
#
|
|
558
|
-
#
|
|
559
|
-
#
|
|
560
|
-
#
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
#
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
#
|
|
569
|
-
#
|
|
570
|
-
#
|
|
571
|
-
# vector.
|
|
572
|
-
#
|
|
573
|
-
# @
|
|
574
|
-
#
|
|
575
|
-
#
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
#
|
|
583
|
-
#
|
|
584
|
-
#
|
|
585
|
-
#
|
|
586
|
-
#
|
|
587
|
-
# vector
|
|
588
|
-
#
|
|
589
|
-
#
|
|
590
|
-
#
|
|
591
|
-
#
|
|
592
|
-
#
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
#
|
|
598
|
-
#
|
|
599
|
-
# @example
|
|
600
|
-
#
|
|
601
|
-
#
|
|
602
|
-
#
|
|
603
|
-
#
|
|
604
|
-
#
|
|
605
|
-
#
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
#
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
#
|
|
614
|
-
#
|
|
615
|
-
# @
|
|
616
|
-
# x
|
|
617
|
-
#
|
|
618
|
-
# @return [
|
|
619
|
-
#
|
|
620
|
-
# @version SketchUp 6.0
|
|
621
|
-
def x
|
|
622
|
-
end
|
|
623
|
-
|
|
624
|
-
# The
|
|
625
|
-
#
|
|
626
|
-
# @example
|
|
627
|
-
# vector = Geom::Vector3d.new
|
|
628
|
-
#
|
|
629
|
-
#
|
|
630
|
-
# @
|
|
631
|
-
#
|
|
632
|
-
#
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
#
|
|
640
|
-
#
|
|
641
|
-
#
|
|
642
|
-
#
|
|
643
|
-
# y
|
|
644
|
-
#
|
|
645
|
-
# @return [
|
|
646
|
-
#
|
|
647
|
-
# @version SketchUp 6.0
|
|
648
|
-
def y
|
|
649
|
-
end
|
|
650
|
-
|
|
651
|
-
#
|
|
652
|
-
#
|
|
653
|
-
# @example
|
|
654
|
-
# vector = Geom::Vector3d.new(1,2,3)
|
|
655
|
-
#
|
|
656
|
-
#
|
|
657
|
-
# @
|
|
658
|
-
#
|
|
659
|
-
#
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
#
|
|
667
|
-
#
|
|
668
|
-
#
|
|
669
|
-
#
|
|
670
|
-
# z
|
|
671
|
-
#
|
|
672
|
-
# @return [
|
|
673
|
-
#
|
|
674
|
-
# @version SketchUp 6.0
|
|
675
|
-
def z
|
|
676
|
-
end
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
#
|
|
680
|
-
# @example
|
|
681
|
-
# vector = Geom::Vector3d.new(1,2,3)
|
|
682
|
-
# z = vector.z = 10
|
|
683
|
-
#
|
|
684
|
-
# @param [Numeric] z
|
|
685
|
-
# The z coordinate for the vector.
|
|
686
|
-
#
|
|
687
|
-
# @return [Numeric] the newly set z coordinate for the vector
|
|
688
|
-
#
|
|
689
|
-
# @version SketchUp 6.0
|
|
690
|
-
def z=(z)
|
|
691
|
-
end
|
|
692
|
-
|
|
693
|
-
end
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
|
+
# License:: The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
# The Vector3d class is used to represent vectors in a 3 dimensional space.
|
|
5
|
+
# Vectors in SketchUp have a direction and a length, but not a starting point.
|
|
6
|
+
#
|
|
7
|
+
# There are numerous tutorials on 3D vectors available on the internet.
|
|
8
|
+
#
|
|
9
|
+
# @version SketchUp 6.0
|
|
10
|
+
class Geom::Vector3d
|
|
11
|
+
|
|
12
|
+
# Class Methods
|
|
13
|
+
|
|
14
|
+
# The {.linear_combination} method is used to create a new vector as a linear
|
|
15
|
+
# combination of other vectors. This method is generally used to get a vector
|
|
16
|
+
# at some percentage between two vectors.
|
|
17
|
+
#
|
|
18
|
+
# A linear combination is a standard term for vector math. It is defined as
|
|
19
|
+
# vector = weight1 * vector1 + weight2 * vector2
|
|
20
|
+
#
|
|
21
|
+
# @example
|
|
22
|
+
# vector1 = Geom::Vector3d.new(3, 0, 0)
|
|
23
|
+
# vector2 = Geom::Vector3d.new(0, 3, 0)
|
|
24
|
+
# # The result is a Vector3d(1.5, 1.5, 0)
|
|
25
|
+
# new_vector = Geom::Vector3d.linear_combination(0.5, vector1, 0.5, vector2)
|
|
26
|
+
#
|
|
27
|
+
# @overload linear_combination(weight1, vector1, weight2, vector2)
|
|
28
|
+
#
|
|
29
|
+
# @param [Float] weight1 weights
|
|
30
|
+
# @param [Geom::Vector3d] vector1 The first vector.
|
|
31
|
+
# @param [Float] weight2 weights
|
|
32
|
+
# @param [Geom::Vector3d] vector2 The second vector.
|
|
33
|
+
# @return [Geom::Vector3d]
|
|
34
|
+
#
|
|
35
|
+
# @overload linear_combination(x, xaxis, y, yaxis, z, zaxis)
|
|
36
|
+
#
|
|
37
|
+
# @param [Float] x A weight or percentage for the x axis.
|
|
38
|
+
# @param [Geom::Vector3d] xaxis The x axis vector.
|
|
39
|
+
# @param [Float] y A weight or percentage for the y axis.
|
|
40
|
+
# @param [Geom::Vector3d] yaxis The y axis vector.
|
|
41
|
+
# @param [Float] z A weight or percentage for the z axis.
|
|
42
|
+
# @param [Geom::Vector3d] zaxis The z axis vector.
|
|
43
|
+
# @return [Geom::Vector3d]
|
|
44
|
+
#
|
|
45
|
+
# @version SketchUp 6.0
|
|
46
|
+
def self.linear_combination(*args)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Instance Methods
|
|
50
|
+
|
|
51
|
+
# The {#%} method is used to compute the dot product between two vectors.
|
|
52
|
+
#
|
|
53
|
+
# This is an alias of the {#dot} method.
|
|
54
|
+
#
|
|
55
|
+
# @example
|
|
56
|
+
# vector1 = Geom::Vector3d.new(2, 2, 1)
|
|
57
|
+
# vector2 = Geom::Vector3d.new(1, 3, 0)
|
|
58
|
+
# # The result is 8
|
|
59
|
+
# dot = vector1 % vector2
|
|
60
|
+
#
|
|
61
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
62
|
+
#
|
|
63
|
+
# @return [Float]
|
|
64
|
+
#
|
|
65
|
+
# @see #dot
|
|
66
|
+
#
|
|
67
|
+
# @version SketchUp 6.0
|
|
68
|
+
def %(vector3d)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# The {#*} method is used to compute the cross product between two vectors.
|
|
72
|
+
#
|
|
73
|
+
# The cross product, also called the vector product, is an operation on two
|
|
74
|
+
# vectors. The cross product of two vectors produces a third vector which is
|
|
75
|
+
# perpendicular to the plane in which the first two lie.
|
|
76
|
+
#
|
|
77
|
+
# This is an alias of the {#cross} method.
|
|
78
|
+
#
|
|
79
|
+
# @example
|
|
80
|
+
# vector1 = Geom::Vector3d.new(1, 0, 2)
|
|
81
|
+
# vector2 = Geom::Vector3d.new(3, 1, 1)
|
|
82
|
+
# # The result is a Vector3d(-2, 5, 1)
|
|
83
|
+
# cross = vector1 * vector2
|
|
84
|
+
#
|
|
85
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
86
|
+
#
|
|
87
|
+
# @return [Geom::Vector3d]
|
|
88
|
+
#
|
|
89
|
+
# @see #cross
|
|
90
|
+
#
|
|
91
|
+
# @version SketchUp 6.0
|
|
92
|
+
def *(vector3d)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# The {#+} method is used to add a vector to this one.
|
|
96
|
+
#
|
|
97
|
+
# @example
|
|
98
|
+
# vector1 = Geom::Vector3d.new(0, 0, 2)
|
|
99
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
100
|
+
# new_vector = vector1 + vector2
|
|
101
|
+
#
|
|
102
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
103
|
+
#
|
|
104
|
+
# @return [Geom::Vector3d] the new vector.
|
|
105
|
+
#
|
|
106
|
+
# @version SketchUp 6.0
|
|
107
|
+
def +(vector3d)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# The {#-} method is used to subtract a vector from this one.
|
|
111
|
+
#
|
|
112
|
+
# @example
|
|
113
|
+
# vector1 = Geom::Vector3d.new(0, 0, 2)
|
|
114
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
115
|
+
# new_vector = vector1 - vector2
|
|
116
|
+
#
|
|
117
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
118
|
+
#
|
|
119
|
+
# @return [Geom::Vector3d] the new vector.
|
|
120
|
+
#
|
|
121
|
+
# @version SketchUp 6.0
|
|
122
|
+
def -(vector3d)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# The {#<} compare method is used to compare two vectors to determine if the left-hand vector is
|
|
126
|
+
# less than the right-hand vector.
|
|
127
|
+
#
|
|
128
|
+
# @example
|
|
129
|
+
# vector1 = Geom::Vector3d.new(0, 1, 0)
|
|
130
|
+
# vector2 = Geom::Vector3d.new(0, 4, 2)
|
|
131
|
+
# # Returns true
|
|
132
|
+
# vector1 < vector2
|
|
133
|
+
#
|
|
134
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
135
|
+
#
|
|
136
|
+
# @return [Boolean] true if the vector1 is closer to origin than vector2
|
|
137
|
+
#
|
|
138
|
+
# @version SketchUp 6.0
|
|
139
|
+
def <(vector3d)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# The {#==} method is used to determine if two vectors are equal to within
|
|
143
|
+
# tolerance.
|
|
144
|
+
#
|
|
145
|
+
# @example
|
|
146
|
+
# vector1 = Geom::Vector3d.new(1, 0, 0)
|
|
147
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
148
|
+
# # Returns false
|
|
149
|
+
# status = vector1 == vector2
|
|
150
|
+
#
|
|
151
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
152
|
+
#
|
|
153
|
+
# @return [Boolean]
|
|
154
|
+
#
|
|
155
|
+
# @version SketchUp 6.0
|
|
156
|
+
def ==(vector3d)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# The {[]} method is used to access the coordinates of a vector as if it was an
|
|
160
|
+
# Array. The index must be 0, 1 or 2.
|
|
161
|
+
#
|
|
162
|
+
# The following are equivalent:
|
|
163
|
+
#
|
|
164
|
+
# @example
|
|
165
|
+
# vector = Geom::Vector3d.new(1, 1, 0)
|
|
166
|
+
# x = vector[0]
|
|
167
|
+
#
|
|
168
|
+
# @param [Integer] index
|
|
169
|
+
# An index into an array of three coordinates.
|
|
170
|
+
#
|
|
171
|
+
# @return [Length] the value for the x, y, or z coordinate.
|
|
172
|
+
#
|
|
173
|
+
# @version SketchUp 6.0
|
|
174
|
+
def [](index)
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# The {[]=} method is used to set the coordinates of a vector as if it was an
|
|
178
|
+
# Array. The value of i must be 0, 1 or 2.
|
|
179
|
+
#
|
|
180
|
+
# @example
|
|
181
|
+
# vector = Geom::Vector3d.new(4, 5, 0)
|
|
182
|
+
#
|
|
183
|
+
# vector[2] = 10
|
|
184
|
+
#
|
|
185
|
+
# @param [Integer] index
|
|
186
|
+
# The index for the x, y, or z coordinate.
|
|
187
|
+
#
|
|
188
|
+
# @param [Float] value
|
|
189
|
+
# The value for the x, y, or z coordinate.
|
|
190
|
+
#
|
|
191
|
+
# @return [Float] the newly set coordinate value
|
|
192
|
+
#
|
|
193
|
+
# @version SketchUp 6.0
|
|
194
|
+
def []=(index, value)
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# The {#angle_between} method is used to compute the angle (in radians) between
|
|
198
|
+
# this vector and another vector.
|
|
199
|
+
#
|
|
200
|
+
# @example
|
|
201
|
+
# vector1 = Geom::Vector3d.new(1, 0, 0)
|
|
202
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
203
|
+
# angle = vector1.angle_between(vector2)
|
|
204
|
+
#
|
|
205
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
206
|
+
#
|
|
207
|
+
# @return [Float] an angle (in radians)
|
|
208
|
+
#
|
|
209
|
+
# @version SketchUp 6.0
|
|
210
|
+
def angle_between(vector3d)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# The {#axes} method is used to compute an arbitrary set of axes with the given
|
|
214
|
+
# vector as the z-axis direction.
|
|
215
|
+
#
|
|
216
|
+
# Returns an Array of three vectors [xaxis, yaxis, zaxis]
|
|
217
|
+
#
|
|
218
|
+
# Vector3d objects
|
|
219
|
+
#
|
|
220
|
+
# @example
|
|
221
|
+
# vector = Geom::Vector3d.new(1, 0, 0)
|
|
222
|
+
# array = vector.axes
|
|
223
|
+
#
|
|
224
|
+
# @return [Array(Geom::Vector3d, Geom::Vector3d, Geom::Vector3d)] an Array object containing three
|
|
225
|
+
#
|
|
226
|
+
# @version SketchUp 6.0
|
|
227
|
+
def axes
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# The {#clone} method is used to make a copy of a vector.
|
|
231
|
+
#
|
|
232
|
+
# @example
|
|
233
|
+
# vector = Geom::Vector3d.new(1, 0, 0)
|
|
234
|
+
# new_vector = vector.clone
|
|
235
|
+
#
|
|
236
|
+
# @return [Geom::Vector3d] a Vector3d object which is the clone of
|
|
237
|
+
# vector
|
|
238
|
+
#
|
|
239
|
+
# @version SketchUp 6.0
|
|
240
|
+
def clone
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# The {#cross} method is used to compute the cross product between two vectors.
|
|
244
|
+
#
|
|
245
|
+
# The cross product, also called the vector product, is an operation on two
|
|
246
|
+
# vectors. The cross product of two vectors produces a third vector which is
|
|
247
|
+
# perpendicular to the plane in which the first two lie.
|
|
248
|
+
#
|
|
249
|
+
# @example
|
|
250
|
+
# vector1 = Geom::Vector3d.new(1, 2, 0)
|
|
251
|
+
# vector2 = Geom::Vector3d.new(5, 1, 3)
|
|
252
|
+
# # The result is a Vector3d(6, -3, -9)
|
|
253
|
+
# cross = vector1.cross(vector2)
|
|
254
|
+
#
|
|
255
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
256
|
+
#
|
|
257
|
+
# @return [Geom::Vector3d]
|
|
258
|
+
#
|
|
259
|
+
# @see #*
|
|
260
|
+
#
|
|
261
|
+
# @version SketchUp 6.0
|
|
262
|
+
def cross(vector3d)
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# The {#dot} method is used to compute the dot product between two vectors.
|
|
266
|
+
#
|
|
267
|
+
# @example
|
|
268
|
+
# vector1 = Geom::Vector3d.new(0, 5, 1)
|
|
269
|
+
# vector2 = Geom::Vector3d.new(0, 1, 2)
|
|
270
|
+
# # The result is 7
|
|
271
|
+
# dot = vector1.dot(vector2)
|
|
272
|
+
#
|
|
273
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
274
|
+
#
|
|
275
|
+
# @return [Float]
|
|
276
|
+
#
|
|
277
|
+
# @see #%
|
|
278
|
+
#
|
|
279
|
+
# @version SketchUp 6.0
|
|
280
|
+
def dot(vector3d)
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# The new method is used to create a new vector.
|
|
284
|
+
#
|
|
285
|
+
# @example
|
|
286
|
+
# # A vector that runs up the Z axis.
|
|
287
|
+
# vector1 = Geom::Vector3d.new(0, 0, 1)
|
|
288
|
+
#
|
|
289
|
+
# vector2 = Geom::Vector3d.new([1, 1])
|
|
290
|
+
#
|
|
291
|
+
# @overload initialize
|
|
292
|
+
#
|
|
293
|
+
# @return [Geom::Vector3d]
|
|
294
|
+
#
|
|
295
|
+
# @overload initialize(x, y, z)
|
|
296
|
+
#
|
|
297
|
+
# @param [Float] x
|
|
298
|
+
# @param [Float] y
|
|
299
|
+
# @param [Float] z
|
|
300
|
+
# @return [Geom::Vector3d]
|
|
301
|
+
#
|
|
302
|
+
# @overload initialize(array3d)
|
|
303
|
+
#
|
|
304
|
+
# @param [Array(Float, Float, Float)] array3d
|
|
305
|
+
# @return [Geom::Vector3d]
|
|
306
|
+
#
|
|
307
|
+
# @overload initialize(array2d)
|
|
308
|
+
#
|
|
309
|
+
# @param [Array(Float, Float)] array2d
|
|
310
|
+
# @return [Geom::Vector3d]
|
|
311
|
+
#
|
|
312
|
+
# @overload initialize(vector)
|
|
313
|
+
#
|
|
314
|
+
# @param [Geom::Vector3d] vector A Vector3d object.
|
|
315
|
+
# @return [Geom::Vector3d]
|
|
316
|
+
#
|
|
317
|
+
# @version SketchUp 6.0
|
|
318
|
+
def initialize(*args)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# The {#inspect} method is used to inspect the contents of a vector as a
|
|
322
|
+
# friendly string.
|
|
323
|
+
#
|
|
324
|
+
# @example
|
|
325
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
326
|
+
# string = vector.inspect
|
|
327
|
+
#
|
|
328
|
+
# @return [Geom::Vector3d] the Vector3d object
|
|
329
|
+
#
|
|
330
|
+
# @version SketchUp 6.0
|
|
331
|
+
def inspect
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# The {#length} method is used to retrieve the length of the vector.
|
|
335
|
+
#
|
|
336
|
+
# @example
|
|
337
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
338
|
+
# length = vector.length
|
|
339
|
+
#
|
|
340
|
+
# @return [Length] the length of the vector
|
|
341
|
+
#
|
|
342
|
+
# @version SketchUp 6.0
|
|
343
|
+
def length
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# The {#length=} method is used to set the length of the vector. The length must
|
|
347
|
+
# be greater than 0.
|
|
348
|
+
#
|
|
349
|
+
# @example
|
|
350
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
351
|
+
# vector.length = 2
|
|
352
|
+
#
|
|
353
|
+
# @param [Float] length
|
|
354
|
+
# A length for the vector.
|
|
355
|
+
#
|
|
356
|
+
# @return [Length] a newly set length
|
|
357
|
+
#
|
|
358
|
+
# @version SketchUp 6.0
|
|
359
|
+
def length=(length)
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# The {#normalize} method is used to return a vector that is a unit vector
|
|
363
|
+
# of another.
|
|
364
|
+
#
|
|
365
|
+
# @example
|
|
366
|
+
# vector = Geom::Vector3d.new(0, 0, 2)
|
|
367
|
+
# new_vector = vector.normalize
|
|
368
|
+
#
|
|
369
|
+
# @return [Geom::Vector3d] a new normalized Vector3d object
|
|
370
|
+
#
|
|
371
|
+
# @version SketchUp 6.0
|
|
372
|
+
def normalize
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# The {#normalize!} method is used to convert a vector into a unit vector,
|
|
376
|
+
# in place.
|
|
377
|
+
#
|
|
378
|
+
# Another way to do this is +vector.length = 1.0+
|
|
379
|
+
#
|
|
380
|
+
# @example
|
|
381
|
+
# vector = Geom::Vector3d.new(0, 0, 2)
|
|
382
|
+
# vector.normalize!
|
|
383
|
+
#
|
|
384
|
+
# @return [Geom::Vector3d] a normalized Vector3d object
|
|
385
|
+
#
|
|
386
|
+
# @version SketchUp 6.0
|
|
387
|
+
def normalize!
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# The {#parallel?} method determines if two {Geom::Vector3d}s are parallel within a
|
|
391
|
+
# tolerance. Two vectors are parallel if there exists a scalar multiple between them.
|
|
392
|
+
#
|
|
393
|
+
# @example
|
|
394
|
+
# vector1 = Geom::Vector3d.new(1, 2, 4)
|
|
395
|
+
# vector2 = Geom::Vector3d.new(2, 4, 8)
|
|
396
|
+
# # Returns true
|
|
397
|
+
# status = vector1.parallel?(vector2)
|
|
398
|
+
#
|
|
399
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
400
|
+
#
|
|
401
|
+
# @return [Boolean]
|
|
402
|
+
#
|
|
403
|
+
# @version SketchUp 6.0
|
|
404
|
+
def parallel?(vector3d)
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
# The {#perpendicular?} method determines if two Geom::Vector3ds are perpendicular within a
|
|
408
|
+
# tolerance. Two vectors are considered perpendicular if their dot product is zero.
|
|
409
|
+
#
|
|
410
|
+
# @example
|
|
411
|
+
# vector1 = Geom::Vector3d.new(0, 0, 1)
|
|
412
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
413
|
+
# status = vector1.perpendicular?(vector2)
|
|
414
|
+
#
|
|
415
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
416
|
+
#
|
|
417
|
+
# @return [Boolean]
|
|
418
|
+
#
|
|
419
|
+
# @version SketchUp 6.0
|
|
420
|
+
def perpendicular?(vector3d)
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
# The {#reverse} method is used to return a new vector that is the reverse
|
|
424
|
+
# of this vector, while leaving the original unchanged.
|
|
425
|
+
#
|
|
426
|
+
# @example
|
|
427
|
+
# vector = Geom::Vector3d.new(3, 1, 0)
|
|
428
|
+
# new_vector = vector.reverse
|
|
429
|
+
#
|
|
430
|
+
# @return [Geom::Vector3d] a reverse Vector3d object
|
|
431
|
+
#
|
|
432
|
+
# @version SketchUp 6.0
|
|
433
|
+
def reverse
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
# The {#reverse!} method is used to reverse the vector in place.
|
|
437
|
+
#
|
|
438
|
+
# @example
|
|
439
|
+
# vector = Geom::Vector3d.new(3, 1, 0)
|
|
440
|
+
# vector.reverse!
|
|
441
|
+
#
|
|
442
|
+
# @return [Geom::Vector3d] a reverse Vector3d object
|
|
443
|
+
#
|
|
444
|
+
# @version SketchUp 6.0
|
|
445
|
+
def reverse!
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
# The {#samedirection?} method is used to determine if this vector is parallel to
|
|
449
|
+
# and in the same direction as another vector to within tolerance.
|
|
450
|
+
#
|
|
451
|
+
# @example
|
|
452
|
+
# vector1 = Geom::Vector3d.new(2, 4, 1)
|
|
453
|
+
# vector2 = Geom::Vector3d.new(2, 0, 1)
|
|
454
|
+
# # Returns false
|
|
455
|
+
# status = vector1.samedirection?(vector2)
|
|
456
|
+
#
|
|
457
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
458
|
+
#
|
|
459
|
+
# @return [Boolean]
|
|
460
|
+
#
|
|
461
|
+
# @version SketchUp 6.0
|
|
462
|
+
def samedirection?(vector3d)
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
# The {#set!} method is used to set the coordinates of the vector.
|
|
466
|
+
#
|
|
467
|
+
# @example This is a shortcut for writing:
|
|
468
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
469
|
+
# vector.x = 2
|
|
470
|
+
# vector.y = 4
|
|
471
|
+
# vector.z = 0
|
|
472
|
+
#
|
|
473
|
+
# @example You may also call this method with an array or another vector:
|
|
474
|
+
# vector1 = Geom::Vector3d.new
|
|
475
|
+
# vector2 = Geom::Vector3d.new(2, 4, 0)
|
|
476
|
+
# vector1.set!(vector2)
|
|
477
|
+
#
|
|
478
|
+
# @example
|
|
479
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
480
|
+
# vector.set!(2, 4, 0) # is equivalent to vector.set!([2, 4, 0])
|
|
481
|
+
#
|
|
482
|
+
# @overload set!(vector)
|
|
483
|
+
#
|
|
484
|
+
# @param [Geom::Vector3d] vector
|
|
485
|
+
# @return [Geom::Vector3d]
|
|
486
|
+
#
|
|
487
|
+
# @overload set!(x, y, z)
|
|
488
|
+
#
|
|
489
|
+
# @param [Float] x
|
|
490
|
+
# @param [Float] y
|
|
491
|
+
# @param [Float] z
|
|
492
|
+
# @return [Geom::Vector3d]
|
|
493
|
+
#
|
|
494
|
+
# @overload set!(array3d)
|
|
495
|
+
#
|
|
496
|
+
# @param [Array(Float, Float, Float)] array3d
|
|
497
|
+
# @return [Geom::Vector3d]
|
|
498
|
+
#
|
|
499
|
+
# @version SketchUp 6.0
|
|
500
|
+
def set!(*args)
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
# The {#to_a} method retrieves the coordinates of the vector in an Array[x, y, z].
|
|
504
|
+
#
|
|
505
|
+
# @example
|
|
506
|
+
# vector = Geom::Vector3d.new(3, 0, 6)
|
|
507
|
+
# array = vector.to_a
|
|
508
|
+
#
|
|
509
|
+
# @return [Array(Float, Float, Float)] the coordinates of the vector in an array
|
|
510
|
+
#
|
|
511
|
+
# @version SketchUp 6.0
|
|
512
|
+
def to_a
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
# The {#to_s} method is used to format the vector as a String.
|
|
516
|
+
#
|
|
517
|
+
# @example
|
|
518
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
519
|
+
# string = vector.to_s
|
|
520
|
+
#
|
|
521
|
+
# @return [String] a string representation of vector
|
|
522
|
+
#
|
|
523
|
+
# @version SketchUp 6.0
|
|
524
|
+
def to_s
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
# The {#transform} method applies a Transformation to a vector, returning a new vector. The
|
|
528
|
+
# original vector is unchanged by this method.
|
|
529
|
+
#
|
|
530
|
+
# @example
|
|
531
|
+
# vector = Geom::Vector3d.new(0, 2, 1)
|
|
532
|
+
# point = Geom::Point3d.new(2, 3, 1)
|
|
533
|
+
# transformation = Geom::Transformation.scaling(point, 2)
|
|
534
|
+
# # The result is a Vector3d(0, 4, 2)
|
|
535
|
+
# new_vector = vector.transform(transformation)
|
|
536
|
+
#
|
|
537
|
+
# @param [Geom::Transformation] transform
|
|
538
|
+
# A Transformation object to apply to the vector.
|
|
539
|
+
#
|
|
540
|
+
# @return [Geom::Vector3d] the newly transformed vector
|
|
541
|
+
#
|
|
542
|
+
# @version SketchUp 6.0
|
|
543
|
+
def transform(transform)
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
# The {#transform!} method applies a Transformation to a vector. The vector itself is modified.
|
|
547
|
+
#
|
|
548
|
+
# @example
|
|
549
|
+
# vector = Geom::Vector3d.new(0, 2, 1)
|
|
550
|
+
# point = Geom::Point3d.new(2, 3, 1)
|
|
551
|
+
# transformation = Geom::Transformation.scaling(point, 2)
|
|
552
|
+
# # The result is a Vector3d(0, 4, 2)
|
|
553
|
+
# vector.transform!(transformation)
|
|
554
|
+
#
|
|
555
|
+
# @param [Geom::Transformation] transform
|
|
556
|
+
# A Transformation object to apply to the vector.
|
|
557
|
+
#
|
|
558
|
+
# @return [Geom::Vector3d] the transformed vector
|
|
559
|
+
#
|
|
560
|
+
# @version SketchUp 6.0
|
|
561
|
+
def transform!(transform)
|
|
562
|
+
end
|
|
563
|
+
|
|
564
|
+
# The {#unitvector?} method is used to see if the vector is a unit vector.
|
|
565
|
+
#
|
|
566
|
+
# This is equivalent to +vector.length == 1.0+
|
|
567
|
+
#
|
|
568
|
+
# @example
|
|
569
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
570
|
+
# # Return false
|
|
571
|
+
# status = vector.unitvector?
|
|
572
|
+
#
|
|
573
|
+
# @return [Boolean]
|
|
574
|
+
#
|
|
575
|
+
# @version SketchUp 6.0
|
|
576
|
+
def unitvector?
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
# The {#valid?} method is used to verify if a vector is valid. A vector is valid
|
|
580
|
+
# if its length is not zero.
|
|
581
|
+
#
|
|
582
|
+
# @example
|
|
583
|
+
# # A zero length vector will be invalid
|
|
584
|
+
# vector = Geom::Vector3d.new
|
|
585
|
+
# status = vector.valid?
|
|
586
|
+
#
|
|
587
|
+
# # A non-zero length vector is valid
|
|
588
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
589
|
+
# status = vector.valid?
|
|
590
|
+
#
|
|
591
|
+
# @return [Boolean]
|
|
592
|
+
#
|
|
593
|
+
# @version SketchUp 6.0
|
|
594
|
+
def valid?
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
# The {#x} method is used to retrieve the x coordinate of the vector.
|
|
598
|
+
#
|
|
599
|
+
# @example
|
|
600
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
601
|
+
# x = vector.x
|
|
602
|
+
#
|
|
603
|
+
# @return [Float] the x coordinate of the vector
|
|
604
|
+
#
|
|
605
|
+
# @version SketchUp 6.0
|
|
606
|
+
def x
|
|
607
|
+
end
|
|
608
|
+
|
|
609
|
+
# The {#x=} method is used to set the x coordinate of the vector.
|
|
610
|
+
#
|
|
611
|
+
# @example
|
|
612
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
613
|
+
# vector.x = 10
|
|
614
|
+
#
|
|
615
|
+
# @param [Float] x
|
|
616
|
+
# The x coordinate for the vector.
|
|
617
|
+
#
|
|
618
|
+
# @return [Float] the newly set x coordinate for the vector
|
|
619
|
+
#
|
|
620
|
+
# @version SketchUp 6.0
|
|
621
|
+
def x=(x)
|
|
622
|
+
end
|
|
623
|
+
|
|
624
|
+
# The {#y} method is used to retrieve the y coordinate of the vector.
|
|
625
|
+
#
|
|
626
|
+
# @example
|
|
627
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
628
|
+
# y = vector.y
|
|
629
|
+
#
|
|
630
|
+
# @return [Float] the y coordinate of the vector
|
|
631
|
+
#
|
|
632
|
+
# @version SketchUp 6.0
|
|
633
|
+
def y
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
# Set the {#y=} coordinate of the vector.
|
|
637
|
+
#
|
|
638
|
+
# @example
|
|
639
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
640
|
+
# vector.y = 10
|
|
641
|
+
#
|
|
642
|
+
# @param [Float] y
|
|
643
|
+
# The y coordinate for the vector.
|
|
644
|
+
#
|
|
645
|
+
# @return [Float] the newly set y coordinate for the vector
|
|
646
|
+
#
|
|
647
|
+
# @version SketchUp 6.0
|
|
648
|
+
def y=(y)
|
|
649
|
+
end
|
|
650
|
+
|
|
651
|
+
# Get the {#z} coordinate of the vector.
|
|
652
|
+
#
|
|
653
|
+
# @example
|
|
654
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
655
|
+
# z = vector.z
|
|
656
|
+
#
|
|
657
|
+
# @return [Float] the z coordinate of the vector
|
|
658
|
+
#
|
|
659
|
+
# @version SketchUp 6.0
|
|
660
|
+
def z
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
# Set the {#z=} coordinate of the vector.
|
|
664
|
+
#
|
|
665
|
+
# @example
|
|
666
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
667
|
+
# vector.z = 10
|
|
668
|
+
#
|
|
669
|
+
# @param [Float] z
|
|
670
|
+
# The z coordinate for the vector.
|
|
671
|
+
#
|
|
672
|
+
# @return [Float] the newly set z coordinate for the vector
|
|
673
|
+
#
|
|
674
|
+
# @version SketchUp 6.0
|
|
675
|
+
def z=(z)
|
|
676
|
+
end
|
|
677
|
+
|
|
678
|
+
end
|