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