sketchup-api-stubs 0.6.1 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -0
  3. data/lib/sketchup-api-stubs.rb +1 -1
  4. data/lib/sketchup-api-stubs/sketchup.rb +145 -145
  5. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +318 -318
  6. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
  7. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
  8. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -401
  10. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
  11. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +492 -492
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
  13. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
  14. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -523
  16. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
  17. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -569
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +174 -186
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +514 -455
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +143 -155
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -359
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
  27. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -123
  28. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  29. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -86
  30. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +371 -371
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  32. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  33. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +220 -232
  34. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -563
  35. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  37. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
  38. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
  39. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +204 -216
  40. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
  41. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  42. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +694 -547
  43. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  44. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  45. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  48. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +140 -140
  49. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
  50. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +328 -328
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +577 -577
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +281 -281
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +562 -554
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +194 -194
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +329 -329
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +72 -72
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +102 -102
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +312 -312
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +38 -38
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +390 -390
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +508 -508
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1119 -1097
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +125 -125
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +544 -537
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +59 -59
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +750 -750
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +697 -697
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +409 -409
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +226 -226
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +190 -190
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +393 -393
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +82 -82
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +303 -303
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +285 -262
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +244 -231
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +136 -136
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -123
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +416 -416
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +311 -311
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +141 -141
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +95 -95
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1638 -1483
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +356 -356
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +132 -132
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -282
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +770 -650
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +353 -353
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +76 -76
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +456 -456
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -356
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +44 -44
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +454 -454
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +57 -57
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +211 -211
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +225 -225
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +829 -829
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +154 -154
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +61 -61
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1301 -995
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +43 -43
  134. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +310 -310
  135. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +356 -356
  136. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +229 -229
  137. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
  138. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
  139. data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -303
  140. data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
  141. data/lib/sketchup-api-stubs/stubs/geom.rb +348 -233
  142. data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
  143. data/lib/sketchup-api-stubs/stubs/length.rb +278 -262
  144. data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
  145. data/lib/sketchup-api-stubs/stubs/sketchup.rb +1310 -1310
  146. data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +353 -353
  147. data/lib/sketchup-api-stubs/stubs/string.rb +24 -24
  148. data/lib/sketchup-api-stubs/stubs/ui.rb +667 -660
  149. metadata +2 -16
@@ -1,741 +1,741 @@
1
- # Copyright:: Copyright 2019 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The SketchUp Array class adds additional methods to the standard Ruby Array
5
- # class. Specifically, it contains methods allowing an
6
- # array to behave just as a {Geom::Vector3d} or {Geom::Point3d} object
7
- # (which can be thought of as arrays of 3 coordinate values). Therefore, you
8
- # can use the Array class in place of a {Geom::Point3d} or {Geom::Vector3d} as
9
- # a way to pass coordinate values.
10
- #
11
- # @example
12
- # # An array of 3 values can represent a 1" long vector pointing straight
13
- # # up in the z-direction.
14
- # array = [0, 0, 1]
15
- #
16
- # # An array of 3 values can also represent a point 1" above the origin in
17
- # # the z direction. (Note that this is the exact same array.)
18
- # array = [0, 0, 1]
19
- #
20
- # # How it is interpreted is based on context. For example, this code will
21
- # # create a construction point at position 0, 0, 1, since in this context
22
- # # a Point3d is expected.
23
- # entities = Sketchup.active_model.entities
24
- # construction_point = entities.add_cpoint(array)
25
- #
26
- # # Whereas this will move our construction point 1" upward, since in this
27
- # # context a Vector3d is expected.
28
- # transformation = Geom::Transformation.new(array)
29
- # entities.transform_entities(transformation, construction_point)
30
- #
31
- # @version SketchUp 6.0
32
- class Array
33
-
34
- # Instance Methods
35
-
36
- # The {#cross} method is used to compute the cross product between two vectors.
37
- #
38
- # @example With 3d array
39
- # vector1 = Geom::Vector3d.new(0, 1, 0)
40
- # array = [1, 0, 0]
41
- # # This will return a new Vector3d
42
- # vector2 = array.cross(vector1)
43
- #
44
- # @example With 2d array
45
- # vector1 = Geom::Vector2d.new(0, 1)
46
- # array = [1, 0]
47
- # vector2 = array.cross(vector1)
48
- #
49
- # vector1 = Geom::Vector3d.new(0, 1, 0)
50
- # array = [1, 0]
51
- # vector2 = array.cross(vector1) # This will force array to be [1, 0, 0]
52
- #
53
- # @overload cross(vector)
54
- #
55
- # @param [Geom::Vector3d] vector
56
- # @return [Geom::Vector3d]
57
- #
58
- # @overload cross(vector)
59
- #
60
- # @param [Geom::Vector2d] vector
61
- # @return [Geom::Vector2d]
62
- #
63
- # @raise ArgumentError if the argument is the wrong vector type
64
- #
65
- # @version SketchUp 6.0
66
- def cross(vector)
67
- end
68
-
69
- # The {#distance} method is used to compute the distance between two points.
70
- #
71
- # @example With 3d array
72
- # point = Geom::Point3d.new(10, 10, 10)
73
- # array = [1, 1, 1]
74
- # # This will return a Length
75
- # distance = array.distance(point)
76
- #
77
- # @example With 2d array
78
- # point = Geom::Point2d.new(10, 10)
79
- # array = [1, 2]
80
- # distance = array.distance(point)
81
- #
82
- # point = Geom::Point3d.new(10, 10, 10)
83
- # distance = array.distance(point)
84
- #
85
- # @overload distance(point)
86
- #
87
- # @param [Geom::Point3d] point
88
- # @return [Length]
89
- #
90
- # @overload distance(point)
91
- #
92
- # @param [Geom::Point2d] point
93
- # @return [Length]
94
- #
95
- # @raise ArgumentError if the argument is the wrong point type
96
- #
97
- # @version SketchUp 6.0
98
- def distance(point)
99
- end
100
-
101
- # The {#distance_to_line} method is used to compute the distance from a
102
- # {Geom::Point3d} object to a line.
103
- #
104
- # @example
105
- # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
106
- # array = [10, 10, 10]
107
- # # This will return a Length
108
- # distance = array.distance_to_line(line)
109
- #
110
- # @overload distance_to_line(point, vector)
111
- #
112
- # @param [Geom::Point3d] point
113
- # @param [Geom::Vector3d] vector
114
- # @return [Length]
115
- #
116
- # @overload distance_to_line(point1, point2)
117
- #
118
- # @param [Geom::Point3d] point1
119
- # @param [Geom::Point3d] point1
120
- # @return [Length]
121
- #
122
- # @see Geom
123
- # The Geom module for instructions on how to create a line.
124
- #
125
- # @version SketchUp 6.0
126
- def distance_to_line(*args)
127
- end
128
-
129
- # The {#distance_to_plane} method is used to compute the distance from a
130
- # {Geom::Point3d} object to a plane.
131
- #
132
- # @example
133
- # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
134
- # array = [10, 10, 10]
135
- # # This will return a Length
136
- # distance = array.distance_to_plane(plane)
137
- #
138
- # @overload distance_to_plane(point, vector)
139
- #
140
- # Plane defined by
141
- # @param [Geom::Point3d] point
142
- # @param [Geom::Vector3d] vector
143
- # @return [Length] The distance between the two points.
144
- #
145
- # @overload distance_to_plane(point1, point2, point3)
146
- #
147
- # Plane defined by three points.
148
- # @note The three points should not be co-linear or duplicate.
149
- # @param [Geom::Point3d] point1
150
- # @param [Geom::Point3d] point2
151
- # @param [Geom::Point3d] point3
152
- # @return [Length] The distance between the two points.
153
- #
154
- # @overload distance_to_plane(float1, float2, float3, float4)
155
- #
156
- # Plane defined by its coefficents.
157
- # @param [Float] float1
158
- # @param [Float] float2
159
- # @param [Float] float3
160
- # @param [Float] float4
161
- # @return [Length] The distance between the two points.
162
- #
163
- # @overload distance_to_plane(array)
164
- #
165
- # Plane defined by three points.
166
- # @note The three points should not be co-linear or duplicate.
167
- # @param [Array<Geom::Point3d, Geom::Vector3d>] point
168
- # @return [Length] The distance between the two points.
169
- #
170
- # @overload distance_to_plane(array)
171
- #
172
- # Plane defined by three points.
173
- # @param [Array<Geom::Point3d, Geom::Point3d, Geom::Point3d>] point
174
- # @return [Length] The distance between the two points.
175
- #
176
- # @overload distance_to_plane(array)
177
- #
178
- # Plane defined by its coefficents.
179
- # @param [Array<Float, Float, Float, Float>] point
180
- # @return [Length] The distance between the two points.
181
- #
182
- # @see Geom
183
- # The Geom module for instructions on how to create a plane.
184
- #
185
- # @version SketchUp 6.0
186
- def distance_to_plane(*args)
187
- end
188
-
189
- # The {#dot} method is used to compute the dot product between two vectors.
190
- #
191
- # @example With 3d array
192
- # vector = Geom::Vector3d.new(12, 12, 0)
193
- # array = [12, 0, 0]
194
- # # This will return a Float, in this case 144.0
195
- # dot_product = array.dot(vector)
196
- #
197
- # @example With 2d array
198
- # vector = Geom::Vector2d.new(12, 12)
199
- # array = [12, 0]
200
- # # This will return a float
201
- # dot_product = array.dot(vector)
202
- #
203
- # @overload dot(vector)
204
- #
205
- # @param [Geom::Vector3d] vector
206
- # @return [Float]
207
- #
208
- # @overload dot(vector)
209
- #
210
- # @param [Geom::Vector2d] vector
211
- # @return [Float]
212
- #
213
- # @raise ArgumentError if the argument is the wrong vector type
214
- #
215
- # @version SketchUp 6.0
216
- def dot(vector)
217
- end
218
-
219
- # The {#normalize} method is used to normalize a vector (setting its
220
- # length to 1). It returns a new array rather than changing the original in
221
- # place.
222
- #
223
- # @example With 3d array
224
- # array = [1, 2, 3]
225
- # # This will return a new Vector3d
226
- # normal_vector = array.normalize
227
- #
228
- # @example With 2d array
229
- # array = [1, 2]
230
- # normal_vector = array.normalize
231
- #
232
- # @note The arguments and return value will be converted to a floating point
233
- # value. (Unlike in the {Geom::Vector3d#normalize!} method.)
234
- #
235
- # @overload normalize
236
- #
237
- # @return [Array(Float, Float, Float)] an array object representing a vector
238
- #
239
- # @overload normalize
240
- #
241
- # @return [Array(Float, Float)] an array object representing a vector
242
- #
243
- # @version SketchUp 6.0
244
- def normalize
245
- end
246
-
247
- # The {#normalize!} method is used to normalize a vector in place (setting its
248
- # length to 1).
249
- #
250
- # @example With 3d array
251
- # array = [1, 2, 3]
252
- # # This will modify 'array' in place
253
- # array.normalize!
254
- #
255
- # @example With 2d array
256
- # array = [1, 2]
257
- # array.normalize!
258
- #
259
- # @overload normalize!
260
- #
261
- # @return [Array(Float, Float, Float)] an array object representing a vector
262
- #
263
- # @overload normalize!
264
- #
265
- # @return [Array(Float, Float)] an array object representing a vector
266
- #
267
- # @version SketchUp 6.0
268
- def normalize!
269
- end
270
-
271
- # The {#offset} method is used to offset a point by a vector. it returns a new
272
- # array rather than modifying the original in place.
273
- #
274
- # @example With 3d array
275
- # array = [10, 10, 10]
276
- # vector = Geom::Vector3d.new(0, 0, 1)
277
- # # This will modify 'array' in place
278
- # length_array = array.offset(vector)
279
- #
280
- # @example With 2d array
281
- # array = [10, 10]
282
- # vector = Geom::Vector2d.new(0, 1)
283
- # length_array = array.offset(vector)
284
- #
285
- # # Using Vector3d with a 2d array
286
- # array = [10, 10]
287
- # vector = Geom::Vector3d.new(0, 0, 1)
288
- # length_array = array.offset(vector)
289
- #
290
- # @overload offset(vector)
291
- #
292
- # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
293
- # @return [Array(Length, Length, Length)] The newly offset array representing
294
- # a point or vector.
295
- #
296
- # @overload offset(vector)
297
- #
298
- # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
299
- # @return [Array(Length, Length)] The newly offset array representing a point
300
- # or vector.
301
- #
302
- # @overload offset(vector, length)
303
- #
304
- # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
305
- # @param [Length] length An overriding distance for how far to offset.
306
- # @return [Array(Length, Length, Length)] The newly offset array representing
307
- # a point or vector.
308
- #
309
- # @overload offset(vector, length)
310
- #
311
- # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
312
- # @param [Length] length An overriding distance for how far to offset.
313
- # @return [Array(Length, Length)] The newly offset array representing a point
314
- # or vector.
315
- #
316
- # @raise ArgumentError if the argument is the wrong vector type
317
- #
318
- # @version SketchUp 6.0
319
- def offset(*args)
320
- end
321
-
322
- # The {#offset!} method is used to offset a point by a vector. The array is
323
- # modified in place.
324
- #
325
- # @example With 3d array
326
- # array = [10, 10, 10]
327
- # vector = Geom::Vector3d.new(0, 0, 1)
328
- # # This will modify 'array' in place
329
- # array.offset!(vector)
330
- #
331
- # @example With 2d array
332
- # array = [10, 10]
333
- # vector = Geom::Vector2d.new(0, 1)
334
- # array.offset!(vector)
335
- #
336
- # # Using Vector3d with a 2d array
337
- # array = [10, 10]
338
- # vector = Geom::Vector3d.new(0, 0, 1)
339
- # array.offset!(vector)
340
- #
341
- # @overload offset!(vector)
342
- #
343
- # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
344
- # @return [Array(Length, Length, Length)] The newly offset array representing
345
- # a point or vector.
346
- #
347
- # @overload offset!(vector)
348
- #
349
- # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
350
- # @return [Array(Length, Length)] The newly offset array representing a point
351
- # or vector.
352
- #
353
- # @overload offset!(vector, length)
354
- #
355
- # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
356
- # @param [Length] length An overriding distance for how far to offset.
357
- # @return [Array(Length, Length, Length)] The newly offset array representing
358
- # a point or vector.
359
- #
360
- # @overload offset!(vector, length)
361
- #
362
- # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
363
- # @param [Length] length An overriding distance for how far to offset.
364
- # @return [Array(Length, Length)] The newly offset array representing a point
365
- # or vector.
366
- #
367
- # @raise ArgumentError if the argument is the wrong vector type
368
- #
369
- # @version SketchUp 6.0
370
- def offset!(*args)
371
- end
372
-
373
- # The {#on_line?} method is used to determine if a {Geom::Point3d} object is on
374
- # a line.
375
- #
376
- # @example
377
- # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
378
- # array = [10, 10, 10]
379
- # # This will return a true or false value
380
- # on_plane = array.on_line?(line)
381
- #
382
- # @overload on_line?(point, vector)
383
- #
384
- # @param [Geom::Point3d] point
385
- # @param [Geom::Vector3d] vector
386
- # @return [Boolean] +true+ if the point is on the line, +false+ if the
387
- # point is not on the line.
388
- #
389
- # @overload on_line?(point1, point2)
390
- #
391
- # @param [Geom::Point3d] point1
392
- # @param [Geom::Point3d] point1
393
- # @return [Boolean] +true+ if the point is on the line, +false+ if the
394
- # point is not on the line.
395
- #
396
- # @see Geom
397
- # The Geom module for instructions on how to create a line.
398
- #
399
- # @version SketchUp 6.0
400
- def on_line?(*args)
401
- end
402
-
403
- # The {#on_plane?} method is used to determine if a {Geom::Point3d} object is
404
- # on a plane (to within SketchUp's standard floating point tolerance).
405
- #
406
- # @example
407
- # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
408
- # array = [10, 10, 10]
409
- # # This will return a true or false value
410
- # on_plane = array.on_plane?(plane)
411
- #
412
- # @overload on_plane?(point, vector)
413
- #
414
- # Plane defined by
415
- # @param [Geom::Point3d] point
416
- # @param [Geom::Vector3d] vector
417
- #
418
- # @overload on_plane?(point1, point2, point3)
419
- #
420
- # Plane defined by three points.
421
- # @note The three points should not be co-linear or duplicate.
422
- # @param [Geom::Point3d] point1
423
- # @param [Geom::Point3d] point2
424
- # @param [Geom::Point3d] point3
425
- #
426
- # @overload on_plane?(float1, float2, float3, float4)
427
- #
428
- # Plane defined by its coefficents.
429
- # @param [Float] float1
430
- # @param [Float] float2
431
- # @param [Float] float3
432
- # @param [Float] float4
433
- #
434
- # @overload on_plane?(array)
435
- #
436
- # Plane defined by three points.
437
- # @note The three points should not be co-linear or duplicate.
438
- # @param [Array<Geom::Point3d, Geom::Vector3d>] point
439
- #
440
- # @overload on_plane?(array)
441
- #
442
- # Plane defined by three points.
443
- # @param [Array<Geom::Point3d, Geom::Point3d, Geom::Point3d>] point
444
- #
445
- # @overload on_plane?(array)
446
- #
447
- # Plane defined by its coefficents.
448
- # @param [Array<Float, Float, Float, Float>] point
449
- #
450
- # @return [Boolean]
451
- #
452
- # @see Geom
453
- # The Geom module for instructions on how to create a plane.
454
- #
455
- # @version SketchUp 6.0
456
- def on_plane?(*args)
457
- end
458
-
459
- # The {#project_to_line} method is used to retrieve the projection of a
460
- # {Geom::Point3d} object onto a line.
461
- #
462
- # @example
463
- # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
464
- # array = [10, 10, 10]
465
- # # This will return a new Array
466
- # point_on_line = array.project_to_line(line)
467
- #
468
- # @overload project_to_line(point, vector)
469
- #
470
- # @param [Geom::Point3d] point
471
- # @param [Geom::Vector3d] vector
472
- # @return [Array(Length, Length, Length)] A new point on the line that is
473
- # closest to this point
474
- #
475
- # @overload project_to_line(point1, point2)
476
- #
477
- # @param [Geom::Point3d] point1
478
- # @param [Geom::Point3d] point1
479
- # @return [Array(Length, Length, Length)] A new point on the line that is
480
- # closest to this point
481
- #
482
- # @see Geom
483
- # The Geom module for instructions on how to create a line.
484
- #
485
- # @version SketchUp 6.0
486
- def project_to_line(*args)
487
- end
488
-
489
- # The {#project_to_plane} method retrieves the projection of a {Geom::Point3d}
490
- # onto a plane.
491
- #
492
- # @example
493
- # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
494
- # array = [10, 10, 10]
495
- # point_on_plane = array.project_to_plane(plane)
496
- #
497
- # @overload project_to_plane(point, vector)
498
- #
499
- # Plane defined by
500
- # @param [Geom::Point3d] point
501
- # @param [Geom::Vector3d] vector
502
- # @return [Array(Length, Length, Length)]
503
- #
504
- # @overload project_to_plane(point1, point2, point3)
505
- #
506
- # Plane defined by three points.
507
- # @note The three points should not be co-linear or duplicate.
508
- # @param [Geom::Point3d] point1
509
- # @param [Geom::Point3d] point2
510
- # @param [Geom::Point3d] point3
511
- # @return [Array(Length, Length, Length)]
512
- #
513
- # @overload project_to_plane(float1, float2, float3, float4)
514
- #
515
- # Plane defined by its coefficents.
516
- # @param [Float] float1
517
- # @param [Float] float2
518
- # @param [Float] float3
519
- # @param [Float] float4
520
- # @return [Array(Length, Length, Length)]
521
- #
522
- # @overload project_to_plane(array)
523
- #
524
- # Plane defined by three points.
525
- # @note The three points should not be co-linear or duplicate.
526
- # @param [Array(Geom::Point3d, Geom::Vector3d)] point
527
- # @return [Array(Length, Length, Length)]
528
- #
529
- # @overload project_to_plane(array)
530
- #
531
- # Plane defined by three points.
532
- # @param [Array(Geom::Point3d, Geom::Point3d, Geom::Point3d)] point
533
- # @return [Array(Length, Length, Length)]
534
- #
535
- # @overload project_to_plane(array)
536
- #
537
- # Plane defined by its coefficents.
538
- # @param [Array(Float, Float, Float, Float)] point
539
- # @return [Array(Length, Length, Length)]
540
- #
541
- # @see Geom
542
- # The Geom module for instructions on how to create a plane.
543
- #
544
- # @version SketchUp 6.0
545
- def project_to_plane(*args)
546
- end
547
-
548
- # The {#transform} method is used to apply a {Geom::Transformation} or
549
- # {Geom::Transformation2d} object to a {Geom::Point3d} or {Geom::Point2d} object
550
- # defined by an {Array} object.
551
- #
552
- # This method returns a new {Array} object instead of modifying the original.
553
- #
554
- # @example
555
- # point1 = Geom::Point3d.new(10, 20, 30)
556
- # transform = Geom::Transformation.new(point1)
557
- # array = [1, 2, 3]
558
- # # This will return a new Array
559
- # point2 = array.transform(transform)
560
- #
561
- # @overload transform(transform)
562
- #
563
- # @param [Geom::Transformation2d] transform
564
- # @return [Array<Length, Length>] The newly transformed point.
565
- #
566
- # @overload transform(transform)
567
- #
568
- # @param [Geom::Transformation] transform
569
- # @return [Array<Length, Length, Length>] The newly transformed point.
570
- #
571
- # @version SketchUp 6.0
572
- def transform(transform)
573
- end
574
-
575
- # The {#transform!} method is used to apply a {Geom::Transformation} object to
576
- # a {Geom::Point3d} object defined by an {Array} object.
577
- #
578
- # @example
579
- # point = Geom::Point3d.new(10, 20, 30)
580
- # transform = Geom::Transformation.new(point)
581
- # array = [1, 2, 3]
582
- # # This will modify 'array' in place
583
- # array.transform!(transform)
584
- #
585
- # @note This method modifies the original.
586
- #
587
- # @overload transform!(transform)
588
- #
589
- # @param [Geom::Transformation2d] transform
590
- # @return [Array] The newly transformed point.
591
- #
592
- # @overload transform!(transform)
593
- #
594
- # @param [Geom::Transformation] transform
595
- # @return [Array] The newly transformed point.
596
- #
597
- # @version SketchUp 6.0
598
- def transform!(transform)
599
- end
600
-
601
- # The {#vector_to} method is used to create an array as a vector from one point
602
- # to a second point.
603
- #
604
- # @example With 3d array
605
- # point = Geom::Point3d.new(10, 20, 30)
606
- # array = [1, 2, 3]
607
- # # This will return a new Vector3d
608
- # vector = array.vector_to(point)
609
- #
610
- # @example With 2d array
611
- # point = Geom::Point2d.new(10, 20)
612
- # array = [1, 2]
613
- # # This will return a new Vector2d
614
- # vector = array.vector_to(point)
615
- #
616
- # point = Geom::Point3d.new(10, 20)
617
- # # This will return a new Vector3d
618
- # vector = array.vector_to(point)
619
- #
620
- # @overload vector_to(point)
621
- #
622
- # @param [Geom::Point3d] point
623
- # @return [Geom::Vector3d]
624
- #
625
- # @overload vector_to(point)
626
- #
627
- # @param [Geom::Point2d] point
628
- # @return [Geom::Vector2d]
629
- #
630
- # @raise ArgumentError if the argument is the wrong point type
631
- #
632
- # @version SketchUp 6.0
633
- def vector_to(point)
634
- end
635
-
636
- # The {#x} method retrieves the x coordinate.
637
- #
638
- # @example
639
- # array = [1, 2, 3]
640
- # # This will return a Fixnum, in this case 1
641
- # x = array.x
642
- #
643
- # array = [1.0, 2.0, 3.0]
644
- # # This will return a Float, in this case 1.0
645
- # x = array.x
646
- #
647
- # @return [Object, nil] The x coordinate if successful
648
- #
649
- # @version SketchUp 6.0
650
- def x
651
- end
652
-
653
- # The {#x=} method sets the x coordinate.
654
- #
655
- # @example
656
- # array = [1, 2, 3]
657
- # # This will initialize the x value as a Float
658
- # array.x = 2.5
659
- # # This will initialize the x value as a Fixnum
660
- # array.x = 5
661
- #
662
- # @param [Object] x
663
- # The new x position.
664
- #
665
- # @return [Object] The new x coordinate if successful
666
- #
667
- # @version SketchUp 6.0
668
- def x=(x)
669
- end
670
-
671
- # The {#y} method retrieves the y coordinate.
672
- #
673
- # @example
674
- # array = [1, 2, 3]
675
- # # This will return a Fixnum, in this case 2
676
- # y = array.y
677
- #
678
- # array = [1.0, 2.0, 3.0]
679
- # # This will return a Float, in this case 2.0
680
- # y = array.y
681
- #
682
- # @return [Object, nil] The y coordinate if successful
683
- #
684
- # @version SketchUp 6.0
685
- def y
686
- end
687
-
688
- # The {#y=} method sets the y coordinate.
689
- #
690
- # @example
691
- # array = [1, 2, 3]
692
- # # This will initialize the y value as a Float
693
- # array.y = 2.5
694
- # # This will initialize the y value as a Fixnum
695
- # array.y = 5
696
- #
697
- # @param [Object] y
698
- # The new y position.
699
- #
700
- # @return [Object] The new y coordinate if successful
701
- #
702
- # @version SketchUp 6.0
703
- def y=(y)
704
- end
705
-
706
- # The {#z} method retrieves the z coordinate.
707
- #
708
- # @example
709
- # array = [1, 2, 3]
710
- # # This will return a Fixnum, in this case 3
711
- # z = array.z
712
- #
713
- # array = [1.0, 2.0, 3.0]
714
- # # This will return a Float, in this case 3.0
715
- # z = array.z
716
- #
717
- # @return [Object, nil] The z coordinate if successful
718
- #
719
- # @version SketchUp 6.0
720
- def z
721
- end
722
-
723
- # The {#z=} method sets the z coordinate.
724
- #
725
- # @example
726
- # array = [1, 2, 3]
727
- # # This will initialize the z value as a Float
728
- # array.z = 2.5
729
- # # This will initialize the z value as a Fixnum
730
- # array.z = 5
731
- #
732
- # @param [Object] z
733
- # The new z position.
734
- #
735
- # @return [Object] The new z coordinate if successful
736
- #
737
- # @version SketchUp 6.0
738
- def z=(z)
739
- end
740
-
741
- end
1
+ # Copyright:: Copyright 2020 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The SketchUp Array class adds additional methods to the standard Ruby Array
5
+ # class. Specifically, it contains methods allowing an
6
+ # array to behave just as a {Geom::Vector3d} or {Geom::Point3d} object
7
+ # (which can be thought of as arrays of 3 coordinate values). Therefore, you
8
+ # can use the Array class in place of a {Geom::Point3d} or {Geom::Vector3d} as
9
+ # a way to pass coordinate values.
10
+ #
11
+ # @example
12
+ # # An array of 3 values can represent a 1" long vector pointing straight
13
+ # # up in the z-direction.
14
+ # array = [0, 0, 1]
15
+ #
16
+ # # An array of 3 values can also represent a point 1" above the origin in
17
+ # # the z direction. (Note that this is the exact same array.)
18
+ # array = [0, 0, 1]
19
+ #
20
+ # # How it is interpreted is based on context. For example, this code will
21
+ # # create a construction point at position 0, 0, 1, since in this context
22
+ # # a Point3d is expected.
23
+ # entities = Sketchup.active_model.entities
24
+ # construction_point = entities.add_cpoint(array)
25
+ #
26
+ # # Whereas this will move our construction point 1" upward, since in this
27
+ # # context a Vector3d is expected.
28
+ # transformation = Geom::Transformation.new(array)
29
+ # entities.transform_entities(transformation, construction_point)
30
+ #
31
+ # @version SketchUp 6.0
32
+ class Array
33
+
34
+ # Instance Methods
35
+
36
+ # The {#cross} method is used to compute the cross product between two vectors.
37
+ #
38
+ # @example With 3d array
39
+ # vector1 = Geom::Vector3d.new(0, 1, 0)
40
+ # array = [1, 0, 0]
41
+ # # This will return a new Vector3d
42
+ # vector2 = array.cross(vector1)
43
+ #
44
+ # @example With 2d array
45
+ # vector1 = Geom::Vector2d.new(0, 1)
46
+ # array = [1, 0]
47
+ # vector2 = array.cross(vector1)
48
+ #
49
+ # vector1 = Geom::Vector3d.new(0, 1, 0)
50
+ # array = [1, 0]
51
+ # vector2 = array.cross(vector1) # This will force array to be [1, 0, 0]
52
+ #
53
+ # @overload cross(vector)
54
+ #
55
+ # @param [Geom::Vector3d] vector
56
+ # @return [Geom::Vector3d]
57
+ #
58
+ # @overload cross(vector)
59
+ #
60
+ # @param [Geom::Vector2d] vector
61
+ # @return [Geom::Vector2d]
62
+ #
63
+ # @raise ArgumentError if the argument is the wrong vector type
64
+ #
65
+ # @version SketchUp 6.0
66
+ def cross(vector)
67
+ end
68
+
69
+ # The {#distance} method is used to compute the distance between two points.
70
+ #
71
+ # @example With 3d array
72
+ # point = Geom::Point3d.new(10, 10, 10)
73
+ # array = [1, 1, 1]
74
+ # # This will return a Length
75
+ # distance = array.distance(point)
76
+ #
77
+ # @example With 2d array
78
+ # point = Geom::Point2d.new(10, 10)
79
+ # array = [1, 2]
80
+ # distance = array.distance(point)
81
+ #
82
+ # point = Geom::Point3d.new(10, 10, 10)
83
+ # distance = array.distance(point)
84
+ #
85
+ # @overload distance(point)
86
+ #
87
+ # @param [Geom::Point3d] point
88
+ # @return [Length]
89
+ #
90
+ # @overload distance(point)
91
+ #
92
+ # @param [Geom::Point2d] point
93
+ # @return [Length]
94
+ #
95
+ # @raise ArgumentError if the argument is the wrong point type
96
+ #
97
+ # @version SketchUp 6.0
98
+ def distance(point)
99
+ end
100
+
101
+ # The {#distance_to_line} method is used to compute the distance from a
102
+ # {Geom::Point3d} object to a line.
103
+ #
104
+ # @example
105
+ # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
106
+ # array = [10, 10, 10]
107
+ # # This will return a Length
108
+ # distance = array.distance_to_line(line)
109
+ #
110
+ # @overload distance_to_line(point, vector)
111
+ #
112
+ # @param [Geom::Point3d] point
113
+ # @param [Geom::Vector3d] vector
114
+ # @return [Length]
115
+ #
116
+ # @overload distance_to_line(point1, point2)
117
+ #
118
+ # @param [Geom::Point3d] point1
119
+ # @param [Geom::Point3d] point1
120
+ # @return [Length]
121
+ #
122
+ # @see Geom
123
+ # The Geom module for instructions on how to create a line.
124
+ #
125
+ # @version SketchUp 6.0
126
+ def distance_to_line(*args)
127
+ end
128
+
129
+ # The {#distance_to_plane} method is used to compute the distance from a
130
+ # {Geom::Point3d} object to a plane.
131
+ #
132
+ # @example
133
+ # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
134
+ # array = [10, 10, 10]
135
+ # # This will return a Length
136
+ # distance = array.distance_to_plane(plane)
137
+ #
138
+ # @overload distance_to_plane(point, vector)
139
+ #
140
+ # Plane defined by
141
+ # @param [Geom::Point3d] point
142
+ # @param [Geom::Vector3d] vector
143
+ # @return [Length] The distance between the two points.
144
+ #
145
+ # @overload distance_to_plane(point1, point2, point3)
146
+ #
147
+ # Plane defined by three points.
148
+ # @note The three points should not be co-linear or duplicate.
149
+ # @param [Geom::Point3d] point1
150
+ # @param [Geom::Point3d] point2
151
+ # @param [Geom::Point3d] point3
152
+ # @return [Length] The distance between the two points.
153
+ #
154
+ # @overload distance_to_plane(float1, float2, float3, float4)
155
+ #
156
+ # Plane defined by its coefficents.
157
+ # @param [Float] float1
158
+ # @param [Float] float2
159
+ # @param [Float] float3
160
+ # @param [Float] float4
161
+ # @return [Length] The distance between the two points.
162
+ #
163
+ # @overload distance_to_plane(array)
164
+ #
165
+ # Plane defined by three points.
166
+ # @note The three points should not be co-linear or duplicate.
167
+ # @param [Array<Geom::Point3d, Geom::Vector3d>] point
168
+ # @return [Length] The distance between the two points.
169
+ #
170
+ # @overload distance_to_plane(array)
171
+ #
172
+ # Plane defined by three points.
173
+ # @param [Array<Geom::Point3d, Geom::Point3d, Geom::Point3d>] point
174
+ # @return [Length] The distance between the two points.
175
+ #
176
+ # @overload distance_to_plane(array)
177
+ #
178
+ # Plane defined by its coefficents.
179
+ # @param [Array<Float, Float, Float, Float>] point
180
+ # @return [Length] The distance between the two points.
181
+ #
182
+ # @see Geom
183
+ # The Geom module for instructions on how to create a plane.
184
+ #
185
+ # @version SketchUp 6.0
186
+ def distance_to_plane(*args)
187
+ end
188
+
189
+ # The {#dot} method is used to compute the dot product between two vectors.
190
+ #
191
+ # @example With 3d array
192
+ # vector = Geom::Vector3d.new(12, 12, 0)
193
+ # array = [12, 0, 0]
194
+ # # This will return a Float, in this case 144.0
195
+ # dot_product = array.dot(vector)
196
+ #
197
+ # @example With 2d array
198
+ # vector = Geom::Vector2d.new(12, 12)
199
+ # array = [12, 0]
200
+ # # This will return a float
201
+ # dot_product = array.dot(vector)
202
+ #
203
+ # @overload dot(vector)
204
+ #
205
+ # @param [Geom::Vector3d] vector
206
+ # @return [Float]
207
+ #
208
+ # @overload dot(vector)
209
+ #
210
+ # @param [Geom::Vector2d] vector
211
+ # @return [Float]
212
+ #
213
+ # @raise ArgumentError if the argument is the wrong vector type
214
+ #
215
+ # @version SketchUp 6.0
216
+ def dot(vector)
217
+ end
218
+
219
+ # The {#normalize} method is used to normalize a vector (setting its
220
+ # length to 1). It returns a new array rather than changing the original in
221
+ # place.
222
+ #
223
+ # @example With 3d array
224
+ # array = [1, 2, 3]
225
+ # # This will return a new Vector3d
226
+ # normal_vector = array.normalize
227
+ #
228
+ # @example With 2d array
229
+ # array = [1, 2]
230
+ # normal_vector = array.normalize
231
+ #
232
+ # @note The arguments and return value will be converted to a floating point
233
+ # value. (Unlike in the {Geom::Vector3d#normalize!} method.)
234
+ #
235
+ # @overload normalize
236
+ #
237
+ # @return [Array(Float, Float, Float)] an array object representing a vector
238
+ #
239
+ # @overload normalize
240
+ #
241
+ # @return [Array(Float, Float)] an array object representing a vector
242
+ #
243
+ # @version SketchUp 6.0
244
+ def normalize
245
+ end
246
+
247
+ # The {#normalize!} method is used to normalize a vector in place (setting its
248
+ # length to 1).
249
+ #
250
+ # @example With 3d array
251
+ # array = [1, 2, 3]
252
+ # # This will modify 'array' in place
253
+ # array.normalize!
254
+ #
255
+ # @example With 2d array
256
+ # array = [1, 2]
257
+ # array.normalize!
258
+ #
259
+ # @overload normalize!
260
+ #
261
+ # @return [Array(Float, Float, Float)] an array object representing a vector
262
+ #
263
+ # @overload normalize!
264
+ #
265
+ # @return [Array(Float, Float)] an array object representing a vector
266
+ #
267
+ # @version SketchUp 6.0
268
+ def normalize!
269
+ end
270
+
271
+ # The {#offset} method is used to offset a point by a vector. it returns a new
272
+ # array rather than modifying the original in place.
273
+ #
274
+ # @example With 3d array
275
+ # array = [10, 10, 10]
276
+ # vector = Geom::Vector3d.new(0, 0, 1)
277
+ # # This will modify 'array' in place
278
+ # length_array = array.offset(vector)
279
+ #
280
+ # @example With 2d array
281
+ # array = [10, 10]
282
+ # vector = Geom::Vector2d.new(0, 1)
283
+ # length_array = array.offset(vector)
284
+ #
285
+ # # Using Vector3d with a 2d array
286
+ # array = [10, 10]
287
+ # vector = Geom::Vector3d.new(0, 0, 1)
288
+ # length_array = array.offset(vector)
289
+ #
290
+ # @overload offset(vector)
291
+ #
292
+ # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
293
+ # @return [Array(Length, Length, Length)] The newly offset array representing
294
+ # a point or vector.
295
+ #
296
+ # @overload offset(vector)
297
+ #
298
+ # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
299
+ # @return [Array(Length, Length)] The newly offset array representing a point
300
+ # or vector.
301
+ #
302
+ # @overload offset(vector, length)
303
+ #
304
+ # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
305
+ # @param [Length] length An overriding distance for how far to offset.
306
+ # @return [Array(Length, Length, Length)] The newly offset array representing
307
+ # a point or vector.
308
+ #
309
+ # @overload offset(vector, length)
310
+ #
311
+ # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
312
+ # @param [Length] length An overriding distance for how far to offset.
313
+ # @return [Array(Length, Length)] The newly offset array representing a point
314
+ # or vector.
315
+ #
316
+ # @raise ArgumentError if the argument is the wrong vector type
317
+ #
318
+ # @version SketchUp 6.0
319
+ def offset(*args)
320
+ end
321
+
322
+ # The {#offset!} method is used to offset a point by a vector. The array is
323
+ # modified in place.
324
+ #
325
+ # @example With 3d array
326
+ # array = [10, 10, 10]
327
+ # vector = Geom::Vector3d.new(0, 0, 1)
328
+ # # This will modify 'array' in place
329
+ # array.offset!(vector)
330
+ #
331
+ # @example With 2d array
332
+ # array = [10, 10]
333
+ # vector = Geom::Vector2d.new(0, 1)
334
+ # array.offset!(vector)
335
+ #
336
+ # # Using Vector3d with a 2d array
337
+ # array = [10, 10]
338
+ # vector = Geom::Vector3d.new(0, 0, 1)
339
+ # array.offset!(vector)
340
+ #
341
+ # @overload offset!(vector)
342
+ #
343
+ # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
344
+ # @return [Array(Length, Length, Length)] The newly offset array representing
345
+ # a point or vector.
346
+ #
347
+ # @overload offset!(vector)
348
+ #
349
+ # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
350
+ # @return [Array(Length, Length)] The newly offset array representing a point
351
+ # or vector.
352
+ #
353
+ # @overload offset!(vector, length)
354
+ #
355
+ # @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
356
+ # @param [Length] length An overriding distance for how far to offset.
357
+ # @return [Array(Length, Length, Length)] The newly offset array representing
358
+ # a point or vector.
359
+ #
360
+ # @overload offset!(vector, length)
361
+ #
362
+ # @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
363
+ # @param [Length] length An overriding distance for how far to offset.
364
+ # @return [Array(Length, Length)] The newly offset array representing a point
365
+ # or vector.
366
+ #
367
+ # @raise ArgumentError if the argument is the wrong vector type
368
+ #
369
+ # @version SketchUp 6.0
370
+ def offset!(*args)
371
+ end
372
+
373
+ # The {#on_line?} method is used to determine if a {Geom::Point3d} object is on
374
+ # a line.
375
+ #
376
+ # @example
377
+ # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
378
+ # array = [10, 10, 10]
379
+ # # This will return a true or false value
380
+ # on_plane = array.on_line?(line)
381
+ #
382
+ # @overload on_line?(point, vector)
383
+ #
384
+ # @param [Geom::Point3d] point
385
+ # @param [Geom::Vector3d] vector
386
+ # @return [Boolean] +true+ if the point is on the line, +false+ if the
387
+ # point is not on the line.
388
+ #
389
+ # @overload on_line?(point1, point2)
390
+ #
391
+ # @param [Geom::Point3d] point1
392
+ # @param [Geom::Point3d] point1
393
+ # @return [Boolean] +true+ if the point is on the line, +false+ if the
394
+ # point is not on the line.
395
+ #
396
+ # @see Geom
397
+ # The Geom module for instructions on how to create a line.
398
+ #
399
+ # @version SketchUp 6.0
400
+ def on_line?(*args)
401
+ end
402
+
403
+ # The {#on_plane?} method is used to determine if a {Geom::Point3d} object is
404
+ # on a plane (to within SketchUp's standard floating point tolerance).
405
+ #
406
+ # @example
407
+ # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
408
+ # array = [10, 10, 10]
409
+ # # This will return a true or false value
410
+ # on_plane = array.on_plane?(plane)
411
+ #
412
+ # @overload on_plane?(point, vector)
413
+ #
414
+ # Plane defined by
415
+ # @param [Geom::Point3d] point
416
+ # @param [Geom::Vector3d] vector
417
+ #
418
+ # @overload on_plane?(point1, point2, point3)
419
+ #
420
+ # Plane defined by three points.
421
+ # @note The three points should not be co-linear or duplicate.
422
+ # @param [Geom::Point3d] point1
423
+ # @param [Geom::Point3d] point2
424
+ # @param [Geom::Point3d] point3
425
+ #
426
+ # @overload on_plane?(float1, float2, float3, float4)
427
+ #
428
+ # Plane defined by its coefficents.
429
+ # @param [Float] float1
430
+ # @param [Float] float2
431
+ # @param [Float] float3
432
+ # @param [Float] float4
433
+ #
434
+ # @overload on_plane?(array)
435
+ #
436
+ # Plane defined by three points.
437
+ # @note The three points should not be co-linear or duplicate.
438
+ # @param [Array<Geom::Point3d, Geom::Vector3d>] point
439
+ #
440
+ # @overload on_plane?(array)
441
+ #
442
+ # Plane defined by three points.
443
+ # @param [Array<Geom::Point3d, Geom::Point3d, Geom::Point3d>] point
444
+ #
445
+ # @overload on_plane?(array)
446
+ #
447
+ # Plane defined by its coefficents.
448
+ # @param [Array<Float, Float, Float, Float>] point
449
+ #
450
+ # @return [Boolean]
451
+ #
452
+ # @see Geom
453
+ # The Geom module for instructions on how to create a plane.
454
+ #
455
+ # @version SketchUp 6.0
456
+ def on_plane?(*args)
457
+ end
458
+
459
+ # The {#project_to_line} method is used to retrieve the projection of a
460
+ # {Geom::Point3d} object onto a line.
461
+ #
462
+ # @example
463
+ # line = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
464
+ # array = [10, 10, 10]
465
+ # # This will return a new Array
466
+ # point_on_line = array.project_to_line(line)
467
+ #
468
+ # @overload project_to_line(point, vector)
469
+ #
470
+ # @param [Geom::Point3d] point
471
+ # @param [Geom::Vector3d] vector
472
+ # @return [Array(Length, Length, Length)] A new point on the line that is
473
+ # closest to this point
474
+ #
475
+ # @overload project_to_line(point1, point2)
476
+ #
477
+ # @param [Geom::Point3d] point1
478
+ # @param [Geom::Point3d] point1
479
+ # @return [Array(Length, Length, Length)] A new point on the line that is
480
+ # closest to this point
481
+ #
482
+ # @see Geom
483
+ # The Geom module for instructions on how to create a line.
484
+ #
485
+ # @version SketchUp 6.0
486
+ def project_to_line(*args)
487
+ end
488
+
489
+ # The {#project_to_plane} method retrieves the projection of a {Geom::Point3d}
490
+ # onto a plane.
491
+ #
492
+ # @example
493
+ # plane = [Geom::Point3d.new(0, 0, 0), Geom::Vector3d.new(0, 0, 1)]
494
+ # array = [10, 10, 10]
495
+ # point_on_plane = array.project_to_plane(plane)
496
+ #
497
+ # @overload project_to_plane(point, vector)
498
+ #
499
+ # Plane defined by
500
+ # @param [Geom::Point3d] point
501
+ # @param [Geom::Vector3d] vector
502
+ # @return [Array(Length, Length, Length)]
503
+ #
504
+ # @overload project_to_plane(point1, point2, point3)
505
+ #
506
+ # Plane defined by three points.
507
+ # @note The three points should not be co-linear or duplicate.
508
+ # @param [Geom::Point3d] point1
509
+ # @param [Geom::Point3d] point2
510
+ # @param [Geom::Point3d] point3
511
+ # @return [Array(Length, Length, Length)]
512
+ #
513
+ # @overload project_to_plane(float1, float2, float3, float4)
514
+ #
515
+ # Plane defined by its coefficents.
516
+ # @param [Float] float1
517
+ # @param [Float] float2
518
+ # @param [Float] float3
519
+ # @param [Float] float4
520
+ # @return [Array(Length, Length, Length)]
521
+ #
522
+ # @overload project_to_plane(array)
523
+ #
524
+ # Plane defined by three points.
525
+ # @note The three points should not be co-linear or duplicate.
526
+ # @param [Array(Geom::Point3d, Geom::Vector3d)] point
527
+ # @return [Array(Length, Length, Length)]
528
+ #
529
+ # @overload project_to_plane(array)
530
+ #
531
+ # Plane defined by three points.
532
+ # @param [Array(Geom::Point3d, Geom::Point3d, Geom::Point3d)] point
533
+ # @return [Array(Length, Length, Length)]
534
+ #
535
+ # @overload project_to_plane(array)
536
+ #
537
+ # Plane defined by its coefficents.
538
+ # @param [Array(Float, Float, Float, Float)] point
539
+ # @return [Array(Length, Length, Length)]
540
+ #
541
+ # @see Geom
542
+ # The Geom module for instructions on how to create a plane.
543
+ #
544
+ # @version SketchUp 6.0
545
+ def project_to_plane(*args)
546
+ end
547
+
548
+ # The {#transform} method is used to apply a {Geom::Transformation} or
549
+ # {Geom::Transformation2d} object to a {Geom::Point3d} or {Geom::Point2d} object
550
+ # defined by an {Array} object.
551
+ #
552
+ # This method returns a new {Array} object instead of modifying the original.
553
+ #
554
+ # @example
555
+ # point1 = Geom::Point3d.new(10, 20, 30)
556
+ # transform = Geom::Transformation.new(point1)
557
+ # array = [1, 2, 3]
558
+ # # This will return a new Array
559
+ # point2 = array.transform(transform)
560
+ #
561
+ # @overload transform(transform)
562
+ #
563
+ # @param [Geom::Transformation2d] transform
564
+ # @return [Array<Length, Length>] The newly transformed point.
565
+ #
566
+ # @overload transform(transform)
567
+ #
568
+ # @param [Geom::Transformation] transform
569
+ # @return [Array<Length, Length, Length>] The newly transformed point.
570
+ #
571
+ # @version SketchUp 6.0
572
+ def transform(transform)
573
+ end
574
+
575
+ # The {#transform!} method is used to apply a {Geom::Transformation} object to
576
+ # a {Geom::Point3d} object defined by an {Array} object.
577
+ #
578
+ # @example
579
+ # point = Geom::Point3d.new(10, 20, 30)
580
+ # transform = Geom::Transformation.new(point)
581
+ # array = [1, 2, 3]
582
+ # # This will modify 'array' in place
583
+ # array.transform!(transform)
584
+ #
585
+ # @note This method modifies the original.
586
+ #
587
+ # @overload transform!(transform)
588
+ #
589
+ # @param [Geom::Transformation2d] transform
590
+ # @return [Array] The newly transformed point.
591
+ #
592
+ # @overload transform!(transform)
593
+ #
594
+ # @param [Geom::Transformation] transform
595
+ # @return [Array] The newly transformed point.
596
+ #
597
+ # @version SketchUp 6.0
598
+ def transform!(transform)
599
+ end
600
+
601
+ # The {#vector_to} method is used to create an array as a vector from one point
602
+ # to a second point.
603
+ #
604
+ # @example With 3d array
605
+ # point = Geom::Point3d.new(10, 20, 30)
606
+ # array = [1, 2, 3]
607
+ # # This will return a new Vector3d
608
+ # vector = array.vector_to(point)
609
+ #
610
+ # @example With 2d array
611
+ # point = Geom::Point2d.new(10, 20)
612
+ # array = [1, 2]
613
+ # # This will return a new Vector2d
614
+ # vector = array.vector_to(point)
615
+ #
616
+ # point = Geom::Point3d.new(10, 20)
617
+ # # This will return a new Vector3d
618
+ # vector = array.vector_to(point)
619
+ #
620
+ # @overload vector_to(point)
621
+ #
622
+ # @param [Geom::Point3d] point
623
+ # @return [Geom::Vector3d]
624
+ #
625
+ # @overload vector_to(point)
626
+ #
627
+ # @param [Geom::Point2d] point
628
+ # @return [Geom::Vector2d]
629
+ #
630
+ # @raise ArgumentError if the argument is the wrong point type
631
+ #
632
+ # @version SketchUp 6.0
633
+ def vector_to(point)
634
+ end
635
+
636
+ # The {#x} method retrieves the x coordinate.
637
+ #
638
+ # @example
639
+ # array = [1, 2, 3]
640
+ # # This will return a Fixnum, in this case 1
641
+ # x = array.x
642
+ #
643
+ # array = [1.0, 2.0, 3.0]
644
+ # # This will return a Float, in this case 1.0
645
+ # x = array.x
646
+ #
647
+ # @return [Object, nil] The x coordinate if successful
648
+ #
649
+ # @version SketchUp 6.0
650
+ def x
651
+ end
652
+
653
+ # The {#x=} method sets the x coordinate.
654
+ #
655
+ # @example
656
+ # array = [1, 2, 3]
657
+ # # This will initialize the x value as a Float
658
+ # array.x = 2.5
659
+ # # This will initialize the x value as a Fixnum
660
+ # array.x = 5
661
+ #
662
+ # @param [Object] x
663
+ # The new x position.
664
+ #
665
+ # @return [Object] The new x coordinate if successful
666
+ #
667
+ # @version SketchUp 6.0
668
+ def x=(x)
669
+ end
670
+
671
+ # The {#y} method retrieves the y coordinate.
672
+ #
673
+ # @example
674
+ # array = [1, 2, 3]
675
+ # # This will return a Fixnum, in this case 2
676
+ # y = array.y
677
+ #
678
+ # array = [1.0, 2.0, 3.0]
679
+ # # This will return a Float, in this case 2.0
680
+ # y = array.y
681
+ #
682
+ # @return [Object, nil] The y coordinate if successful
683
+ #
684
+ # @version SketchUp 6.0
685
+ def y
686
+ end
687
+
688
+ # The {#y=} method sets the y coordinate.
689
+ #
690
+ # @example
691
+ # array = [1, 2, 3]
692
+ # # This will initialize the y value as a Float
693
+ # array.y = 2.5
694
+ # # This will initialize the y value as a Fixnum
695
+ # array.y = 5
696
+ #
697
+ # @param [Object] y
698
+ # The new y position.
699
+ #
700
+ # @return [Object] The new y coordinate if successful
701
+ #
702
+ # @version SketchUp 6.0
703
+ def y=(y)
704
+ end
705
+
706
+ # The {#z} method retrieves the z coordinate.
707
+ #
708
+ # @example
709
+ # array = [1, 2, 3]
710
+ # # This will return a Fixnum, in this case 3
711
+ # z = array.z
712
+ #
713
+ # array = [1.0, 2.0, 3.0]
714
+ # # This will return a Float, in this case 3.0
715
+ # z = array.z
716
+ #
717
+ # @return [Object, nil] The z coordinate if successful
718
+ #
719
+ # @version SketchUp 6.0
720
+ def z
721
+ end
722
+
723
+ # The {#z=} method sets the z coordinate.
724
+ #
725
+ # @example
726
+ # array = [1, 2, 3]
727
+ # # This will initialize the z value as a Float
728
+ # array.z = 2.5
729
+ # # This will initialize the z value as a Fixnum
730
+ # array.z = 5
731
+ #
732
+ # @param [Object] z
733
+ # The new z position.
734
+ #
735
+ # @return [Object] The new z coordinate if successful
736
+ #
737
+ # @version SketchUp 6.0
738
+ def z=(z)
739
+ end
740
+
741
+ end