sketchup-api-stubs 0.7.10 → 0.7.11
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/sketchup.rb +6 -0
- data/lib/sketchup-api-stubs/stubs/Array.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +25 -15
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +17 -32
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +62 -39
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +136 -104
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +56 -30
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +76 -52
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +35 -31
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +8 -16
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +135 -110
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +207 -222
- data/lib/sketchup-api-stubs/stubs/Geom.rb +6 -6
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +11 -7
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +124 -10
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +112 -4
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +56 -9
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +100 -1
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +13 -14
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +47 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Length.rb +9 -1
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +65 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +2 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +16 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +13 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +8 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +10 -15
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +28 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +15 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +7 -12
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +4 -10
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +17 -15
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +17 -17
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +11 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +59 -19
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +3 -6
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +94 -25
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +16 -26
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +24 -17
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +11 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +4 -67
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +34 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +4 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +14 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +3 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -19
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +10 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +831 -130
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +35 -22
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +146 -88
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +20 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +14 -11
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +17 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +1 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +158 -16
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +48 -21
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +61 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +13 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +84 -91
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +9 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +20 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +59 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +29 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -31
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +9 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +229 -139
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +23 -22
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +336 -99
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +34 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +71 -36
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +21 -9
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +80 -5
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +14 -3
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +20 -3
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +9 -6
- data/lib/sketchup-api-stubs/stubs/UI.rb +77 -14
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +7 -7
- metadata +10 -24
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# The UTM class lets you work with UTM map coordinates.
|
|
@@ -16,11 +16,10 @@ class Geom::UTM
|
|
|
16
16
|
# instead of calling this method.
|
|
17
17
|
#
|
|
18
18
|
# @example
|
|
19
|
-
#
|
|
20
|
-
# utm = Geom::UTM.new(utm2)
|
|
19
|
+
# utm1 = Geom::UTM.new
|
|
21
20
|
#
|
|
22
21
|
# # Create a new UTM object from scratch.
|
|
23
|
-
#
|
|
22
|
+
# utm2 = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
24
23
|
#
|
|
25
24
|
# @overload initialize(zone_number, zone_letter, x, y)
|
|
26
25
|
#
|
|
@@ -35,7 +34,7 @@ class Geom::UTM
|
|
|
35
34
|
#
|
|
36
35
|
# @overload initialize(array)
|
|
37
36
|
#
|
|
38
|
-
# @param [Array(Integer, String, Float, Float)]
|
|
37
|
+
# @param [Array(Integer, String, Float, Float)] array contains the zone
|
|
39
38
|
# number, zone letter, x and y positions.
|
|
40
39
|
#
|
|
41
40
|
# @return [Geom::UTM]
|
|
@@ -49,9 +48,8 @@ class Geom::UTM
|
|
|
49
48
|
# coordinate.
|
|
50
49
|
#
|
|
51
50
|
# @example
|
|
52
|
-
# # Create a new UTM object from scratch.
|
|
53
51
|
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
54
|
-
#
|
|
52
|
+
# array = utm.to_a
|
|
55
53
|
#
|
|
56
54
|
# @return [Array(Integer, String, Float, Float)]
|
|
57
55
|
#
|
|
@@ -63,9 +61,8 @@ class Geom::UTM
|
|
|
63
61
|
# and longitude. See the LatLong class for more information.
|
|
64
62
|
#
|
|
65
63
|
# @example
|
|
66
|
-
# # Create a new UTM object from scratch.
|
|
67
64
|
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
68
|
-
#
|
|
65
|
+
# latlong = utm.to_latlong
|
|
69
66
|
#
|
|
70
67
|
# @return [Geom::LatLong]
|
|
71
68
|
#
|
|
@@ -76,7 +73,6 @@ class Geom::UTM
|
|
|
76
73
|
# The {#to_s} method is used to retrieve a string representation of a UTM.
|
|
77
74
|
#
|
|
78
75
|
# @example
|
|
79
|
-
# # Create a new UTM object from scratch.
|
|
80
76
|
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
81
77
|
# string = utm.to_s
|
|
82
78
|
#
|
|
@@ -89,7 +85,6 @@ class Geom::UTM
|
|
|
89
85
|
# The {#x} method returns the UTM x coordinate.
|
|
90
86
|
#
|
|
91
87
|
# @example
|
|
92
|
-
# # Create a new UTM object from scratch.
|
|
93
88
|
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
94
89
|
# x = utm.x
|
|
95
90
|
#
|
|
@@ -102,7 +97,6 @@ class Geom::UTM
|
|
|
102
97
|
# The {#y} method returns the UTM y coordinate.
|
|
103
98
|
#
|
|
104
99
|
# @example
|
|
105
|
-
# # Create a new UTM object from scratch.
|
|
106
100
|
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
107
101
|
# y = utm.y
|
|
108
102
|
#
|
|
@@ -115,9 +109,8 @@ class Geom::UTM
|
|
|
115
109
|
# The {#zone_letter} method returns the UTM zone letter.
|
|
116
110
|
#
|
|
117
111
|
# @example
|
|
118
|
-
# # Create a new UTM object from scratch.
|
|
119
112
|
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
120
|
-
#
|
|
113
|
+
# zone_letter = utm.zone_letter
|
|
121
114
|
#
|
|
122
115
|
# @return [String]
|
|
123
116
|
#
|
|
@@ -128,9 +121,8 @@ class Geom::UTM
|
|
|
128
121
|
# The {#zone_number} method returns the UTM zone number.
|
|
129
122
|
#
|
|
130
123
|
# @example
|
|
131
|
-
# # Create a new UTM object from scratch.
|
|
132
124
|
# utm = Geom::UTM.new(13, "T", 475849.37521, 4429682.73749)
|
|
133
|
-
#
|
|
125
|
+
# zone_number = utm.zone_number
|
|
134
126
|
#
|
|
135
127
|
# @return [Integer]
|
|
136
128
|
#
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# The {Geom::Vector2d} class represents vectors in a 2 dimensional space.
|
|
@@ -10,19 +10,23 @@ class Geom::Vector2d
|
|
|
10
10
|
|
|
11
11
|
# Instance Methods
|
|
12
12
|
|
|
13
|
-
# The {#%} method
|
|
14
|
-
#
|
|
13
|
+
# The {#%} method is used to compute the dot product between two vectors.
|
|
14
|
+
#
|
|
15
|
+
# This is an alias of the {#dot} method.
|
|
15
16
|
#
|
|
16
17
|
# @example
|
|
17
|
-
#
|
|
18
|
-
# vector2 = Geom::Vector2d.new(
|
|
19
|
-
#
|
|
18
|
+
# vector1 = Geom::Vector2d.new(4, 5)
|
|
19
|
+
# vector2 = Geom::Vector2d.new(7, 1)
|
|
20
|
+
# # The result is 33
|
|
21
|
+
# dot = vector1 % vector2
|
|
20
22
|
#
|
|
21
|
-
# @param [Geom::Vector2d] vector
|
|
23
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
22
24
|
#
|
|
23
|
-
# @return
|
|
25
|
+
# @return [Float]
|
|
24
26
|
#
|
|
25
|
-
# @
|
|
27
|
+
# @see #dot
|
|
28
|
+
#
|
|
29
|
+
# @version SketchUp 6.0
|
|
26
30
|
def %(vector)
|
|
27
31
|
end
|
|
28
32
|
|
|
@@ -30,13 +34,16 @@ class Geom::Vector2d
|
|
|
30
34
|
# is an alias of the cross method.
|
|
31
35
|
#
|
|
32
36
|
# @example
|
|
33
|
-
#
|
|
34
|
-
# vector2 = Geom::Vector2d.new(
|
|
35
|
-
#
|
|
37
|
+
# vector1 = Geom::Vector2d.new(2, 5)
|
|
38
|
+
# vector2 = Geom::Vector2d.new(5, 1)
|
|
39
|
+
# # The result is -23
|
|
40
|
+
# cross = vector1 * vector2
|
|
36
41
|
#
|
|
37
|
-
# @param [Geom::Vector2d] vector
|
|
42
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
38
43
|
#
|
|
39
|
-
# @return [
|
|
44
|
+
# @return [Float]
|
|
45
|
+
#
|
|
46
|
+
# @see #cross
|
|
40
47
|
#
|
|
41
48
|
# @version LayOut 2018
|
|
42
49
|
def *(vector)
|
|
@@ -45,11 +52,11 @@ class Geom::Vector2d
|
|
|
45
52
|
# The {#+} method adds a {Geom::Vector2d} to this one.
|
|
46
53
|
#
|
|
47
54
|
# @example
|
|
48
|
-
#
|
|
55
|
+
# vector1 = Geom::Vector2d.new(0, 2)
|
|
49
56
|
# vector2 = Geom::Vector2d.new(1, 0)
|
|
50
|
-
# new_vector =
|
|
57
|
+
# new_vector = vector1 + vector2
|
|
51
58
|
#
|
|
52
|
-
# @param [Geom::Vector2d] vector
|
|
59
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
53
60
|
#
|
|
54
61
|
# @return [Geom::Vector2d]
|
|
55
62
|
#
|
|
@@ -60,11 +67,11 @@ class Geom::Vector2d
|
|
|
60
67
|
# The {#-} method subtracts a {Geom::Vector2d} from this one.
|
|
61
68
|
#
|
|
62
69
|
# @example
|
|
63
|
-
#
|
|
70
|
+
# vector1 = Geom::Vector2d.new(0, 2)
|
|
64
71
|
# vector2 = Geom::Vector2d.new(1, 0)
|
|
65
|
-
# new_vector =
|
|
72
|
+
# new_vector = vector1 - vector2
|
|
66
73
|
#
|
|
67
|
-
# @param [Geom::Vector2d] vector
|
|
74
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
68
75
|
#
|
|
69
76
|
# @return [Geom::Vector2d]
|
|
70
77
|
#
|
|
@@ -76,12 +83,12 @@ class Geom::Vector2d
|
|
|
76
83
|
# tolerance.
|
|
77
84
|
#
|
|
78
85
|
# @example
|
|
79
|
-
#
|
|
80
|
-
# vector2 = Geom::Vector2d.new(0,1)
|
|
86
|
+
# vector1 = Geom::Vector2d.new(1, 0)
|
|
87
|
+
# vector2 = Geom::Vector2d.new(0, 1)
|
|
81
88
|
# # Returns false
|
|
82
|
-
# status =
|
|
89
|
+
# status = vector1 == vector2
|
|
83
90
|
#
|
|
84
|
-
# @param [Geom::Vector2d] vector
|
|
91
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
85
92
|
#
|
|
86
93
|
# @return [Boolean]
|
|
87
94
|
#
|
|
@@ -94,13 +101,13 @@ class Geom::Vector2d
|
|
|
94
101
|
#
|
|
95
102
|
# @example
|
|
96
103
|
# vector = Geom::Vector2d.new(1, 2)
|
|
97
|
-
# #
|
|
104
|
+
# # Retrieves the y value of 2
|
|
98
105
|
# yvalue = vector[1]
|
|
99
106
|
#
|
|
100
107
|
# @param [Integer] index
|
|
101
108
|
# The index into an array of two coordinates.
|
|
102
109
|
#
|
|
103
|
-
# @return [
|
|
110
|
+
# @return [Float] The value for the x or y coordinate.
|
|
104
111
|
#
|
|
105
112
|
# @version LayOut 2018
|
|
106
113
|
def [](index)
|
|
@@ -110,17 +117,17 @@ class Geom::Vector2d
|
|
|
110
117
|
# specific index of the value.
|
|
111
118
|
#
|
|
112
119
|
# @example
|
|
113
|
-
#
|
|
114
|
-
#
|
|
120
|
+
# vector = Geom::Vector2d.new(1, 2)
|
|
121
|
+
# vector[1] = 4
|
|
115
122
|
#
|
|
116
|
-
# @param [
|
|
123
|
+
# @param [Integer] index
|
|
117
124
|
# The index for a specific x or y value in the
|
|
118
125
|
# {Geom::Vector2d} to set
|
|
119
126
|
#
|
|
120
|
-
# @param [
|
|
127
|
+
# @param [Float] value
|
|
121
128
|
# The value to set for x or y
|
|
122
129
|
#
|
|
123
|
-
# @return [
|
|
130
|
+
# @return [Float] The new x or y value if successful
|
|
124
131
|
#
|
|
125
132
|
# @version LayOut 2018
|
|
126
133
|
def []=(index, value)
|
|
@@ -130,14 +137,14 @@ class Geom::Vector2d
|
|
|
130
137
|
# the {Geom::Vector2d} and another {Geom::Vector2d}.
|
|
131
138
|
#
|
|
132
139
|
# @example
|
|
133
|
-
#
|
|
140
|
+
# vector1 = Geom::Vector2d.new(1, 0)
|
|
134
141
|
# vector2 = Geom::Vector2d.new(-1, 0)
|
|
135
|
-
# #
|
|
136
|
-
# angle =
|
|
142
|
+
# # Returns PI
|
|
143
|
+
# angle = vector1.angle_between(vector2)
|
|
137
144
|
#
|
|
138
|
-
# @param [Geom::Vector2d] vector
|
|
145
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
139
146
|
#
|
|
140
|
-
# @return [
|
|
147
|
+
# @return [Float] The angle (in radians)
|
|
141
148
|
#
|
|
142
149
|
# @version LayOut 2018
|
|
143
150
|
def angle_between(vector)
|
|
@@ -148,7 +155,7 @@ class Geom::Vector2d
|
|
|
148
155
|
#
|
|
149
156
|
# @example
|
|
150
157
|
# vector = Geom::Vector2d.new(1, 0)
|
|
151
|
-
#
|
|
158
|
+
# new_vector = vector.clone
|
|
152
159
|
#
|
|
153
160
|
# @return [Geom::Vector2d]
|
|
154
161
|
#
|
|
@@ -156,35 +163,43 @@ class Geom::Vector2d
|
|
|
156
163
|
def clone
|
|
157
164
|
end
|
|
158
165
|
|
|
159
|
-
# The {
|
|
160
|
-
#
|
|
166
|
+
# The {#cross} method returns the cross product between two {Geom::Vector2d}s.
|
|
167
|
+
#
|
|
168
|
+
# The cross product, also called the vector product, is an operation on two
|
|
169
|
+
# vectors. The cross product of two vectors produces a third vector which is
|
|
170
|
+
# perpendicular to the plane in which the first two lie.
|
|
161
171
|
#
|
|
162
172
|
# @example
|
|
163
|
-
#
|
|
164
|
-
# vector2 = Geom::Vector2d.new(
|
|
165
|
-
#
|
|
173
|
+
# vector1 = Geom::Vector2d.new(3, 3)
|
|
174
|
+
# vector2 = Geom::Vector2d.new(2, 5)
|
|
175
|
+
# # The result is 9
|
|
176
|
+
# cross = vector1.cross(vector2)
|
|
166
177
|
#
|
|
167
|
-
# @param [Geom::Vector2d] vector
|
|
178
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
168
179
|
#
|
|
169
|
-
# @return [
|
|
180
|
+
# @return [Float]
|
|
181
|
+
#
|
|
182
|
+
# @see #*
|
|
170
183
|
#
|
|
171
184
|
# @version LayOut 2018
|
|
172
185
|
def cross(vector)
|
|
173
186
|
end
|
|
174
187
|
|
|
175
|
-
# The {
|
|
176
|
-
# an alias of the dot method.
|
|
188
|
+
# The {#dot} method is used to compute the dot product between two vectors.
|
|
177
189
|
#
|
|
178
190
|
# @example
|
|
179
|
-
#
|
|
180
|
-
#
|
|
181
|
-
#
|
|
191
|
+
# vector1 = Geom::Vector2d.new(4, 1)
|
|
192
|
+
# # The result is 14
|
|
193
|
+
# vector2 = Geom::Vector2d.new(3, 2)
|
|
194
|
+
# dot = vector1.dot(vector2)
|
|
182
195
|
#
|
|
183
|
-
# @param [Geom::Vector2d] vector
|
|
196
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
184
197
|
#
|
|
185
|
-
# @return
|
|
198
|
+
# @return [Float]
|
|
186
199
|
#
|
|
187
|
-
# @
|
|
200
|
+
# @see #%
|
|
201
|
+
#
|
|
202
|
+
# @version SketchUp 6.0
|
|
188
203
|
def dot(vector)
|
|
189
204
|
end
|
|
190
205
|
|
|
@@ -192,7 +207,9 @@ class Geom::Vector2d
|
|
|
192
207
|
#
|
|
193
208
|
# @example
|
|
194
209
|
# # A vector that runs along the X axis.
|
|
195
|
-
#
|
|
210
|
+
# vector1 = Geom::Vector2d.new(1, 0)
|
|
211
|
+
#
|
|
212
|
+
# vector2 = Geom::Vector2d.new([5, 6])
|
|
196
213
|
#
|
|
197
214
|
# @overload initialize
|
|
198
215
|
#
|
|
@@ -200,13 +217,13 @@ class Geom::Vector2d
|
|
|
200
217
|
#
|
|
201
218
|
# @overload initialize(x, y)
|
|
202
219
|
#
|
|
203
|
-
# @param [
|
|
204
|
-
# @param [
|
|
220
|
+
# @param [Float] x The length in the x direction
|
|
221
|
+
# @param [Float] y The length in the y direction
|
|
205
222
|
# @return [Geom::Vector2d]
|
|
206
223
|
#
|
|
207
224
|
# @overload initialize(vector)
|
|
208
225
|
#
|
|
209
|
-
# @param [Geom::Vector2d, Array(
|
|
226
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
210
227
|
# @return [Geom::Vector2d]
|
|
211
228
|
#
|
|
212
229
|
# @version LayOut 2018
|
|
@@ -216,8 +233,8 @@ class Geom::Vector2d
|
|
|
216
233
|
# The {#inspect} method formats the {Geom::Vector2d} as a string.
|
|
217
234
|
#
|
|
218
235
|
# @example
|
|
219
|
-
#
|
|
220
|
-
# string =
|
|
236
|
+
# vector = Geom::Vector2d.new(1, 2)
|
|
237
|
+
# string = vector.inspect
|
|
221
238
|
#
|
|
222
239
|
# @return [String] the string representation of the {Geom::Vector2d}
|
|
223
240
|
#
|
|
@@ -229,8 +246,8 @@ class Geom::Vector2d
|
|
|
229
246
|
#
|
|
230
247
|
# @example
|
|
231
248
|
# vector = Geom::Vector2d.new(0, 4)
|
|
232
|
-
# #
|
|
233
|
-
#
|
|
249
|
+
# # The result is 4
|
|
250
|
+
# length = vector.length
|
|
234
251
|
#
|
|
235
252
|
# @return [Length] The length of the {Geom::Vector2d}
|
|
236
253
|
#
|
|
@@ -243,13 +260,12 @@ class Geom::Vector2d
|
|
|
243
260
|
#
|
|
244
261
|
# @example
|
|
245
262
|
# vector = Geom::Vector2d.new(0, 4)
|
|
246
|
-
# l = vector.length
|
|
247
263
|
# vector.length = 2
|
|
248
264
|
#
|
|
249
|
-
# @param [
|
|
265
|
+
# @param [Float] length
|
|
250
266
|
# The new length for the {Geom::Vector2d}
|
|
251
267
|
#
|
|
252
|
-
# @return [
|
|
268
|
+
# @return [Length] The new length
|
|
253
269
|
#
|
|
254
270
|
# @version LayOut 2018
|
|
255
271
|
def length=(length)
|
|
@@ -260,8 +276,8 @@ class Geom::Vector2d
|
|
|
260
276
|
#
|
|
261
277
|
# @example
|
|
262
278
|
# vector = Geom::Vector2d.new(0, 4)
|
|
263
|
-
# #
|
|
264
|
-
#
|
|
279
|
+
# # The result is a Vector2d(0, 1)
|
|
280
|
+
# new_vector = vector.normalize
|
|
265
281
|
#
|
|
266
282
|
# @return [Geom::Vector2d]
|
|
267
283
|
#
|
|
@@ -270,27 +286,27 @@ class Geom::Vector2d
|
|
|
270
286
|
end
|
|
271
287
|
|
|
272
288
|
# The {#normalize!} method converts a {Geom::Vector2d} vector into a unit
|
|
273
|
-
# vector. Another way to do this is vector.length = 1
|
|
289
|
+
# vector. Another way to do this is +vector.length = 1.0+
|
|
274
290
|
#
|
|
275
291
|
# @example
|
|
276
292
|
# vector = Geom::Vector2d.new(0, 4)
|
|
277
|
-
# #
|
|
293
|
+
# # Modifies vector to be the Vector2d(0, 1)
|
|
278
294
|
# vector.normalize!
|
|
279
295
|
#
|
|
280
296
|
# @version LayOut 2018
|
|
281
297
|
def normalize!
|
|
282
298
|
end
|
|
283
299
|
|
|
284
|
-
# The {#parallel?} method determines if
|
|
285
|
-
#
|
|
300
|
+
# The {#parallel?} method determines if two {Geom::Vector2d}s are parallel within a
|
|
301
|
+
# tolerance. Two vectors are parallel if there exists a scalar multiple between them.
|
|
286
302
|
#
|
|
287
303
|
# @example
|
|
288
|
-
#
|
|
289
|
-
# vector2 = Geom::Vector2d.new(
|
|
290
|
-
# #
|
|
291
|
-
# status =
|
|
304
|
+
# vector1 = Geom::Vector2d.new(0, 1)
|
|
305
|
+
# vector2 = Geom::Vector2d.new(0, -9)
|
|
306
|
+
# # Returns true
|
|
307
|
+
# status = vector1.parallel?(vector2)
|
|
292
308
|
#
|
|
293
|
-
# @param [Geom::Vector2d] vector
|
|
309
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
294
310
|
#
|
|
295
311
|
# @return [Boolean]
|
|
296
312
|
#
|
|
@@ -298,16 +314,17 @@ class Geom::Vector2d
|
|
|
298
314
|
def parallel?(vector)
|
|
299
315
|
end
|
|
300
316
|
|
|
301
|
-
# The {#perpendicular?} method determines if
|
|
302
|
-
# perpendicular
|
|
317
|
+
# The {#perpendicular?} method determines if two {Geom::Vector2d}s are
|
|
318
|
+
# perpendicular within a tolerance. Two vectors are considered
|
|
319
|
+
# perpendicular if their dot product is zero.
|
|
303
320
|
#
|
|
304
321
|
# @example
|
|
305
|
-
#
|
|
306
|
-
# vector2 = Geom::Vector2d.new(1,
|
|
307
|
-
# #
|
|
308
|
-
# status =
|
|
322
|
+
# vector1 = Geom::Vector2d.new(0, 5)
|
|
323
|
+
# vector2 = Geom::Vector2d.new(1, 0)
|
|
324
|
+
# # Returns true
|
|
325
|
+
# status = vector1.perpendicular?(vector2)
|
|
309
326
|
#
|
|
310
|
-
# @param [Geom::Vector2d] vector
|
|
327
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
311
328
|
#
|
|
312
329
|
# @return [Boolean]
|
|
313
330
|
#
|
|
@@ -320,8 +337,8 @@ class Geom::Vector2d
|
|
|
320
337
|
#
|
|
321
338
|
# @example
|
|
322
339
|
# vector = Geom::Vector2d.new(1, 2)
|
|
323
|
-
# #
|
|
324
|
-
#
|
|
340
|
+
# # The result is a Vector2d(-1, -2)
|
|
341
|
+
# new_vector = vector.reverse
|
|
325
342
|
#
|
|
326
343
|
# @return [Geom::Vector2d]
|
|
327
344
|
#
|
|
@@ -333,7 +350,7 @@ class Geom::Vector2d
|
|
|
333
350
|
#
|
|
334
351
|
# @example
|
|
335
352
|
# vector = Geom::Vector2d.new(1, 2)
|
|
336
|
-
# #
|
|
353
|
+
# # Modifies vector to be the Vector2d(-1, -2)
|
|
337
354
|
# vector.reverse!
|
|
338
355
|
#
|
|
339
356
|
# @version LayOut 2018
|
|
@@ -344,12 +361,17 @@ class Geom::Vector2d
|
|
|
344
361
|
# to and in the same direction as another {Geom::Vector2d} within tolerance.
|
|
345
362
|
#
|
|
346
363
|
# @example
|
|
347
|
-
#
|
|
364
|
+
# vector1 = Geom::Vector2d.new(0, 1)
|
|
348
365
|
# vector2 = Geom::Vector2d.new(1, 2)
|
|
349
|
-
# #
|
|
350
|
-
# status =
|
|
366
|
+
# # Returns false
|
|
367
|
+
# status = vector1.same_direction?(vector2)
|
|
368
|
+
#
|
|
369
|
+
# @example
|
|
370
|
+
# vector = Geom::Vector2d.new(0, 2)
|
|
371
|
+
# # Returns true
|
|
372
|
+
# status = vector.same_direction?([0, 4])
|
|
351
373
|
#
|
|
352
|
-
# @param [Geom::Vector2d] vector
|
|
374
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
353
375
|
#
|
|
354
376
|
# @return [Boolean]
|
|
355
377
|
#
|
|
@@ -365,13 +387,13 @@ class Geom::Vector2d
|
|
|
365
387
|
#
|
|
366
388
|
# @overload set!(vector)
|
|
367
389
|
#
|
|
368
|
-
# @param [Geom::Vector2d, Array(
|
|
390
|
+
# @param [Geom::Vector2d, Array(Float, Float)] vector
|
|
369
391
|
# @return [Geom::Vector2d]
|
|
370
392
|
#
|
|
371
393
|
# @overload set!(x, y)
|
|
372
394
|
#
|
|
373
|
-
# @param [
|
|
374
|
-
# @param [
|
|
395
|
+
# @param [Float] x
|
|
396
|
+
# @param [Float] y
|
|
375
397
|
# @return [Geom::Vector2d]
|
|
376
398
|
#
|
|
377
399
|
# @version LayOut 2018
|
|
@@ -382,9 +404,10 @@ class Geom::Vector2d
|
|
|
382
404
|
# Array.
|
|
383
405
|
#
|
|
384
406
|
# @example
|
|
385
|
-
#
|
|
407
|
+
# vector = Geom::Vector2d.new(1, 2)
|
|
408
|
+
# array = vector.to_a
|
|
386
409
|
#
|
|
387
|
-
# @return [Array(
|
|
410
|
+
# @return [Array(Float, Float)]
|
|
388
411
|
#
|
|
389
412
|
# @version LayOut 2018
|
|
390
413
|
def to_a
|
|
@@ -393,8 +416,8 @@ class Geom::Vector2d
|
|
|
393
416
|
# The {#to_s} method returns a string representation of the {Geom::Vector2d}.
|
|
394
417
|
#
|
|
395
418
|
# @example
|
|
396
|
-
#
|
|
397
|
-
#
|
|
419
|
+
# vector = Geom::Vector2d.new(1, 2)
|
|
420
|
+
# string = vector.to_s
|
|
398
421
|
#
|
|
399
422
|
# @return [String] the string representation of the {Geom::Vector2d}
|
|
400
423
|
#
|
|
@@ -406,10 +429,11 @@ class Geom::Vector2d
|
|
|
406
429
|
# vector. The original vector is unchanged by this method.
|
|
407
430
|
#
|
|
408
431
|
# @example
|
|
409
|
-
# vector = Geom::Vector2d.new(
|
|
410
|
-
#
|
|
411
|
-
#
|
|
412
|
-
#
|
|
432
|
+
# vector = Geom::Vector2d.new(3, 2)
|
|
433
|
+
# point = Geom::Point2d.new(0, 1)
|
|
434
|
+
# transformation = Geom::Transformation2d.scaling(point, 2)
|
|
435
|
+
# # The result is a Vector2d(6, 4)
|
|
436
|
+
# new_vector = vector.transform(transformation)
|
|
413
437
|
#
|
|
414
438
|
# @param [Geom::Transformation2d] transform
|
|
415
439
|
# A transformation object to apply to the vector.
|
|
@@ -425,8 +449,9 @@ class Geom::Vector2d
|
|
|
425
449
|
#
|
|
426
450
|
# @example
|
|
427
451
|
# vector = Geom::Vector2d.new(4, 5)
|
|
428
|
-
#
|
|
429
|
-
#
|
|
452
|
+
# point = Geom::Point2d.new(8, 9)
|
|
453
|
+
# transformation = Geom::Transformation2d.scaling(point, 3)
|
|
454
|
+
# # The result is a Vector2d(12, 15)
|
|
430
455
|
# vector.transform!(transformation)
|
|
431
456
|
#
|
|
432
457
|
# @param [Geom::Transformation2d] transform
|
|
@@ -443,8 +468,8 @@ class Geom::Vector2d
|
|
|
443
468
|
#
|
|
444
469
|
# @example
|
|
445
470
|
# vector = Geom::Vector2d.new(1, 0)
|
|
446
|
-
# #
|
|
447
|
-
# status = vector.unit_vector
|
|
471
|
+
# # Returns true
|
|
472
|
+
# status = vector.unit_vector?
|
|
448
473
|
#
|
|
449
474
|
# @return [Boolean]
|
|
450
475
|
#
|
|
@@ -457,7 +482,7 @@ class Geom::Vector2d
|
|
|
457
482
|
#
|
|
458
483
|
# @example
|
|
459
484
|
# vector = Geom::Vector2d.new(0, 4)
|
|
460
|
-
# status = vector.valid
|
|
485
|
+
# status = vector.valid?
|
|
461
486
|
#
|
|
462
487
|
# @return [Boolean]
|
|
463
488
|
#
|
|
@@ -471,7 +496,7 @@ class Geom::Vector2d
|
|
|
471
496
|
# vector = Geom::Vector2d.new(1, 2)
|
|
472
497
|
# x = vector.x
|
|
473
498
|
#
|
|
474
|
-
# @return [
|
|
499
|
+
# @return [Float]
|
|
475
500
|
#
|
|
476
501
|
# @version LayOut 2018
|
|
477
502
|
def x
|
|
@@ -483,10 +508,10 @@ class Geom::Vector2d
|
|
|
483
508
|
# vector = Geom::Vector2d.new(1, 2)
|
|
484
509
|
# vector.x = 7
|
|
485
510
|
#
|
|
486
|
-
# @param [
|
|
511
|
+
# @param [Float] x
|
|
487
512
|
# The desired x value of the {Geom::Vector2d}
|
|
488
513
|
#
|
|
489
|
-
# @return [
|
|
514
|
+
# @return [Float] The new x value of the {Geom::Vector2d}
|
|
490
515
|
#
|
|
491
516
|
# @version LayOut 2018
|
|
492
517
|
def x=(x)
|
|
@@ -498,7 +523,7 @@ class Geom::Vector2d
|
|
|
498
523
|
# vector = Geom::Vector2d.new(1, 2)
|
|
499
524
|
# y = vector.y
|
|
500
525
|
#
|
|
501
|
-
# @return [
|
|
526
|
+
# @return [Float]
|
|
502
527
|
#
|
|
503
528
|
# @version LayOut 2018
|
|
504
529
|
def y
|
|
@@ -510,10 +535,10 @@ class Geom::Vector2d
|
|
|
510
535
|
# vector = Geom::Vector2d.new(1, 2)
|
|
511
536
|
# vector.y = 7
|
|
512
537
|
#
|
|
513
|
-
# @param [
|
|
538
|
+
# @param [Float] y
|
|
514
539
|
# The desired y value of the {Geom::Vector2d}
|
|
515
540
|
#
|
|
516
|
-
# @return [
|
|
541
|
+
# @return [Float] The new y value of the {Geom::Vector2d}
|
|
517
542
|
#
|
|
518
543
|
# @version LayOut 2018
|
|
519
544
|
def y=(y)
|