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