sketchup-api-stubs 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs.rb +1 -1
- data/lib/sketchup-api-stubs/sketchup.rb +147 -145
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -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 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +498 -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 -522
- 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 -573
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +179 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +515 -514
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -143
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
- 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 -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 +225 -220
- 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 -204
- 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 -694
- 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 +144 -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 +286 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -328
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -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 +294 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +577 -562
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +604 -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 -194
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +362 -329
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -312
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -38
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +396 -390
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +502 -508
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1126 -1119
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -544
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +126 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +751 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +699 -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 +417 -409
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -226
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -190
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +405 -393
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -82
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -303
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +327 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -244
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -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 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -416
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +318 -311
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -141
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -95
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1651 -1638
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +131 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -770
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +363 -353
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -456
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +459 -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 +59 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -225
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +835 -829
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -154
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +71 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1307 -1301
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -43
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +317 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +387 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +255 -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 -311
- data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/geom.rb +351 -348
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
- 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.rb +1342 -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 +668 -667
- metadata +4 -2
@@ -1,141 +1,141 @@
|
|
1
|
-
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The UTM class lets you work with UTM map coordinates.
|
5
|
-
#
|
6
|
-
# @note Valid ranges for {#zone_number} and {#zone_letter} are 1-60 and C-X
|
7
|
-
# (omitting I and O). Valid ranges for {#x} and {#y} are 100000-899999.
|
8
|
-
#
|
9
|
-
# @version SketchUp 6.0
|
10
|
-
class Geom::UTM
|
11
|
-
|
12
|
-
# Instance Methods
|
13
|
-
|
14
|
-
# The {#initialize} method is used to create a new UTM coordinate. You will
|
15
|
-
# often create UTM objects by calling the method {Sketchup::Model#point_to_utm}
|
16
|
-
# instead of calling this method.
|
17
|
-
#
|
18
|
-
# @example
|
19
|
-
# # Create a copy of an existing UTM object.
|
20
|
-
# utm = Geom::UTM.new(utm2)
|
21
|
-
#
|
22
|
-
# # Create a new UTM object from scratch.
|
23
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
24
|
-
#
|
25
|
-
# @overload initialize(zone_number, zone_letter, x, y)
|
26
|
-
#
|
27
|
-
# @param [Integer] zone_number A zone number or a UTM object.
|
28
|
-
# @param [String] zone_letter A zone letter.
|
29
|
-
# @param [Float] x The x position.
|
30
|
-
# @param [Float] y The y position.
|
31
|
-
#
|
32
|
-
# @overload initialize(utm)
|
33
|
-
#
|
34
|
-
# @param [Geom::UTM] utm A UTM object.
|
35
|
-
#
|
36
|
-
# @overload initialize(array)
|
37
|
-
#
|
38
|
-
# @param [Array(Integer, String, Float, Float)] An array containing the zone
|
39
|
-
# number, zone letter, x and y positions.
|
40
|
-
#
|
41
|
-
# @return [Geom::UTM]
|
42
|
-
#
|
43
|
-
# @version SketchUp 6.0
|
44
|
-
def initialize(*args)
|
45
|
-
end
|
46
|
-
|
47
|
-
# The {#to_a} method returns a UTM coordinate as a 4 element array. The Array
|
48
|
-
# elements are the zone number, the zone letter, the x coordinate and the y
|
49
|
-
# coordinate.
|
50
|
-
#
|
51
|
-
# @example
|
52
|
-
# # Create a new UTM object from scratch.
|
53
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
54
|
-
# a = utm.to_a
|
55
|
-
#
|
56
|
-
# @return [Array(Integer, String, Float, Float)]
|
57
|
-
#
|
58
|
-
# @version SketchUp 6.0
|
59
|
-
def to_a
|
60
|
-
end
|
61
|
-
|
62
|
-
# The {#to_latlong} method is used to convert UTM coordinates to latitude
|
63
|
-
# and longitude. See the LatLong class for more information.
|
64
|
-
#
|
65
|
-
# @example
|
66
|
-
# # Create a new UTM object from scratch.
|
67
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
68
|
-
# ll = utm.to_latlong
|
69
|
-
#
|
70
|
-
# @return [Geom::LatLong]
|
71
|
-
#
|
72
|
-
# @version SketchUp 6.0
|
73
|
-
def to_latlong
|
74
|
-
end
|
75
|
-
|
76
|
-
# The {#to_s} method is used to retrieve a string representation of a UTM.
|
77
|
-
#
|
78
|
-
# @example
|
79
|
-
# # Create a new UTM object from scratch.
|
80
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
81
|
-
# string = utm.to_s
|
82
|
-
#
|
83
|
-
# @return [String]
|
84
|
-
#
|
85
|
-
# @version SketchUp 6.0
|
86
|
-
def to_s
|
87
|
-
end
|
88
|
-
|
89
|
-
# The {#x} method returns the UTM x coordinate.
|
90
|
-
#
|
91
|
-
# @example
|
92
|
-
# # Create a new UTM object from scratch.
|
93
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
94
|
-
# x = utm.x
|
95
|
-
#
|
96
|
-
# @return [Float]
|
97
|
-
#
|
98
|
-
# @version SketchUp 6.0
|
99
|
-
def x
|
100
|
-
end
|
101
|
-
|
102
|
-
# The {#y} method returns the UTM y coordinate.
|
103
|
-
#
|
104
|
-
# @example
|
105
|
-
# # Create a new UTM object from scratch.
|
106
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
107
|
-
# y = utm.y
|
108
|
-
#
|
109
|
-
# @return [Float]
|
110
|
-
#
|
111
|
-
# @version SketchUp 6.0
|
112
|
-
def y
|
113
|
-
end
|
114
|
-
|
115
|
-
# The {#zone_letter} method returns the UTM zone letter.
|
116
|
-
#
|
117
|
-
# @example
|
118
|
-
# # Create a new UTM object from scratch.
|
119
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
120
|
-
# zl = utm.zone_letter
|
121
|
-
#
|
122
|
-
# @return [String]
|
123
|
-
#
|
124
|
-
# @version SketchUp 6.0
|
125
|
-
def zone_letter
|
126
|
-
end
|
127
|
-
|
128
|
-
# The {#zone_number} method returns the UTM zone number.
|
129
|
-
#
|
130
|
-
# @example
|
131
|
-
# # Create a new UTM object from scratch.
|
132
|
-
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
133
|
-
# zn = utm.zone_number
|
134
|
-
#
|
135
|
-
# @return [Integer]
|
136
|
-
#
|
137
|
-
# @version SketchUp 6.0
|
138
|
-
def zone_number
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The UTM class lets you work with UTM map coordinates.
|
5
|
+
#
|
6
|
+
# @note Valid ranges for {#zone_number} and {#zone_letter} are 1-60 and C-X
|
7
|
+
# (omitting I and O). Valid ranges for {#x} and {#y} are 100000-899999.
|
8
|
+
#
|
9
|
+
# @version SketchUp 6.0
|
10
|
+
class Geom::UTM
|
11
|
+
|
12
|
+
# Instance Methods
|
13
|
+
|
14
|
+
# The {#initialize} method is used to create a new UTM coordinate. You will
|
15
|
+
# often create UTM objects by calling the method {Sketchup::Model#point_to_utm}
|
16
|
+
# instead of calling this method.
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# # Create a copy of an existing UTM object.
|
20
|
+
# utm = Geom::UTM.new(utm2)
|
21
|
+
#
|
22
|
+
# # Create a new UTM object from scratch.
|
23
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
24
|
+
#
|
25
|
+
# @overload initialize(zone_number, zone_letter, x, y)
|
26
|
+
#
|
27
|
+
# @param [Integer] zone_number A zone number or a UTM object.
|
28
|
+
# @param [String] zone_letter A zone letter.
|
29
|
+
# @param [Float] x The x position.
|
30
|
+
# @param [Float] y The y position.
|
31
|
+
#
|
32
|
+
# @overload initialize(utm)
|
33
|
+
#
|
34
|
+
# @param [Geom::UTM] utm A UTM object.
|
35
|
+
#
|
36
|
+
# @overload initialize(array)
|
37
|
+
#
|
38
|
+
# @param [Array(Integer, String, Float, Float)] An array containing the zone
|
39
|
+
# number, zone letter, x and y positions.
|
40
|
+
#
|
41
|
+
# @return [Geom::UTM]
|
42
|
+
#
|
43
|
+
# @version SketchUp 6.0
|
44
|
+
def initialize(*args)
|
45
|
+
end
|
46
|
+
|
47
|
+
# The {#to_a} method returns a UTM coordinate as a 4 element array. The Array
|
48
|
+
# elements are the zone number, the zone letter, the x coordinate and the y
|
49
|
+
# coordinate.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# # Create a new UTM object from scratch.
|
53
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
54
|
+
# a = utm.to_a
|
55
|
+
#
|
56
|
+
# @return [Array(Integer, String, Float, Float)]
|
57
|
+
#
|
58
|
+
# @version SketchUp 6.0
|
59
|
+
def to_a
|
60
|
+
end
|
61
|
+
|
62
|
+
# The {#to_latlong} method is used to convert UTM coordinates to latitude
|
63
|
+
# and longitude. See the LatLong class for more information.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# # Create a new UTM object from scratch.
|
67
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
68
|
+
# ll = utm.to_latlong
|
69
|
+
#
|
70
|
+
# @return [Geom::LatLong]
|
71
|
+
#
|
72
|
+
# @version SketchUp 6.0
|
73
|
+
def to_latlong
|
74
|
+
end
|
75
|
+
|
76
|
+
# The {#to_s} method is used to retrieve a string representation of a UTM.
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# # Create a new UTM object from scratch.
|
80
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
81
|
+
# string = utm.to_s
|
82
|
+
#
|
83
|
+
# @return [String]
|
84
|
+
#
|
85
|
+
# @version SketchUp 6.0
|
86
|
+
def to_s
|
87
|
+
end
|
88
|
+
|
89
|
+
# The {#x} method returns the UTM x coordinate.
|
90
|
+
#
|
91
|
+
# @example
|
92
|
+
# # Create a new UTM object from scratch.
|
93
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
94
|
+
# x = utm.x
|
95
|
+
#
|
96
|
+
# @return [Float]
|
97
|
+
#
|
98
|
+
# @version SketchUp 6.0
|
99
|
+
def x
|
100
|
+
end
|
101
|
+
|
102
|
+
# The {#y} method returns the UTM y coordinate.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# # Create a new UTM object from scratch.
|
106
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
107
|
+
# y = utm.y
|
108
|
+
#
|
109
|
+
# @return [Float]
|
110
|
+
#
|
111
|
+
# @version SketchUp 6.0
|
112
|
+
def y
|
113
|
+
end
|
114
|
+
|
115
|
+
# The {#zone_letter} method returns the UTM zone letter.
|
116
|
+
#
|
117
|
+
# @example
|
118
|
+
# # Create a new UTM object from scratch.
|
119
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
120
|
+
# zl = utm.zone_letter
|
121
|
+
#
|
122
|
+
# @return [String]
|
123
|
+
#
|
124
|
+
# @version SketchUp 6.0
|
125
|
+
def zone_letter
|
126
|
+
end
|
127
|
+
|
128
|
+
# The {#zone_number} method returns the UTM zone number.
|
129
|
+
#
|
130
|
+
# @example
|
131
|
+
# # Create a new UTM object from scratch.
|
132
|
+
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
133
|
+
# zn = utm.zone_number
|
134
|
+
#
|
135
|
+
# @return [Integer]
|
136
|
+
#
|
137
|
+
# @version SketchUp 6.0
|
138
|
+
def zone_number
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
@@ -1,522 +1,522 @@
|
|
1
|
-
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The {Geom::Vector2d} class represents vectors in a 2 dimensional space.
|
5
|
-
#
|
6
|
-
# There are numerous tutorials on 2D vectors available on the internet.
|
7
|
-
#
|
8
|
-
# @version LayOut 2018
|
9
|
-
class Geom::Vector2d
|
10
|
-
|
11
|
-
# Instance Methods
|
12
|
-
|
13
|
-
# The {#%} method returns the dot product between two {Geom::Vector2d}. This is
|
14
|
-
# an alias of the dot method.
|
15
|
-
#
|
16
|
-
# @example
|
17
|
-
# vector = Geom::Vector2d.new(0, 2)
|
18
|
-
# vector2 = Geom::Vector2d.new(1, 0)
|
19
|
-
# d2 = vector % vector2
|
20
|
-
#
|
21
|
-
# @param [Geom::Vector2d] vector
|
22
|
-
#
|
23
|
-
# @return The dot product of the vectors
|
24
|
-
#
|
25
|
-
# @version LayOut 2018
|
26
|
-
def %(vector)
|
27
|
-
end
|
28
|
-
|
29
|
-
# The {#*} method returns the cross product between two {Geom::Vector2d}. This
|
30
|
-
# is an alias of the cross method.
|
31
|
-
#
|
32
|
-
# @example
|
33
|
-
# vector = Geom::Vector2d.new(1, 0)
|
34
|
-
# vector2 = Geom::Vector2d.new(0, 1)
|
35
|
-
# cross = vector * vector
|
36
|
-
#
|
37
|
-
# @param [Geom::Vector2d] vector
|
38
|
-
#
|
39
|
-
# @return [Geom::Vector2d]
|
40
|
-
#
|
41
|
-
# @version LayOut 2018
|
42
|
-
def *(vector)
|
43
|
-
end
|
44
|
-
|
45
|
-
# The {#+} method adds a {Geom::Vector2d} to this one.
|
46
|
-
#
|
47
|
-
# @example
|
48
|
-
# vector = Geom::Vector2d.new(0, 2)
|
49
|
-
# vector2 = Geom::Vector2d.new(1, 0)
|
50
|
-
# new_vector = vector + vector2
|
51
|
-
#
|
52
|
-
# @param [Geom::Vector2d] vector
|
53
|
-
#
|
54
|
-
# @return [Geom::Vector2d]
|
55
|
-
#
|
56
|
-
# @version LayOut 2018
|
57
|
-
def +(vector)
|
58
|
-
end
|
59
|
-
|
60
|
-
# The {#-} method subtracts a {Geom::Vector2d} from this one.
|
61
|
-
#
|
62
|
-
# @example
|
63
|
-
# vector = Geom::Vector2d.new(0, 2)
|
64
|
-
# vector2 = Geom::Vector2d.new(1, 0)
|
65
|
-
# new_vector = vector - vector2
|
66
|
-
#
|
67
|
-
# @param [Geom::Vector2d] vector
|
68
|
-
#
|
69
|
-
# @return [Geom::Vector2d]
|
70
|
-
#
|
71
|
-
# @version LayOut 2018
|
72
|
-
def -(vector)
|
73
|
-
end
|
74
|
-
|
75
|
-
# The {#==} method returns whether two {Geom::Vector2d} are equal within
|
76
|
-
# tolerance.
|
77
|
-
#
|
78
|
-
# @example
|
79
|
-
# vector = Geom::Vector2d.new(1, 0)
|
80
|
-
# vector2 = Geom::Vector2d.new(0,1)
|
81
|
-
# # Returns false
|
82
|
-
# status = vector == vector2
|
83
|
-
#
|
84
|
-
# @param [Geom::Vector2d] vector
|
85
|
-
#
|
86
|
-
# @return [Boolean]
|
87
|
-
#
|
88
|
-
# @version LayOut 2018
|
89
|
-
def ==(vector)
|
90
|
-
end
|
91
|
-
|
92
|
-
# The {#[]} method returns the value of the {Geom::Vector2d} at the specified
|
93
|
-
# index.
|
94
|
-
#
|
95
|
-
# @example
|
96
|
-
# vector = Geom::Vector2d.new(1, 2)
|
97
|
-
# # retrieves the y value of 2
|
98
|
-
# yvalue = vector[1]
|
99
|
-
#
|
100
|
-
# @param [Integer] index
|
101
|
-
# The index into an array of two coordinates.
|
102
|
-
#
|
103
|
-
# @return [Numeric] The value for the x or y coordinate.
|
104
|
-
#
|
105
|
-
# @version LayOut 2018
|
106
|
-
def [](index)
|
107
|
-
end
|
108
|
-
|
109
|
-
# The {#[]=} method sets the x or y value of the {Geom::Vector2d} based on the
|
110
|
-
# specific index of the value.
|
111
|
-
#
|
112
|
-
# @example
|
113
|
-
# point = Geom::Vector2d.new(1,2)
|
114
|
-
# point[1] = 4
|
115
|
-
#
|
116
|
-
# @param [Numeric] index
|
117
|
-
# The index for a specific x or y value in the
|
118
|
-
# {Geom::Vector2d} to set
|
119
|
-
#
|
120
|
-
# @param [Numeric] value
|
121
|
-
# The value to set for x or y
|
122
|
-
#
|
123
|
-
# @return [Numeric] The new x or y value if successful
|
124
|
-
#
|
125
|
-
# @version LayOut 2018
|
126
|
-
def []=(index, value)
|
127
|
-
end
|
128
|
-
|
129
|
-
# The {#angle_between} method computes the angle in radians between
|
130
|
-
# the {Geom::Vector2d} and another {Geom::Vector2d}.
|
131
|
-
#
|
132
|
-
# @example
|
133
|
-
# vector = Geom::Vector2d.new(1, 0)
|
134
|
-
# vector2 = Geom::Vector2d.new(-1, 0)
|
135
|
-
# # returns PI
|
136
|
-
# angle = vector.angle_between(vector2)
|
137
|
-
#
|
138
|
-
# @param [Geom::Vector2d] vector
|
139
|
-
#
|
140
|
-
# @return [Numeric] The angle (in radians)
|
141
|
-
#
|
142
|
-
# @version LayOut 2018
|
143
|
-
def angle_between(vector)
|
144
|
-
end
|
145
|
-
|
146
|
-
# The {#clone} method makes a copy of the {Geom::Vector2d}. This method is
|
147
|
-
# equivalent to vec2 = Geom::Vector2d.new(vec).
|
148
|
-
#
|
149
|
-
# @example
|
150
|
-
# vector = Geom::Vector2d.new(1, 0)
|
151
|
-
# vector2 = vector.clone
|
152
|
-
#
|
153
|
-
# @return [Geom::Vector2d]
|
154
|
-
#
|
155
|
-
# @version LayOut 2018
|
156
|
-
def clone
|
157
|
-
end
|
158
|
-
|
159
|
-
# The {#*} method returns the cross product between two {Geom::Vector2d}. This
|
160
|
-
# is an alias of the cross method.
|
161
|
-
#
|
162
|
-
# @example
|
163
|
-
# vector = Geom::Vector2d.new(1, 0)
|
164
|
-
# vector2 = Geom::Vector2d.new(0, 1)
|
165
|
-
# cross = vector * vector
|
166
|
-
#
|
167
|
-
# @param [Geom::Vector2d] vector
|
168
|
-
#
|
169
|
-
# @return [Geom::Vector2d]
|
170
|
-
#
|
171
|
-
# @version LayOut 2018
|
172
|
-
def cross(vector)
|
173
|
-
end
|
174
|
-
|
175
|
-
# The {#%} method returns the dot product between two {Geom::Vector2d}. This is
|
176
|
-
# an alias of the dot method.
|
177
|
-
#
|
178
|
-
# @example
|
179
|
-
# vector = Geom::Vector2d.new(0, 2)
|
180
|
-
# vector2 = Geom::Vector2d.new(1, 0)
|
181
|
-
# d2 = vector % vector2
|
182
|
-
#
|
183
|
-
# @param [Geom::Vector2d] vector
|
184
|
-
#
|
185
|
-
# @return The dot product of the vectors
|
186
|
-
#
|
187
|
-
# @version LayOut 2018
|
188
|
-
def dot(vector)
|
189
|
-
end
|
190
|
-
|
191
|
-
# The {.new} method creates a new {Geom::Vector2d}.
|
192
|
-
#
|
193
|
-
# @example
|
194
|
-
# # A vector that runs along the X axis.
|
195
|
-
# vector = Geom::Vector2d.new(1, 0)
|
196
|
-
#
|
197
|
-
# @overload initialize
|
198
|
-
#
|
199
|
-
# @return [Geom::Vector2d]
|
200
|
-
#
|
201
|
-
# @overload initialize(x, y)
|
202
|
-
#
|
203
|
-
# @param [Numeric] x The length in the x direction
|
204
|
-
# @param [Numeric] y The length in the y direction
|
205
|
-
# @return [Geom::Vector2d]
|
206
|
-
#
|
207
|
-
# @overload initialize(vector)
|
208
|
-
#
|
209
|
-
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
210
|
-
# @return [Geom::Vector2d]
|
211
|
-
#
|
212
|
-
# @version LayOut 2018
|
213
|
-
def initialize(*args)
|
214
|
-
end
|
215
|
-
|
216
|
-
# The {#inspect} method formats the {Geom::Vector2d} as a string.
|
217
|
-
#
|
218
|
-
# @example
|
219
|
-
# point = Geom::Point2d.new(1, 2)
|
220
|
-
# string = point.inspect
|
221
|
-
#
|
222
|
-
# @return [String] the string representation of the {Geom::Vector2d}
|
223
|
-
#
|
224
|
-
# @version LayOut 2018
|
225
|
-
def inspect
|
226
|
-
end
|
227
|
-
|
228
|
-
# The {#length} method returns the length of the {Geom::Vector2d}.
|
229
|
-
#
|
230
|
-
# @example
|
231
|
-
# vector = Geom::Vector2d.new(0, 4)
|
232
|
-
# # returns 4
|
233
|
-
# l = vector.length
|
234
|
-
#
|
235
|
-
# @return [Length] The length of the {Geom::Vector2d}
|
236
|
-
#
|
237
|
-
# @version LayOut 2018
|
238
|
-
def length
|
239
|
-
end
|
240
|
-
|
241
|
-
# The {#length=} method sets the length of the {Geom::Vector2d}. The new length
|
242
|
-
# must not be 0.
|
243
|
-
#
|
244
|
-
# @example
|
245
|
-
# vector = Geom::Vector2d.new(0, 4)
|
246
|
-
# l = vector.length
|
247
|
-
# vector.length = 2
|
248
|
-
#
|
249
|
-
# @param [Numeric] length
|
250
|
-
# The new length for the {Geom::Vector2d}
|
251
|
-
#
|
252
|
-
# @return [Numeric] The new length
|
253
|
-
#
|
254
|
-
# @version LayOut 2018
|
255
|
-
def length=(length)
|
256
|
-
end
|
257
|
-
|
258
|
-
# The {#normalize} method returns a {Geom::Vector2d} that is a unit vector
|
259
|
-
# of the {Geom::Vector2d}.
|
260
|
-
#
|
261
|
-
# @example
|
262
|
-
# vector = Geom::Vector2d.new(0, 4)
|
263
|
-
# # returns a new Vector2d(0, 1)
|
264
|
-
# vector2 = vector.normalize
|
265
|
-
#
|
266
|
-
# @return [Geom::Vector2d]
|
267
|
-
#
|
268
|
-
# @version LayOut 2018
|
269
|
-
def normalize
|
270
|
-
end
|
271
|
-
|
272
|
-
# The {#normalize!} method converts a {Geom::Vector2d} vector into a unit
|
273
|
-
# vector. Another way to do this is vector.length = 1
|
274
|
-
#
|
275
|
-
# @example
|
276
|
-
# vector = Geom::Vector2d.new(0, 4)
|
277
|
-
# # modifies vector to be the Vector2d(0, 1)
|
278
|
-
# vector.normalize!
|
279
|
-
#
|
280
|
-
# @version LayOut 2018
|
281
|
-
def normalize!
|
282
|
-
end
|
283
|
-
|
284
|
-
# The {#parallel?} method determines if the {Geom::Vector2d} is parallel to
|
285
|
-
# another {Geom::Vector2d} to within tolerance.
|
286
|
-
#
|
287
|
-
# @example
|
288
|
-
# vector = Geom::Vector2d.new(0, 1)
|
289
|
-
# vector2 = Geom::Vector2d.new(1, 2)
|
290
|
-
# # returns true
|
291
|
-
# status = vector.parallel?(vector2)
|
292
|
-
#
|
293
|
-
# @param [Geom::Vector2d] vector
|
294
|
-
#
|
295
|
-
# @return [Boolean]
|
296
|
-
#
|
297
|
-
# @version LayOut 2018
|
298
|
-
def parallel?(vector)
|
299
|
-
end
|
300
|
-
|
301
|
-
# The {#perpendicular?} method determines if the {Geom::Vector2d} is
|
302
|
-
# perpendicular to another {Geom::Vector2d} to within tolerance.
|
303
|
-
#
|
304
|
-
# @example
|
305
|
-
# vector = Geom::Vector2d.new(0, 1)
|
306
|
-
# vector2 = Geom::Vector2d.new(1, 2)
|
307
|
-
# # returns false
|
308
|
-
# status = vector.perpendicular?(vector2)
|
309
|
-
#
|
310
|
-
# @param [Geom::Vector2d] vector
|
311
|
-
#
|
312
|
-
# @return [Boolean]
|
313
|
-
#
|
314
|
-
# @version LayOut 2018
|
315
|
-
def perpendicular?(vector)
|
316
|
-
end
|
317
|
-
|
318
|
-
# The {#reverse} method returns a new {Geom::Vector2d} that is the reverse of
|
319
|
-
# the {Geom::Vector2d}, leaving the original unchanged.
|
320
|
-
#
|
321
|
-
# @example
|
322
|
-
# vector = Geom::Vector2d.new(1, 2)
|
323
|
-
# # returns the Vector2d(-1, -2)
|
324
|
-
# vector2 = vector.reverse
|
325
|
-
#
|
326
|
-
# @return [Geom::Vector2d]
|
327
|
-
#
|
328
|
-
# @version LayOut 2018
|
329
|
-
def reverse
|
330
|
-
end
|
331
|
-
|
332
|
-
# The {#reverse!} method reverses the {Geom::Vector2d} in place.
|
333
|
-
#
|
334
|
-
# @example
|
335
|
-
# vector = Geom::Vector2d.new(1, 2)
|
336
|
-
# # modifies vector to be the Vector2d(-1, -2)
|
337
|
-
# vector.reverse!
|
338
|
-
#
|
339
|
-
# @version LayOut 2018
|
340
|
-
def reverse!
|
341
|
-
end
|
342
|
-
|
343
|
-
# The {#same_direction?} method determines if the {Geom::Vector2d} is parallel
|
344
|
-
# to and in the same direction as another {Geom::Vector2d} within tolerance.
|
345
|
-
#
|
346
|
-
# @example
|
347
|
-
# vector = Geom::Vector2d.new(0, 1)
|
348
|
-
# vector2 = Geom::Vector2d.new(1, 2)
|
349
|
-
# # returns true
|
350
|
-
# status = vector.sime_direction?(vector2)
|
351
|
-
#
|
352
|
-
# @param [Geom::Vector2d] vector
|
353
|
-
#
|
354
|
-
# @return [Boolean]
|
355
|
-
#
|
356
|
-
# @version LayOut 2018
|
357
|
-
def same_direction?(vector)
|
358
|
-
end
|
359
|
-
|
360
|
-
# The {#set!} method sets the values of the {Geom::Vector2d}.
|
361
|
-
#
|
362
|
-
# @example
|
363
|
-
# vector = Geom::Vector2d.new(1, 2)
|
364
|
-
# vector = vector.set!([4, 5])
|
365
|
-
#
|
366
|
-
# @overload set!(vector)
|
367
|
-
#
|
368
|
-
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
369
|
-
# @return [Geom::Vector2d]
|
370
|
-
#
|
371
|
-
# @overload set!(x, y)
|
372
|
-
#
|
373
|
-
# @param [Numeric] x
|
374
|
-
# @param [Numeric] y
|
375
|
-
# @return [Geom::Vector2d]
|
376
|
-
#
|
377
|
-
# @version LayOut 2018
|
378
|
-
def set!(*args)
|
379
|
-
end
|
380
|
-
|
381
|
-
# The {#to_a} method retrieves the coordinates of the {Geom::Vector2d} in an
|
382
|
-
# Array.
|
383
|
-
#
|
384
|
-
# @example
|
385
|
-
# a = vector.to_a
|
386
|
-
#
|
387
|
-
# @return [Array(Numeric, Numeric)]
|
388
|
-
#
|
389
|
-
# @version LayOut 2018
|
390
|
-
def to_a
|
391
|
-
end
|
392
|
-
|
393
|
-
# The {#to_s} method returns a string representation of the {Geom::Vector2d}.
|
394
|
-
#
|
395
|
-
# @example
|
396
|
-
# point = Geom::Vector2d.new(1, 2)
|
397
|
-
# str = point.to_s
|
398
|
-
#
|
399
|
-
# @return [String] the string representation of the {Geom::Vector2d}
|
400
|
-
#
|
401
|
-
# @version LayOut 2018
|
402
|
-
def to_s
|
403
|
-
end
|
404
|
-
|
405
|
-
# The {#transform} method applies a transformation to a vector, returning a new
|
406
|
-
# vector. The original vector is unchanged by this method.
|
407
|
-
#
|
408
|
-
# @example
|
409
|
-
# vector = Geom::Vector2d.new(4, 5)
|
410
|
-
# transformation = Geom::Transformation2d.new([1, 0, 0, 1, 2, 3])
|
411
|
-
# # vector2 will be (6, 8)
|
412
|
-
# vector2 = vector.transform(transformation)
|
413
|
-
#
|
414
|
-
# @param [Geom::Transformation2d] transform
|
415
|
-
# A transformation object to apply to the vector.
|
416
|
-
#
|
417
|
-
# @return [Geom::Vector2d] the newly transformed vector
|
418
|
-
#
|
419
|
-
# @version LayOut 2019
|
420
|
-
def transform(transform)
|
421
|
-
end
|
422
|
-
|
423
|
-
# The {#transform!} method applies a transformation to a vector. The vector
|
424
|
-
# itself is modified.
|
425
|
-
#
|
426
|
-
# @example
|
427
|
-
# vector = Geom::Vector2d.new(4, 5)
|
428
|
-
# transformation = Geom::Transformation2d.new([1, 0, 0, 1, 2, 3])
|
429
|
-
# # vector will be (6, 8)
|
430
|
-
# vector.transform!(transformation)
|
431
|
-
#
|
432
|
-
# @param [Geom::Transformation2d] transform
|
433
|
-
# A Transformation object to apply to the vector.
|
434
|
-
#
|
435
|
-
# @return [Geom::Vector2d] the transformed vector
|
436
|
-
#
|
437
|
-
# @version LayOut 2019
|
438
|
-
def transform!(transform)
|
439
|
-
end
|
440
|
-
|
441
|
-
# The {#unit_vector?} method returns whether the {Geom::Vector2d} is a unit
|
442
|
-
# vector. This is equivalent to vector.length == 1.0
|
443
|
-
#
|
444
|
-
# @example
|
445
|
-
# vector = Geom::Vector2d.new(1, 0)
|
446
|
-
# # returns true
|
447
|
-
# status = vector.unit_vector
|
448
|
-
#
|
449
|
-
# @return [Boolean]
|
450
|
-
#
|
451
|
-
# @version LayOut 2018
|
452
|
-
def unit_vector?
|
453
|
-
end
|
454
|
-
|
455
|
-
# The {#valid?} method verifies if a {Geom::Vector2d} is valid. A
|
456
|
-
# {Geom::Vector2d} is valid if its length is not zero.
|
457
|
-
#
|
458
|
-
# @example
|
459
|
-
# vector = Geom::Vector2d.new(0, 4)
|
460
|
-
# status = vector.valid
|
461
|
-
#
|
462
|
-
# @return [Boolean]
|
463
|
-
#
|
464
|
-
# @version LayOut 2018
|
465
|
-
def valid?
|
466
|
-
end
|
467
|
-
|
468
|
-
# The {#x} method retrieves the x value of the {Geom::Vector2d}.
|
469
|
-
#
|
470
|
-
# @example
|
471
|
-
# vector = Geom::Vector2d.new(1, 2)
|
472
|
-
# x = vector.x
|
473
|
-
#
|
474
|
-
# @return [Numeric]
|
475
|
-
#
|
476
|
-
# @version LayOut 2018
|
477
|
-
def x
|
478
|
-
end
|
479
|
-
|
480
|
-
# The {#x=} method sets the x coordinate of the {Geom::Vector2d}.
|
481
|
-
#
|
482
|
-
# @example
|
483
|
-
# vector = Geom::Vector2d.new(1, 2)
|
484
|
-
# vector.x = 7
|
485
|
-
#
|
486
|
-
# @param [Numeric] x
|
487
|
-
# The desired x value of the {Geom::Vector2d}
|
488
|
-
#
|
489
|
-
# @return [Numeric] The new x value of the {Geom::Vector2d}
|
490
|
-
#
|
491
|
-
# @version LayOut 2018
|
492
|
-
def x=(x)
|
493
|
-
end
|
494
|
-
|
495
|
-
# The {#y} method retrieves the y value of the {Geom::Vector2d}.
|
496
|
-
#
|
497
|
-
# @example
|
498
|
-
# vector = Geom::Vector2d.new(1, 2)
|
499
|
-
# y = vector.y
|
500
|
-
#
|
501
|
-
# @return [Numeric]
|
502
|
-
#
|
503
|
-
# @version LayOut 2018
|
504
|
-
def y
|
505
|
-
end
|
506
|
-
|
507
|
-
# The {#y=} method sets the y coordinate of the {Geom::Vector2d}.
|
508
|
-
#
|
509
|
-
# @example
|
510
|
-
# vector = Geom::Vector2d.new(1, 2)
|
511
|
-
# vector.y = 7
|
512
|
-
#
|
513
|
-
# @param [Numeric] y
|
514
|
-
# The desired y value of the {Geom::Vector2d}
|
515
|
-
#
|
516
|
-
# @return [Numeric] The new y value of the {Geom::Vector2d}
|
517
|
-
#
|
518
|
-
# @version LayOut 2018
|
519
|
-
def y=(y)
|
520
|
-
end
|
521
|
-
|
522
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The {Geom::Vector2d} class represents vectors in a 2 dimensional space.
|
5
|
+
#
|
6
|
+
# There are numerous tutorials on 2D vectors available on the internet.
|
7
|
+
#
|
8
|
+
# @version LayOut 2018
|
9
|
+
class Geom::Vector2d
|
10
|
+
|
11
|
+
# Instance Methods
|
12
|
+
|
13
|
+
# The {#%} method returns the dot product between two {Geom::Vector2d}. This is
|
14
|
+
# an alias of the dot method.
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# vector = Geom::Vector2d.new(0, 2)
|
18
|
+
# vector2 = Geom::Vector2d.new(1, 0)
|
19
|
+
# d2 = vector % vector2
|
20
|
+
#
|
21
|
+
# @param [Geom::Vector2d] vector
|
22
|
+
#
|
23
|
+
# @return The dot product of the vectors
|
24
|
+
#
|
25
|
+
# @version LayOut 2018
|
26
|
+
def %(vector)
|
27
|
+
end
|
28
|
+
|
29
|
+
# The {#*} method returns the cross product between two {Geom::Vector2d}. This
|
30
|
+
# is an alias of the cross method.
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# vector = Geom::Vector2d.new(1, 0)
|
34
|
+
# vector2 = Geom::Vector2d.new(0, 1)
|
35
|
+
# cross = vector * vector
|
36
|
+
#
|
37
|
+
# @param [Geom::Vector2d] vector
|
38
|
+
#
|
39
|
+
# @return [Geom::Vector2d]
|
40
|
+
#
|
41
|
+
# @version LayOut 2018
|
42
|
+
def *(vector)
|
43
|
+
end
|
44
|
+
|
45
|
+
# The {#+} method adds a {Geom::Vector2d} to this one.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# vector = Geom::Vector2d.new(0, 2)
|
49
|
+
# vector2 = Geom::Vector2d.new(1, 0)
|
50
|
+
# new_vector = vector + vector2
|
51
|
+
#
|
52
|
+
# @param [Geom::Vector2d] vector
|
53
|
+
#
|
54
|
+
# @return [Geom::Vector2d]
|
55
|
+
#
|
56
|
+
# @version LayOut 2018
|
57
|
+
def +(vector)
|
58
|
+
end
|
59
|
+
|
60
|
+
# The {#-} method subtracts a {Geom::Vector2d} from this one.
|
61
|
+
#
|
62
|
+
# @example
|
63
|
+
# vector = Geom::Vector2d.new(0, 2)
|
64
|
+
# vector2 = Geom::Vector2d.new(1, 0)
|
65
|
+
# new_vector = vector - vector2
|
66
|
+
#
|
67
|
+
# @param [Geom::Vector2d] vector
|
68
|
+
#
|
69
|
+
# @return [Geom::Vector2d]
|
70
|
+
#
|
71
|
+
# @version LayOut 2018
|
72
|
+
def -(vector)
|
73
|
+
end
|
74
|
+
|
75
|
+
# The {#==} method returns whether two {Geom::Vector2d} are equal within
|
76
|
+
# tolerance.
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# vector = Geom::Vector2d.new(1, 0)
|
80
|
+
# vector2 = Geom::Vector2d.new(0,1)
|
81
|
+
# # Returns false
|
82
|
+
# status = vector == vector2
|
83
|
+
#
|
84
|
+
# @param [Geom::Vector2d] vector
|
85
|
+
#
|
86
|
+
# @return [Boolean]
|
87
|
+
#
|
88
|
+
# @version LayOut 2018
|
89
|
+
def ==(vector)
|
90
|
+
end
|
91
|
+
|
92
|
+
# The {#[]} method returns the value of the {Geom::Vector2d} at the specified
|
93
|
+
# index.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# vector = Geom::Vector2d.new(1, 2)
|
97
|
+
# # retrieves the y value of 2
|
98
|
+
# yvalue = vector[1]
|
99
|
+
#
|
100
|
+
# @param [Integer] index
|
101
|
+
# The index into an array of two coordinates.
|
102
|
+
#
|
103
|
+
# @return [Numeric] The value for the x or y coordinate.
|
104
|
+
#
|
105
|
+
# @version LayOut 2018
|
106
|
+
def [](index)
|
107
|
+
end
|
108
|
+
|
109
|
+
# The {#[]=} method sets the x or y value of the {Geom::Vector2d} based on the
|
110
|
+
# specific index of the value.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# point = Geom::Vector2d.new(1,2)
|
114
|
+
# point[1] = 4
|
115
|
+
#
|
116
|
+
# @param [Numeric] index
|
117
|
+
# The index for a specific x or y value in the
|
118
|
+
# {Geom::Vector2d} to set
|
119
|
+
#
|
120
|
+
# @param [Numeric] value
|
121
|
+
# The value to set for x or y
|
122
|
+
#
|
123
|
+
# @return [Numeric] The new x or y value if successful
|
124
|
+
#
|
125
|
+
# @version LayOut 2018
|
126
|
+
def []=(index, value)
|
127
|
+
end
|
128
|
+
|
129
|
+
# The {#angle_between} method computes the angle in radians between
|
130
|
+
# the {Geom::Vector2d} and another {Geom::Vector2d}.
|
131
|
+
#
|
132
|
+
# @example
|
133
|
+
# vector = Geom::Vector2d.new(1, 0)
|
134
|
+
# vector2 = Geom::Vector2d.new(-1, 0)
|
135
|
+
# # returns PI
|
136
|
+
# angle = vector.angle_between(vector2)
|
137
|
+
#
|
138
|
+
# @param [Geom::Vector2d] vector
|
139
|
+
#
|
140
|
+
# @return [Numeric] The angle (in radians)
|
141
|
+
#
|
142
|
+
# @version LayOut 2018
|
143
|
+
def angle_between(vector)
|
144
|
+
end
|
145
|
+
|
146
|
+
# The {#clone} method makes a copy of the {Geom::Vector2d}. This method is
|
147
|
+
# equivalent to vec2 = Geom::Vector2d.new(vec).
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# vector = Geom::Vector2d.new(1, 0)
|
151
|
+
# vector2 = vector.clone
|
152
|
+
#
|
153
|
+
# @return [Geom::Vector2d]
|
154
|
+
#
|
155
|
+
# @version LayOut 2018
|
156
|
+
def clone
|
157
|
+
end
|
158
|
+
|
159
|
+
# The {#*} method returns the cross product between two {Geom::Vector2d}. This
|
160
|
+
# is an alias of the cross method.
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# vector = Geom::Vector2d.new(1, 0)
|
164
|
+
# vector2 = Geom::Vector2d.new(0, 1)
|
165
|
+
# cross = vector * vector
|
166
|
+
#
|
167
|
+
# @param [Geom::Vector2d] vector
|
168
|
+
#
|
169
|
+
# @return [Geom::Vector2d]
|
170
|
+
#
|
171
|
+
# @version LayOut 2018
|
172
|
+
def cross(vector)
|
173
|
+
end
|
174
|
+
|
175
|
+
# The {#%} method returns the dot product between two {Geom::Vector2d}. This is
|
176
|
+
# an alias of the dot method.
|
177
|
+
#
|
178
|
+
# @example
|
179
|
+
# vector = Geom::Vector2d.new(0, 2)
|
180
|
+
# vector2 = Geom::Vector2d.new(1, 0)
|
181
|
+
# d2 = vector % vector2
|
182
|
+
#
|
183
|
+
# @param [Geom::Vector2d] vector
|
184
|
+
#
|
185
|
+
# @return The dot product of the vectors
|
186
|
+
#
|
187
|
+
# @version LayOut 2018
|
188
|
+
def dot(vector)
|
189
|
+
end
|
190
|
+
|
191
|
+
# The {.new} method creates a new {Geom::Vector2d}.
|
192
|
+
#
|
193
|
+
# @example
|
194
|
+
# # A vector that runs along the X axis.
|
195
|
+
# vector = Geom::Vector2d.new(1, 0)
|
196
|
+
#
|
197
|
+
# @overload initialize
|
198
|
+
#
|
199
|
+
# @return [Geom::Vector2d]
|
200
|
+
#
|
201
|
+
# @overload initialize(x, y)
|
202
|
+
#
|
203
|
+
# @param [Numeric] x The length in the x direction
|
204
|
+
# @param [Numeric] y The length in the y direction
|
205
|
+
# @return [Geom::Vector2d]
|
206
|
+
#
|
207
|
+
# @overload initialize(vector)
|
208
|
+
#
|
209
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
210
|
+
# @return [Geom::Vector2d]
|
211
|
+
#
|
212
|
+
# @version LayOut 2018
|
213
|
+
def initialize(*args)
|
214
|
+
end
|
215
|
+
|
216
|
+
# The {#inspect} method formats the {Geom::Vector2d} as a string.
|
217
|
+
#
|
218
|
+
# @example
|
219
|
+
# point = Geom::Point2d.new(1, 2)
|
220
|
+
# string = point.inspect
|
221
|
+
#
|
222
|
+
# @return [String] the string representation of the {Geom::Vector2d}
|
223
|
+
#
|
224
|
+
# @version LayOut 2018
|
225
|
+
def inspect
|
226
|
+
end
|
227
|
+
|
228
|
+
# The {#length} method returns the length of the {Geom::Vector2d}.
|
229
|
+
#
|
230
|
+
# @example
|
231
|
+
# vector = Geom::Vector2d.new(0, 4)
|
232
|
+
# # returns 4
|
233
|
+
# l = vector.length
|
234
|
+
#
|
235
|
+
# @return [Length] The length of the {Geom::Vector2d}
|
236
|
+
#
|
237
|
+
# @version LayOut 2018
|
238
|
+
def length
|
239
|
+
end
|
240
|
+
|
241
|
+
# The {#length=} method sets the length of the {Geom::Vector2d}. The new length
|
242
|
+
# must not be 0.
|
243
|
+
#
|
244
|
+
# @example
|
245
|
+
# vector = Geom::Vector2d.new(0, 4)
|
246
|
+
# l = vector.length
|
247
|
+
# vector.length = 2
|
248
|
+
#
|
249
|
+
# @param [Numeric] length
|
250
|
+
# The new length for the {Geom::Vector2d}
|
251
|
+
#
|
252
|
+
# @return [Numeric] The new length
|
253
|
+
#
|
254
|
+
# @version LayOut 2018
|
255
|
+
def length=(length)
|
256
|
+
end
|
257
|
+
|
258
|
+
# The {#normalize} method returns a {Geom::Vector2d} that is a unit vector
|
259
|
+
# of the {Geom::Vector2d}.
|
260
|
+
#
|
261
|
+
# @example
|
262
|
+
# vector = Geom::Vector2d.new(0, 4)
|
263
|
+
# # returns a new Vector2d(0, 1)
|
264
|
+
# vector2 = vector.normalize
|
265
|
+
#
|
266
|
+
# @return [Geom::Vector2d]
|
267
|
+
#
|
268
|
+
# @version LayOut 2018
|
269
|
+
def normalize
|
270
|
+
end
|
271
|
+
|
272
|
+
# The {#normalize!} method converts a {Geom::Vector2d} vector into a unit
|
273
|
+
# vector. Another way to do this is vector.length = 1
|
274
|
+
#
|
275
|
+
# @example
|
276
|
+
# vector = Geom::Vector2d.new(0, 4)
|
277
|
+
# # modifies vector to be the Vector2d(0, 1)
|
278
|
+
# vector.normalize!
|
279
|
+
#
|
280
|
+
# @version LayOut 2018
|
281
|
+
def normalize!
|
282
|
+
end
|
283
|
+
|
284
|
+
# The {#parallel?} method determines if the {Geom::Vector2d} is parallel to
|
285
|
+
# another {Geom::Vector2d} to within tolerance.
|
286
|
+
#
|
287
|
+
# @example
|
288
|
+
# vector = Geom::Vector2d.new(0, 1)
|
289
|
+
# vector2 = Geom::Vector2d.new(1, 2)
|
290
|
+
# # returns true
|
291
|
+
# status = vector.parallel?(vector2)
|
292
|
+
#
|
293
|
+
# @param [Geom::Vector2d] vector
|
294
|
+
#
|
295
|
+
# @return [Boolean]
|
296
|
+
#
|
297
|
+
# @version LayOut 2018
|
298
|
+
def parallel?(vector)
|
299
|
+
end
|
300
|
+
|
301
|
+
# The {#perpendicular?} method determines if the {Geom::Vector2d} is
|
302
|
+
# perpendicular to another {Geom::Vector2d} to within tolerance.
|
303
|
+
#
|
304
|
+
# @example
|
305
|
+
# vector = Geom::Vector2d.new(0, 1)
|
306
|
+
# vector2 = Geom::Vector2d.new(1, 2)
|
307
|
+
# # returns false
|
308
|
+
# status = vector.perpendicular?(vector2)
|
309
|
+
#
|
310
|
+
# @param [Geom::Vector2d] vector
|
311
|
+
#
|
312
|
+
# @return [Boolean]
|
313
|
+
#
|
314
|
+
# @version LayOut 2018
|
315
|
+
def perpendicular?(vector)
|
316
|
+
end
|
317
|
+
|
318
|
+
# The {#reverse} method returns a new {Geom::Vector2d} that is the reverse of
|
319
|
+
# the {Geom::Vector2d}, leaving the original unchanged.
|
320
|
+
#
|
321
|
+
# @example
|
322
|
+
# vector = Geom::Vector2d.new(1, 2)
|
323
|
+
# # returns the Vector2d(-1, -2)
|
324
|
+
# vector2 = vector.reverse
|
325
|
+
#
|
326
|
+
# @return [Geom::Vector2d]
|
327
|
+
#
|
328
|
+
# @version LayOut 2018
|
329
|
+
def reverse
|
330
|
+
end
|
331
|
+
|
332
|
+
# The {#reverse!} method reverses the {Geom::Vector2d} in place.
|
333
|
+
#
|
334
|
+
# @example
|
335
|
+
# vector = Geom::Vector2d.new(1, 2)
|
336
|
+
# # modifies vector to be the Vector2d(-1, -2)
|
337
|
+
# vector.reverse!
|
338
|
+
#
|
339
|
+
# @version LayOut 2018
|
340
|
+
def reverse!
|
341
|
+
end
|
342
|
+
|
343
|
+
# The {#same_direction?} method determines if the {Geom::Vector2d} is parallel
|
344
|
+
# to and in the same direction as another {Geom::Vector2d} within tolerance.
|
345
|
+
#
|
346
|
+
# @example
|
347
|
+
# vector = Geom::Vector2d.new(0, 1)
|
348
|
+
# vector2 = Geom::Vector2d.new(1, 2)
|
349
|
+
# # returns true
|
350
|
+
# status = vector.sime_direction?(vector2)
|
351
|
+
#
|
352
|
+
# @param [Geom::Vector2d] vector
|
353
|
+
#
|
354
|
+
# @return [Boolean]
|
355
|
+
#
|
356
|
+
# @version LayOut 2018
|
357
|
+
def same_direction?(vector)
|
358
|
+
end
|
359
|
+
|
360
|
+
# The {#set!} method sets the values of the {Geom::Vector2d}.
|
361
|
+
#
|
362
|
+
# @example
|
363
|
+
# vector = Geom::Vector2d.new(1, 2)
|
364
|
+
# vector = vector.set!([4, 5])
|
365
|
+
#
|
366
|
+
# @overload set!(vector)
|
367
|
+
#
|
368
|
+
# @param [Geom::Vector2d, Array(Numeric, Numeric)] vector
|
369
|
+
# @return [Geom::Vector2d]
|
370
|
+
#
|
371
|
+
# @overload set!(x, y)
|
372
|
+
#
|
373
|
+
# @param [Numeric] x
|
374
|
+
# @param [Numeric] y
|
375
|
+
# @return [Geom::Vector2d]
|
376
|
+
#
|
377
|
+
# @version LayOut 2018
|
378
|
+
def set!(*args)
|
379
|
+
end
|
380
|
+
|
381
|
+
# The {#to_a} method retrieves the coordinates of the {Geom::Vector2d} in an
|
382
|
+
# Array.
|
383
|
+
#
|
384
|
+
# @example
|
385
|
+
# a = vector.to_a
|
386
|
+
#
|
387
|
+
# @return [Array(Numeric, Numeric)]
|
388
|
+
#
|
389
|
+
# @version LayOut 2018
|
390
|
+
def to_a
|
391
|
+
end
|
392
|
+
|
393
|
+
# The {#to_s} method returns a string representation of the {Geom::Vector2d}.
|
394
|
+
#
|
395
|
+
# @example
|
396
|
+
# point = Geom::Vector2d.new(1, 2)
|
397
|
+
# str = point.to_s
|
398
|
+
#
|
399
|
+
# @return [String] the string representation of the {Geom::Vector2d}
|
400
|
+
#
|
401
|
+
# @version LayOut 2018
|
402
|
+
def to_s
|
403
|
+
end
|
404
|
+
|
405
|
+
# The {#transform} method applies a transformation to a vector, returning a new
|
406
|
+
# vector. The original vector is unchanged by this method.
|
407
|
+
#
|
408
|
+
# @example
|
409
|
+
# vector = Geom::Vector2d.new(4, 5)
|
410
|
+
# transformation = Geom::Transformation2d.new([1, 0, 0, 1, 2, 3])
|
411
|
+
# # vector2 will be (6, 8)
|
412
|
+
# vector2 = vector.transform(transformation)
|
413
|
+
#
|
414
|
+
# @param [Geom::Transformation2d] transform
|
415
|
+
# A transformation object to apply to the vector.
|
416
|
+
#
|
417
|
+
# @return [Geom::Vector2d] the newly transformed vector
|
418
|
+
#
|
419
|
+
# @version LayOut 2019
|
420
|
+
def transform(transform)
|
421
|
+
end
|
422
|
+
|
423
|
+
# The {#transform!} method applies a transformation to a vector. The vector
|
424
|
+
# itself is modified.
|
425
|
+
#
|
426
|
+
# @example
|
427
|
+
# vector = Geom::Vector2d.new(4, 5)
|
428
|
+
# transformation = Geom::Transformation2d.new([1, 0, 0, 1, 2, 3])
|
429
|
+
# # vector will be (6, 8)
|
430
|
+
# vector.transform!(transformation)
|
431
|
+
#
|
432
|
+
# @param [Geom::Transformation2d] transform
|
433
|
+
# A Transformation object to apply to the vector.
|
434
|
+
#
|
435
|
+
# @return [Geom::Vector2d] the transformed vector
|
436
|
+
#
|
437
|
+
# @version LayOut 2019
|
438
|
+
def transform!(transform)
|
439
|
+
end
|
440
|
+
|
441
|
+
# The {#unit_vector?} method returns whether the {Geom::Vector2d} is a unit
|
442
|
+
# vector. This is equivalent to vector.length == 1.0
|
443
|
+
#
|
444
|
+
# @example
|
445
|
+
# vector = Geom::Vector2d.new(1, 0)
|
446
|
+
# # returns true
|
447
|
+
# status = vector.unit_vector
|
448
|
+
#
|
449
|
+
# @return [Boolean]
|
450
|
+
#
|
451
|
+
# @version LayOut 2018
|
452
|
+
def unit_vector?
|
453
|
+
end
|
454
|
+
|
455
|
+
# The {#valid?} method verifies if a {Geom::Vector2d} is valid. A
|
456
|
+
# {Geom::Vector2d} is valid if its length is not zero.
|
457
|
+
#
|
458
|
+
# @example
|
459
|
+
# vector = Geom::Vector2d.new(0, 4)
|
460
|
+
# status = vector.valid
|
461
|
+
#
|
462
|
+
# @return [Boolean]
|
463
|
+
#
|
464
|
+
# @version LayOut 2018
|
465
|
+
def valid?
|
466
|
+
end
|
467
|
+
|
468
|
+
# The {#x} method retrieves the x value of the {Geom::Vector2d}.
|
469
|
+
#
|
470
|
+
# @example
|
471
|
+
# vector = Geom::Vector2d.new(1, 2)
|
472
|
+
# x = vector.x
|
473
|
+
#
|
474
|
+
# @return [Numeric]
|
475
|
+
#
|
476
|
+
# @version LayOut 2018
|
477
|
+
def x
|
478
|
+
end
|
479
|
+
|
480
|
+
# The {#x=} method sets the x coordinate of the {Geom::Vector2d}.
|
481
|
+
#
|
482
|
+
# @example
|
483
|
+
# vector = Geom::Vector2d.new(1, 2)
|
484
|
+
# vector.x = 7
|
485
|
+
#
|
486
|
+
# @param [Numeric] x
|
487
|
+
# The desired x value of the {Geom::Vector2d}
|
488
|
+
#
|
489
|
+
# @return [Numeric] The new x value of the {Geom::Vector2d}
|
490
|
+
#
|
491
|
+
# @version LayOut 2018
|
492
|
+
def x=(x)
|
493
|
+
end
|
494
|
+
|
495
|
+
# The {#y} method retrieves the y value of the {Geom::Vector2d}.
|
496
|
+
#
|
497
|
+
# @example
|
498
|
+
# vector = Geom::Vector2d.new(1, 2)
|
499
|
+
# y = vector.y
|
500
|
+
#
|
501
|
+
# @return [Numeric]
|
502
|
+
#
|
503
|
+
# @version LayOut 2018
|
504
|
+
def y
|
505
|
+
end
|
506
|
+
|
507
|
+
# The {#y=} method sets the y coordinate of the {Geom::Vector2d}.
|
508
|
+
#
|
509
|
+
# @example
|
510
|
+
# vector = Geom::Vector2d.new(1, 2)
|
511
|
+
# vector.y = 7
|
512
|
+
#
|
513
|
+
# @param [Numeric] y
|
514
|
+
# The desired y value of the {Geom::Vector2d}
|
515
|
+
#
|
516
|
+
# @return [Numeric] The new y value of the {Geom::Vector2d}
|
517
|
+
#
|
518
|
+
# @version LayOut 2018
|
519
|
+
def y=(y)
|
520
|
+
end
|
521
|
+
|
522
|
+
end
|