sketchup-api-stubs 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +151 -148
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +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 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -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 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -698
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -516
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- 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/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -692
- 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/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -619
- 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 +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -426
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1205
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -272
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -407
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1651
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -477
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
- 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 +255 -260
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -837
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1317
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1377 -1360
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -496
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +683 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -7
@@ -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.
|
36
|
-
#
|
37
|
-
# This method is generally used to get a point at
|
38
|
-
# some percentage along a line connecting the two points.
|
39
|
-
#
|
40
|
-
# A linear combination is a standard term for vector math. It is defined as
|
41
|
-
# point = weight1 * point1 + weight2 * point2.
|
42
|
-
#
|
43
|
-
# @example
|
44
|
-
# point1 = Geom::Point3d.new(1,1,1)
|
45
|
-
# point2 = Geom::Point3d.new(10,10,10)
|
46
|
-
#
|
47
|
-
# # Get the point that is half the way from point1 to point2.
|
48
|
-
# points = Geom::Point3d.linear_combination(0.5, point1, 0.5, point2)
|
49
|
-
#
|
50
|
-
# # Get the point that is 3/4 the way from point1 to point2.
|
51
|
-
# point = Geom::Point3d.linear_combination(0.25, point1, 0.75, point2)
|
52
|
-
#
|
53
|
-
# # Get the point that is 70% the way from point1 to point2.
|
54
|
-
# percentage = 0.7
|
55
|
-
# point = Geom::Point3d.linear_combination(1.0 - percentage, point1, percentage, point2)
|
56
|
-
#
|
57
|
-
# @param [Float] weight1
|
58
|
-
#
|
59
|
-
# @param [Geom::Point3d] point1
|
60
|
-
#
|
61
|
-
# @param [Float] weight2
|
62
|
-
#
|
63
|
-
# @param [Geom::Point3d] point2
|
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]
|
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 [Geom::Point3d] 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 2023 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.
|
36
|
+
#
|
37
|
+
# This method is generally used to get a point at
|
38
|
+
# some percentage along a line connecting the two points.
|
39
|
+
#
|
40
|
+
# A linear combination is a standard term for vector math. It is defined as
|
41
|
+
# point = weight1 * point1 + weight2 * point2.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# point1 = Geom::Point3d.new(1,1,1)
|
45
|
+
# point2 = Geom::Point3d.new(10,10,10)
|
46
|
+
#
|
47
|
+
# # Get the point that is half the way from point1 to point2.
|
48
|
+
# points = Geom::Point3d.linear_combination(0.5, point1, 0.5, point2)
|
49
|
+
#
|
50
|
+
# # Get the point that is 3/4 the way from point1 to point2.
|
51
|
+
# point = Geom::Point3d.linear_combination(0.25, point1, 0.75, point2)
|
52
|
+
#
|
53
|
+
# # Get the point that is 70% the way from point1 to point2.
|
54
|
+
# percentage = 0.7
|
55
|
+
# point = Geom::Point3d.linear_combination(1.0 - percentage, point1, percentage, point2)
|
56
|
+
#
|
57
|
+
# @param [Float] weight1
|
58
|
+
#
|
59
|
+
# @param [Geom::Point3d] point1
|
60
|
+
#
|
61
|
+
# @param [Float] weight2
|
62
|
+
#
|
63
|
+
# @param [Geom::Point3d] point2
|
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]
|
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 [Geom::Point3d] 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
|