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 Vector3d class is used to represent vectors in a 3 dimensional space.
|
|
@@ -16,30 +16,29 @@ class Geom::Vector3d
|
|
|
16
16
|
# at some percentage between two vectors.
|
|
17
17
|
#
|
|
18
18
|
# A linear combination is a standard term for vector math. It is defined as
|
|
19
|
-
# vector = weight1 * vector1 + weight2 * vector2
|
|
19
|
+
# vector = weight1 * vector1 + weight2 * vector2
|
|
20
20
|
#
|
|
21
21
|
# @example
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
# new_vector = Geom::Vector3d.linear_combination(0.5,
|
|
26
|
-
# # new_vector will now contain a Vector3d(1.5, 1.5, 0)
|
|
22
|
+
# vector1 = Geom::Vector3d.new(3, 0, 0)
|
|
23
|
+
# vector2 = Geom::Vector3d.new(0, 3, 0)
|
|
24
|
+
# # The result is a Vector3d(1.5, 1.5, 0)
|
|
25
|
+
# new_vector = Geom::Vector3d.linear_combination(0.5, vector1, 0.5, vector2)
|
|
27
26
|
#
|
|
28
27
|
# @overload linear_combination(weight1, vector1, weight2, vector2)
|
|
29
28
|
#
|
|
30
|
-
# @param [
|
|
29
|
+
# @param [Float] weight1 weights
|
|
31
30
|
# @param [Geom::Vector3d] vector1 The first vector.
|
|
32
|
-
# @param [
|
|
31
|
+
# @param [Float] weight2 weights
|
|
33
32
|
# @param [Geom::Vector3d] vector2 The second vector.
|
|
34
33
|
# @return [Geom::Vector3d]
|
|
35
34
|
#
|
|
36
35
|
# @overload linear_combination(x, xaxis, y, yaxis, z, zaxis)
|
|
37
36
|
#
|
|
38
|
-
# @param [
|
|
37
|
+
# @param [Float] x A weight or percentage for the x axis.
|
|
39
38
|
# @param [Geom::Vector3d] xaxis The x axis vector.
|
|
40
|
-
# @param [
|
|
39
|
+
# @param [Float] y A weight or percentage for the y axis.
|
|
41
40
|
# @param [Geom::Vector3d] yaxis The y axis vector.
|
|
42
|
-
# @param [
|
|
41
|
+
# @param [Float] z A weight or percentage for the z axis.
|
|
43
42
|
# @param [Geom::Vector3d] zaxis The z axis vector.
|
|
44
43
|
# @return [Geom::Vector3d]
|
|
45
44
|
#
|
|
@@ -54,18 +53,19 @@ class Geom::Vector3d
|
|
|
54
53
|
# This is an alias of the {#dot} method.
|
|
55
54
|
#
|
|
56
55
|
# @example
|
|
57
|
-
# vector1 = Geom::Vector3d.new(
|
|
58
|
-
# vector2 = Geom::Vector3d.new(
|
|
56
|
+
# vector1 = Geom::Vector3d.new(2, 2, 1)
|
|
57
|
+
# vector2 = Geom::Vector3d.new(1, 3, 0)
|
|
58
|
+
# # The result is 8
|
|
59
59
|
# dot = vector1 % vector2
|
|
60
60
|
#
|
|
61
|
-
# @param [Geom::Vector3d]
|
|
61
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
62
62
|
#
|
|
63
63
|
# @return [Float]
|
|
64
64
|
#
|
|
65
65
|
# @see #dot
|
|
66
66
|
#
|
|
67
67
|
# @version SketchUp 6.0
|
|
68
|
-
def %(
|
|
68
|
+
def %(vector3d)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
# The {#*} method is used to compute the cross product between two vectors.
|
|
@@ -77,156 +77,140 @@ class Geom::Vector3d
|
|
|
77
77
|
# This is an alias of the {#cross} method.
|
|
78
78
|
#
|
|
79
79
|
# @example
|
|
80
|
-
# vector1 = Geom::Vector3d.new(1, 0,
|
|
81
|
-
# vector2 = Geom::Vector3d.new(
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
# @example
|
|
85
|
-
# vector = Geom::Vector3d.new(1, 0, 0)
|
|
86
|
-
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
87
|
-
# vector3 = vector.cross(vector2)
|
|
80
|
+
# vector1 = Geom::Vector3d.new(1, 0, 2)
|
|
81
|
+
# vector2 = Geom::Vector3d.new(3, 1, 1)
|
|
82
|
+
# # The result is a Vector3d(-2, 5, 1)
|
|
83
|
+
# cross = vector1 * vector2
|
|
88
84
|
#
|
|
89
|
-
# @param [Geom::Vector3d]
|
|
85
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
90
86
|
#
|
|
91
|
-
# @return [Geom::Vector3d]
|
|
87
|
+
# @return [Geom::Vector3d]
|
|
92
88
|
#
|
|
93
89
|
# @see #cross
|
|
94
90
|
#
|
|
95
91
|
# @version SketchUp 6.0
|
|
96
|
-
def *(
|
|
92
|
+
def *(vector3d)
|
|
97
93
|
end
|
|
98
94
|
|
|
99
|
-
# The
|
|
95
|
+
# The {#+} method is used to add a vector to this one.
|
|
100
96
|
#
|
|
101
97
|
# @example
|
|
102
|
-
#
|
|
103
|
-
# vector2 = Geom::Vector3d.new(0,1,0)
|
|
104
|
-
# new_vector =
|
|
98
|
+
# vector1 = Geom::Vector3d.new(0, 0, 2)
|
|
99
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
100
|
+
# new_vector = vector1 + vector2
|
|
105
101
|
#
|
|
106
|
-
# @param
|
|
107
|
-
# A Vector3d object.
|
|
102
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
108
103
|
#
|
|
109
104
|
# @return [Geom::Vector3d] the new vector.
|
|
110
105
|
#
|
|
111
106
|
# @version SketchUp 6.0
|
|
112
|
-
def +(
|
|
107
|
+
def +(vector3d)
|
|
113
108
|
end
|
|
114
109
|
|
|
115
|
-
# The
|
|
110
|
+
# The {#-} method is used to subtract a vector from this one.
|
|
116
111
|
#
|
|
117
112
|
# @example
|
|
118
|
-
#
|
|
119
|
-
# vector2 = Geom::Vector3d.new(0,1,0)
|
|
120
|
-
# new_vector =
|
|
113
|
+
# vector1 = Geom::Vector3d.new(0, 0, 2)
|
|
114
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
115
|
+
# new_vector = vector1 - vector2
|
|
121
116
|
#
|
|
122
|
-
# @param
|
|
123
|
-
# A Vector3d object.
|
|
117
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
124
118
|
#
|
|
125
119
|
# @return [Geom::Vector3d] the new vector.
|
|
126
120
|
#
|
|
127
121
|
# @version SketchUp 6.0
|
|
128
|
-
def -(
|
|
122
|
+
def -(vector3d)
|
|
129
123
|
end
|
|
130
124
|
|
|
131
|
-
# The
|
|
132
|
-
# than
|
|
125
|
+
# The {#<} compare method is used to compare two vectors to determine if the left-hand vector is
|
|
126
|
+
# less than the right-hand vector.
|
|
133
127
|
#
|
|
134
128
|
# @example
|
|
135
|
-
#
|
|
136
|
-
# vector2 = Geom::Vector3d.new(0,
|
|
137
|
-
#
|
|
129
|
+
# vector1 = Geom::Vector3d.new(0, 1, 0)
|
|
130
|
+
# vector2 = Geom::Vector3d.new(0, 4, 2)
|
|
131
|
+
# # Returns true
|
|
132
|
+
# vector1 < vector2
|
|
138
133
|
#
|
|
139
|
-
# @param
|
|
140
|
-
# A Vector3d object.
|
|
134
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
141
135
|
#
|
|
142
|
-
# @return [Boolean] true if the
|
|
136
|
+
# @return [Boolean] true if the vector1 is closer to origin than vector2
|
|
143
137
|
#
|
|
144
138
|
# @version SketchUp 6.0
|
|
145
|
-
def <(
|
|
139
|
+
def <(vector3d)
|
|
146
140
|
end
|
|
147
141
|
|
|
148
|
-
# The
|
|
142
|
+
# The {#==} method is used to determine if two vectors are equal to within
|
|
149
143
|
# tolerance.
|
|
150
144
|
#
|
|
151
145
|
# @example
|
|
152
|
-
#
|
|
153
|
-
# vector2 = Geom::Vector3d.new(0,1,0)
|
|
154
|
-
# status = vector == vector2
|
|
146
|
+
# vector1 = Geom::Vector3d.new(1, 0, 0)
|
|
147
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
155
148
|
# # Returns false
|
|
156
|
-
#
|
|
149
|
+
# status = vector1 == vector2
|
|
157
150
|
#
|
|
158
|
-
# @param
|
|
159
|
-
# A Vector3d object.
|
|
151
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
160
152
|
#
|
|
161
153
|
# @return [Boolean]
|
|
162
154
|
#
|
|
163
155
|
# @version SketchUp 6.0
|
|
164
|
-
def ==(
|
|
156
|
+
def ==(vector3d)
|
|
165
157
|
end
|
|
166
158
|
|
|
167
|
-
# The [] method is used to access the coordinates of a vector as if it was an
|
|
159
|
+
# The {[]} method is used to access the coordinates of a vector as if it was an
|
|
168
160
|
# Array. The index must be 0, 1 or 2.
|
|
169
161
|
#
|
|
170
162
|
# The following are equivalent:
|
|
171
163
|
#
|
|
172
164
|
# @example
|
|
173
|
-
#
|
|
165
|
+
# vector = Geom::Vector3d.new(1, 1, 0)
|
|
174
166
|
# x = vector[0]
|
|
175
167
|
#
|
|
176
|
-
# @
|
|
177
|
-
# vector = Geom::Vector3d.new(1,0,0)
|
|
178
|
-
# value = vector[0]
|
|
179
|
-
# if (value)
|
|
180
|
-
# UI.messagebox value
|
|
181
|
-
# else
|
|
182
|
-
# UI.messagebox "Failure"
|
|
183
|
-
# end
|
|
184
|
-
#
|
|
185
|
-
# @param [Integer] i
|
|
168
|
+
# @param [Integer] index
|
|
186
169
|
# An index into an array of three coordinates.
|
|
187
170
|
#
|
|
188
171
|
# @return [Length] the value for the x, y, or z coordinate.
|
|
189
172
|
#
|
|
190
173
|
# @version SketchUp 6.0
|
|
191
|
-
def [](
|
|
174
|
+
def [](index)
|
|
192
175
|
end
|
|
193
176
|
|
|
194
|
-
# The []= method is used to set the coordinates of a vector as if it was an
|
|
177
|
+
# The {[]=} method is used to set the coordinates of a vector as if it was an
|
|
195
178
|
# Array. The value of i must be 0, 1 or 2.
|
|
196
179
|
#
|
|
197
180
|
# @example
|
|
198
|
-
# vector
|
|
181
|
+
# vector = Geom::Vector3d.new(4, 5, 0)
|
|
182
|
+
#
|
|
183
|
+
# vector[2] = 10
|
|
199
184
|
#
|
|
200
185
|
# @param [Integer] index
|
|
201
186
|
# The index for the x, y, or z coordinate.
|
|
202
187
|
#
|
|
203
|
-
# @param [
|
|
188
|
+
# @param [Float] value
|
|
204
189
|
# The value for the x, y, or z coordinate.
|
|
205
190
|
#
|
|
206
|
-
# @return [
|
|
191
|
+
# @return [Float] the newly set coordinate value
|
|
207
192
|
#
|
|
208
193
|
# @version SketchUp 6.0
|
|
209
194
|
def []=(index, value)
|
|
210
195
|
end
|
|
211
196
|
|
|
212
|
-
# The angle_between method is used to compute the angle (in radians) between
|
|
197
|
+
# The {#angle_between} method is used to compute the angle (in radians) between
|
|
213
198
|
# this vector and another vector.
|
|
214
199
|
#
|
|
215
200
|
# @example
|
|
216
|
-
# vector1 = Geom::Vector3d.new(1,0,0)
|
|
217
|
-
# vector2 = Geom::Vector3d.new(0,1,0)
|
|
218
|
-
# angle = vector1.angle_between
|
|
201
|
+
# vector1 = Geom::Vector3d.new(1, 0, 0)
|
|
202
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
203
|
+
# angle = vector1.angle_between(vector2)
|
|
219
204
|
#
|
|
220
|
-
# @param [Geom::Vector3d]
|
|
221
|
-
# A Vector3d object.
|
|
205
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
222
206
|
#
|
|
223
207
|
# @return [Float] an angle (in radians)
|
|
224
208
|
#
|
|
225
209
|
# @version SketchUp 6.0
|
|
226
|
-
def angle_between(
|
|
210
|
+
def angle_between(vector3d)
|
|
227
211
|
end
|
|
228
212
|
|
|
229
|
-
# The axes method is used to compute an arbitrary set of axes with the given
|
|
213
|
+
# The {#axes} method is used to compute an arbitrary set of axes with the given
|
|
230
214
|
# vector as the z-axis direction.
|
|
231
215
|
#
|
|
232
216
|
# Returns an Array of three vectors [xaxis, yaxis, zaxis]
|
|
@@ -234,8 +218,8 @@ class Geom::Vector3d
|
|
|
234
218
|
# Vector3d objects
|
|
235
219
|
#
|
|
236
220
|
# @example
|
|
237
|
-
# vector = Geom::Vector3d.new(1,0,0)
|
|
238
|
-
#
|
|
221
|
+
# vector = Geom::Vector3d.new(1, 0, 0)
|
|
222
|
+
# array = vector.axes
|
|
239
223
|
#
|
|
240
224
|
# @return [Array(Geom::Vector3d, Geom::Vector3d, Geom::Vector3d)] an Array object containing three
|
|
241
225
|
#
|
|
@@ -243,13 +227,11 @@ class Geom::Vector3d
|
|
|
243
227
|
def axes
|
|
244
228
|
end
|
|
245
229
|
|
|
246
|
-
# The clone method is used to make a copy of a vector.
|
|
247
|
-
#
|
|
248
|
-
# This method is equivalent to vec2 = Geom::Vector3d.new(vec)
|
|
230
|
+
# The {#clone} method is used to make a copy of a vector.
|
|
249
231
|
#
|
|
250
232
|
# @example
|
|
251
|
-
# vector = Geom::Vector3d.new(1,0,0)
|
|
252
|
-
#
|
|
233
|
+
# vector = Geom::Vector3d.new(1, 0, 0)
|
|
234
|
+
# new_vector = vector.clone
|
|
253
235
|
#
|
|
254
236
|
# @return [Geom::Vector3d] a Vector3d object which is the clone of
|
|
255
237
|
# vector
|
|
@@ -265,52 +247,46 @@ class Geom::Vector3d
|
|
|
265
247
|
# perpendicular to the plane in which the first two lie.
|
|
266
248
|
#
|
|
267
249
|
# @example
|
|
268
|
-
# vector1 = Geom::Vector3d.new(1,
|
|
269
|
-
# vector2 = Geom::Vector3d.new(
|
|
270
|
-
#
|
|
271
|
-
#
|
|
272
|
-
# @example
|
|
273
|
-
# vector = Geom::Vector3d.new(1, 0, 0)
|
|
274
|
-
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
275
|
-
# vector3 = vector.cross(vector2)
|
|
250
|
+
# vector1 = Geom::Vector3d.new(1, 2, 0)
|
|
251
|
+
# vector2 = Geom::Vector3d.new(5, 1, 3)
|
|
252
|
+
# # The result is a Vector3d(6, -3, -9)
|
|
253
|
+
# cross = vector1.cross(vector2)
|
|
276
254
|
#
|
|
277
|
-
# @param [Geom::Vector3d]
|
|
255
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
278
256
|
#
|
|
279
|
-
# @return [Geom::Vector3d]
|
|
257
|
+
# @return [Geom::Vector3d]
|
|
280
258
|
#
|
|
281
259
|
# @see #*
|
|
282
260
|
#
|
|
283
261
|
# @version SketchUp 6.0
|
|
284
|
-
def cross(
|
|
262
|
+
def cross(vector3d)
|
|
285
263
|
end
|
|
286
264
|
|
|
287
265
|
# The {#dot} method is used to compute the dot product between two vectors.
|
|
288
266
|
#
|
|
289
267
|
# @example
|
|
290
|
-
# vector1 = Geom::Vector3d.new(0,
|
|
291
|
-
# vector2 = Geom::Vector3d.new(0, 1,
|
|
268
|
+
# vector1 = Geom::Vector3d.new(0, 5, 1)
|
|
269
|
+
# vector2 = Geom::Vector3d.new(0, 1, 2)
|
|
270
|
+
# # The result is 7
|
|
292
271
|
# dot = vector1.dot(vector2)
|
|
293
272
|
#
|
|
294
|
-
# @param [Geom::Vector3d]
|
|
273
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
295
274
|
#
|
|
296
275
|
# @return [Float]
|
|
297
276
|
#
|
|
298
277
|
# @see #%
|
|
299
278
|
#
|
|
300
279
|
# @version SketchUp 6.0
|
|
301
|
-
def dot(
|
|
280
|
+
def dot(vector3d)
|
|
302
281
|
end
|
|
303
282
|
|
|
304
283
|
# The new method is used to create a new vector.
|
|
305
284
|
#
|
|
306
285
|
# @example
|
|
307
286
|
# # A vector that runs up the Z axis.
|
|
308
|
-
#
|
|
309
|
-
#
|
|
310
|
-
#
|
|
311
|
-
# else
|
|
312
|
-
# UI.messagebox "Failure"
|
|
313
|
-
# end
|
|
287
|
+
# vector1 = Geom::Vector3d.new(0, 0, 1)
|
|
288
|
+
#
|
|
289
|
+
# vector2 = Geom::Vector3d.new([1, 1])
|
|
314
290
|
#
|
|
315
291
|
# @overload initialize
|
|
316
292
|
#
|
|
@@ -318,19 +294,19 @@ class Geom::Vector3d
|
|
|
318
294
|
#
|
|
319
295
|
# @overload initialize(x, y, z)
|
|
320
296
|
#
|
|
321
|
-
# @param [
|
|
322
|
-
# @param [
|
|
323
|
-
# @param [
|
|
297
|
+
# @param [Float] x
|
|
298
|
+
# @param [Float] y
|
|
299
|
+
# @param [Float] z
|
|
324
300
|
# @return [Geom::Vector3d]
|
|
325
301
|
#
|
|
326
302
|
# @overload initialize(array3d)
|
|
327
303
|
#
|
|
328
|
-
# @param [Array(
|
|
304
|
+
# @param [Array(Float, Float, Float)] array3d
|
|
329
305
|
# @return [Geom::Vector3d]
|
|
330
306
|
#
|
|
331
307
|
# @overload initialize(array2d)
|
|
332
308
|
#
|
|
333
|
-
# @param [Array(
|
|
309
|
+
# @param [Array(Float, Float)] array2d
|
|
334
310
|
# @return [Geom::Vector3d]
|
|
335
311
|
#
|
|
336
312
|
# @overload initialize(vector)
|
|
@@ -342,13 +318,12 @@ class Geom::Vector3d
|
|
|
342
318
|
def initialize(*args)
|
|
343
319
|
end
|
|
344
320
|
|
|
345
|
-
# The inspect method is used to inspect the contents of a vector as a
|
|
321
|
+
# The {#inspect} method is used to inspect the contents of a vector as a
|
|
346
322
|
# friendly string.
|
|
347
323
|
#
|
|
348
324
|
# @example
|
|
349
|
-
# vector = Geom::Vector3d.new(0,0,1)
|
|
350
|
-
#
|
|
351
|
-
# puts out_string
|
|
325
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
326
|
+
# string = vector.inspect
|
|
352
327
|
#
|
|
353
328
|
# @return [Geom::Vector3d] the Vector3d object
|
|
354
329
|
#
|
|
@@ -356,11 +331,11 @@ class Geom::Vector3d
|
|
|
356
331
|
def inspect
|
|
357
332
|
end
|
|
358
333
|
|
|
359
|
-
# The length method is used to retrieve the length of the vector.
|
|
334
|
+
# The {#length} method is used to retrieve the length of the vector.
|
|
360
335
|
#
|
|
361
336
|
# @example
|
|
362
|
-
# vector = Geom::Vector3d.new(0,0,1)
|
|
363
|
-
#
|
|
337
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
338
|
+
# length = vector.length
|
|
364
339
|
#
|
|
365
340
|
# @return [Length] the length of the vector
|
|
366
341
|
#
|
|
@@ -368,30 +343,28 @@ class Geom::Vector3d
|
|
|
368
343
|
def length
|
|
369
344
|
end
|
|
370
345
|
|
|
371
|
-
# The length= method is used to set the length of the vector. The length must
|
|
346
|
+
# The {#length=} method is used to set the length of the vector. The length must
|
|
372
347
|
# be greater than 0.
|
|
373
348
|
#
|
|
374
349
|
# @example
|
|
375
|
-
# vector = Geom::Vector3d.new(0,0,1)
|
|
376
|
-
#
|
|
377
|
-
# UI.messagebox(l)
|
|
378
|
-
# newl = vector.length = 2
|
|
350
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
351
|
+
# vector.length = 2
|
|
379
352
|
#
|
|
380
|
-
# @param [
|
|
353
|
+
# @param [Float] length
|
|
381
354
|
# A length for the vector.
|
|
382
355
|
#
|
|
383
|
-
# @return [
|
|
356
|
+
# @return [Length] a newly set length
|
|
384
357
|
#
|
|
385
358
|
# @version SketchUp 6.0
|
|
386
359
|
def length=(length)
|
|
387
360
|
end
|
|
388
361
|
|
|
389
|
-
# The normalize method is used to return a vector that is a unit vector
|
|
362
|
+
# The {#normalize} method is used to return a vector that is a unit vector
|
|
390
363
|
# of another.
|
|
391
364
|
#
|
|
392
365
|
# @example
|
|
393
|
-
# vector = Geom::Vector3d.new(0,0,2)
|
|
394
|
-
#
|
|
366
|
+
# vector = Geom::Vector3d.new(0, 0, 2)
|
|
367
|
+
# new_vector = vector.normalize
|
|
395
368
|
#
|
|
396
369
|
# @return [Geom::Vector3d] a new normalized Vector3d object
|
|
397
370
|
#
|
|
@@ -399,13 +372,13 @@ class Geom::Vector3d
|
|
|
399
372
|
def normalize
|
|
400
373
|
end
|
|
401
374
|
|
|
402
|
-
# The normalize! method is used to convert a vector into a unit vector,
|
|
375
|
+
# The {#normalize!} method is used to convert a vector into a unit vector,
|
|
403
376
|
# in place.
|
|
404
377
|
#
|
|
405
|
-
# Another way to do this is
|
|
378
|
+
# Another way to do this is +vector.length = 1.0+
|
|
406
379
|
#
|
|
407
380
|
# @example
|
|
408
|
-
# vector = Geom::Vector3d.new(0,0,2)
|
|
381
|
+
# vector = Geom::Vector3d.new(0, 0, 2)
|
|
409
382
|
# vector.normalize!
|
|
410
383
|
#
|
|
411
384
|
# @return [Geom::Vector3d] a normalized Vector3d object
|
|
@@ -414,100 +387,97 @@ class Geom::Vector3d
|
|
|
414
387
|
def normalize!
|
|
415
388
|
end
|
|
416
389
|
|
|
417
|
-
# The parallel method
|
|
418
|
-
#
|
|
390
|
+
# The {#parallel?} method determines if two {Geom::Vector3d}s are parallel within a
|
|
391
|
+
# tolerance. Two vectors are parallel if there exists a scalar multiple between them.
|
|
419
392
|
#
|
|
420
393
|
# @example
|
|
421
|
-
#
|
|
394
|
+
# vector1 = Geom::Vector3d.new(1, 2, 4)
|
|
395
|
+
# vector2 = Geom::Vector3d.new(2, 4, 8)
|
|
396
|
+
# # Returns true
|
|
397
|
+
# status = vector1.parallel?(vector2)
|
|
422
398
|
#
|
|
423
|
-
# @param [Geom::Vector3d]
|
|
424
|
-
# A Vector3d object.
|
|
399
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
425
400
|
#
|
|
426
401
|
# @return [Boolean]
|
|
427
402
|
#
|
|
428
403
|
# @version SketchUp 6.0
|
|
429
|
-
def parallel?(
|
|
404
|
+
def parallel?(vector3d)
|
|
430
405
|
end
|
|
431
406
|
|
|
432
|
-
# The perpendicular? method
|
|
433
|
-
# perpendicular
|
|
407
|
+
# The {#perpendicular?} method determines if two Geom::Vector3ds are perpendicular within a
|
|
408
|
+
# tolerance. Two vectors are considered perpendicular if their dot product is zero.
|
|
434
409
|
#
|
|
435
410
|
# @example
|
|
436
|
-
#
|
|
437
|
-
# vector2 = Geom::Vector3d.new(0,1,0)
|
|
438
|
-
# status =
|
|
411
|
+
# vector1 = Geom::Vector3d.new(0, 0, 1)
|
|
412
|
+
# vector2 = Geom::Vector3d.new(0, 1, 0)
|
|
413
|
+
# status = vector1.perpendicular?(vector2)
|
|
439
414
|
#
|
|
440
|
-
# @param [Geom::Vector3d]
|
|
441
|
-
# A Vector3d object.
|
|
415
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
442
416
|
#
|
|
443
417
|
# @return [Boolean]
|
|
444
418
|
#
|
|
445
419
|
# @version SketchUp 6.0
|
|
446
|
-
def perpendicular?(
|
|
420
|
+
def perpendicular?(vector3d)
|
|
447
421
|
end
|
|
448
422
|
|
|
449
|
-
# The reverse method is used to return a new vector that is the reverse
|
|
423
|
+
# The {#reverse} method is used to return a new vector that is the reverse
|
|
450
424
|
# of this vector, while leaving the original unchanged.
|
|
451
425
|
#
|
|
452
426
|
# @example
|
|
453
|
-
#
|
|
427
|
+
# vector = Geom::Vector3d.new(3, 1, 0)
|
|
428
|
+
# new_vector = vector.reverse
|
|
454
429
|
#
|
|
455
|
-
# @return [Geom::Vector3d] a Vector3d object
|
|
456
|
-
# vector
|
|
430
|
+
# @return [Geom::Vector3d] a reverse Vector3d object
|
|
457
431
|
#
|
|
458
432
|
# @version SketchUp 6.0
|
|
459
433
|
def reverse
|
|
460
434
|
end
|
|
461
435
|
|
|
462
|
-
# The reverse! method is used to reverse the vector in place.
|
|
436
|
+
# The {#reverse!} method is used to reverse the vector in place.
|
|
463
437
|
#
|
|
464
438
|
# @example
|
|
439
|
+
# vector = Geom::Vector3d.new(3, 1, 0)
|
|
465
440
|
# vector.reverse!
|
|
466
441
|
#
|
|
467
|
-
# @return [Geom::Vector3d] a Vector3d object
|
|
468
|
-
# vector
|
|
442
|
+
# @return [Geom::Vector3d] a reverse Vector3d object
|
|
469
443
|
#
|
|
470
444
|
# @version SketchUp 6.0
|
|
471
445
|
def reverse!
|
|
472
446
|
end
|
|
473
447
|
|
|
474
|
-
# The samedirection? method is used to determine if this vector is parallel to
|
|
448
|
+
# The {#samedirection?} method is used to determine if this vector is parallel to
|
|
475
449
|
# and in the same direction as another vector to within tolerance.
|
|
476
450
|
#
|
|
477
451
|
# @example
|
|
478
|
-
#
|
|
479
|
-
# vector2 = Geom::Vector3d.new(0,1
|
|
480
|
-
#
|
|
452
|
+
# vector1 = Geom::Vector3d.new(2, 4, 1)
|
|
453
|
+
# vector2 = Geom::Vector3d.new(2, 0, 1)
|
|
454
|
+
# # Returns false
|
|
455
|
+
# status = vector1.samedirection?(vector2)
|
|
481
456
|
#
|
|
482
|
-
# @param [Geom::Vector3d]
|
|
483
|
-
# A Vector3d object.
|
|
457
|
+
# @param [Geom::Vector3d, Array(Float, Float, Float)] vector3d
|
|
484
458
|
#
|
|
485
459
|
# @return [Boolean]
|
|
486
460
|
#
|
|
487
461
|
# @version SketchUp 6.0
|
|
488
|
-
def samedirection?(
|
|
462
|
+
def samedirection?(vector3d)
|
|
489
463
|
end
|
|
490
464
|
|
|
491
|
-
# The set! method is used to set the coordinates of the vector.
|
|
465
|
+
# The {#set!} method is used to set the coordinates of the vector.
|
|
492
466
|
#
|
|
493
467
|
# @example This is a shortcut for writing:
|
|
494
|
-
#
|
|
495
|
-
#
|
|
496
|
-
#
|
|
468
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
469
|
+
# vector.x = 2
|
|
470
|
+
# vector.y = 4
|
|
471
|
+
# vector.z = 0
|
|
497
472
|
#
|
|
498
473
|
# @example You may also call this method with an array or another vector:
|
|
499
|
-
#
|
|
500
|
-
#
|
|
501
|
-
#
|
|
474
|
+
# vector1 = Geom::Vector3d.new
|
|
475
|
+
# vector2 = Geom::Vector3d.new(2, 4, 0)
|
|
476
|
+
# vector1.set!(vector2)
|
|
502
477
|
#
|
|
503
478
|
# @example
|
|
504
|
-
# vector = Geom::Vector3d.new(0,0,1)
|
|
505
|
-
# vector.set!
|
|
506
|
-
#
|
|
507
|
-
# @overload set!(array3d)
|
|
508
|
-
#
|
|
509
|
-
# @param [Array(Numeric, Numeric, Numeric)] array3d
|
|
510
|
-
# @return [Geom::Vector3d]
|
|
479
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
480
|
+
# vector.set!(2, 4, 0) # is equivalent to vector.set!([2, 4, 0])
|
|
511
481
|
#
|
|
512
482
|
# @overload set!(vector)
|
|
513
483
|
#
|
|
@@ -516,33 +486,37 @@ class Geom::Vector3d
|
|
|
516
486
|
#
|
|
517
487
|
# @overload set!(x, y, z)
|
|
518
488
|
#
|
|
519
|
-
# @param [
|
|
520
|
-
# @param [
|
|
521
|
-
# @param [
|
|
489
|
+
# @param [Float] x
|
|
490
|
+
# @param [Float] y
|
|
491
|
+
# @param [Float] z
|
|
492
|
+
# @return [Geom::Vector3d]
|
|
493
|
+
#
|
|
494
|
+
# @overload set!(array3d)
|
|
495
|
+
#
|
|
496
|
+
# @param [Array(Float, Float, Float)] array3d
|
|
522
497
|
# @return [Geom::Vector3d]
|
|
523
498
|
#
|
|
524
499
|
# @version SketchUp 6.0
|
|
525
500
|
def set!(*args)
|
|
526
501
|
end
|
|
527
502
|
|
|
528
|
-
# The to_a method retrieves the coordinates of the vector in an Array
|
|
529
|
-
# [x, y, z].
|
|
503
|
+
# The {#to_a} method retrieves the coordinates of the vector in an Array[x, y, z].
|
|
530
504
|
#
|
|
531
505
|
# @example
|
|
532
|
-
#
|
|
506
|
+
# vector = Geom::Vector3d.new(3, 0, 6)
|
|
507
|
+
# array = vector.to_a
|
|
533
508
|
#
|
|
534
|
-
# @return [Array(
|
|
509
|
+
# @return [Array(Float, Float, Float)] the coordinates of the vector in an array
|
|
535
510
|
#
|
|
536
511
|
# @version SketchUp 6.0
|
|
537
512
|
def to_a
|
|
538
513
|
end
|
|
539
514
|
|
|
540
|
-
# The to_s method is used to format the vector as a String.
|
|
515
|
+
# The {#to_s} method is used to format the vector as a String.
|
|
541
516
|
#
|
|
542
517
|
# @example
|
|
543
|
-
# vector = Geom::Vector3d.new(0,0,1)
|
|
544
|
-
#
|
|
545
|
-
# puts out_string
|
|
518
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
519
|
+
# string = vector.to_s
|
|
546
520
|
#
|
|
547
521
|
# @return [String] a string representation of vector
|
|
548
522
|
#
|
|
@@ -550,11 +524,15 @@ class Geom::Vector3d
|
|
|
550
524
|
def to_s
|
|
551
525
|
end
|
|
552
526
|
|
|
553
|
-
#
|
|
554
|
-
# vector is unchanged by this method.
|
|
527
|
+
# The {#transform} method applies a Transformation to a vector, returning a new vector. The
|
|
528
|
+
# original vector is unchanged by this method.
|
|
555
529
|
#
|
|
556
530
|
# @example
|
|
557
|
-
#
|
|
531
|
+
# vector = Geom::Vector3d.new(0, 2, 1)
|
|
532
|
+
# point = Geom::Point3d.new(2, 3, 1)
|
|
533
|
+
# transformation = Geom::Transformation.scaling(point, 2)
|
|
534
|
+
# # The result is a Vector3d(0, 4, 2)
|
|
535
|
+
# new_vector = vector.transform(transformation)
|
|
558
536
|
#
|
|
559
537
|
# @param [Geom::Transformation] transform
|
|
560
538
|
# A Transformation object to apply to the vector.
|
|
@@ -565,9 +543,13 @@ class Geom::Vector3d
|
|
|
565
543
|
def transform(transform)
|
|
566
544
|
end
|
|
567
545
|
|
|
568
|
-
#
|
|
546
|
+
# The {#transform!} method applies a Transformation to a vector. The vector itself is modified.
|
|
569
547
|
#
|
|
570
548
|
# @example
|
|
549
|
+
# vector = Geom::Vector3d.new(0, 2, 1)
|
|
550
|
+
# point = Geom::Point3d.new(2, 3, 1)
|
|
551
|
+
# transformation = Geom::Transformation.scaling(point, 2)
|
|
552
|
+
# # The result is a Vector3d(0, 4, 2)
|
|
571
553
|
# vector.transform!(transformation)
|
|
572
554
|
#
|
|
573
555
|
# @param [Geom::Transformation] transform
|
|
@@ -579,12 +561,13 @@ class Geom::Vector3d
|
|
|
579
561
|
def transform!(transform)
|
|
580
562
|
end
|
|
581
563
|
|
|
582
|
-
# The unitvector? method is used to see if the vector is a unit vector.
|
|
564
|
+
# The {#unitvector?} method is used to see if the vector is a unit vector.
|
|
583
565
|
#
|
|
584
|
-
# This is equivalent to
|
|
566
|
+
# This is equivalent to +vector.length == 1.0+
|
|
585
567
|
#
|
|
586
568
|
# @example
|
|
587
|
-
# vector = Geom::Vector3d.new(0,0,1)
|
|
569
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
570
|
+
# # Return false
|
|
588
571
|
# status = vector.unitvector?
|
|
589
572
|
#
|
|
590
573
|
# @return [Boolean]
|
|
@@ -593,15 +576,16 @@ class Geom::Vector3d
|
|
|
593
576
|
def unitvector?
|
|
594
577
|
end
|
|
595
578
|
|
|
596
|
-
# The valid? method is used to verify if a vector is valid. A vector is valid
|
|
579
|
+
# The {#valid?} method is used to verify if a vector is valid. A vector is valid
|
|
597
580
|
# if its length is not zero.
|
|
598
581
|
#
|
|
599
582
|
# @example
|
|
600
583
|
# # A zero length vector will be invalid
|
|
601
|
-
# vector = Geom::Vector3d.new
|
|
584
|
+
# vector = Geom::Vector3d.new
|
|
602
585
|
# status = vector.valid?
|
|
586
|
+
#
|
|
603
587
|
# # A non-zero length vector is valid
|
|
604
|
-
# vector = Geom::Vector3d.new(0,0,1)
|
|
588
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
|
605
589
|
# status = vector.valid?
|
|
606
590
|
#
|
|
607
591
|
# @return [Boolean]
|
|
@@ -610,81 +594,82 @@ class Geom::Vector3d
|
|
|
610
594
|
def valid?
|
|
611
595
|
end
|
|
612
596
|
|
|
613
|
-
# The x method is used to retrieve the x coordinate of the vector.
|
|
597
|
+
# The {#x} method is used to retrieve the x coordinate of the vector.
|
|
614
598
|
#
|
|
615
599
|
# @example
|
|
600
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
616
601
|
# x = vector.x
|
|
617
602
|
#
|
|
618
|
-
# @return [
|
|
603
|
+
# @return [Float] the x coordinate of the vector
|
|
619
604
|
#
|
|
620
605
|
# @version SketchUp 6.0
|
|
621
606
|
def x
|
|
622
607
|
end
|
|
623
608
|
|
|
624
|
-
# The x= method is used to set the x coordinate of the vector.
|
|
609
|
+
# The {#x=} method is used to set the x coordinate of the vector.
|
|
625
610
|
#
|
|
626
611
|
# @example
|
|
627
|
-
# vector = Geom::Vector3d.new
|
|
628
|
-
#
|
|
612
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
613
|
+
# vector.x = 10
|
|
629
614
|
#
|
|
630
|
-
# @param [
|
|
615
|
+
# @param [Float] x
|
|
631
616
|
# The x coordinate for the vector.
|
|
632
617
|
#
|
|
633
|
-
# @return [
|
|
618
|
+
# @return [Float] the newly set x coordinate for the vector
|
|
634
619
|
#
|
|
635
620
|
# @version SketchUp 6.0
|
|
636
621
|
def x=(x)
|
|
637
622
|
end
|
|
638
623
|
|
|
639
|
-
# The y method is used to retrieve the y coordinate of the vector.
|
|
624
|
+
# The {#y} method is used to retrieve the y coordinate of the vector.
|
|
640
625
|
#
|
|
641
626
|
# @example
|
|
642
|
-
# vector = Geom::Vector3d.new(1,2,3)
|
|
627
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
643
628
|
# y = vector.y
|
|
644
629
|
#
|
|
645
|
-
# @return [
|
|
630
|
+
# @return [Float] the y coordinate of the vector
|
|
646
631
|
#
|
|
647
632
|
# @version SketchUp 6.0
|
|
648
633
|
def y
|
|
649
634
|
end
|
|
650
635
|
|
|
651
|
-
# Set the y coordinate of the vector.
|
|
636
|
+
# Set the {#y=} coordinate of the vector.
|
|
652
637
|
#
|
|
653
638
|
# @example
|
|
654
|
-
# vector = Geom::Vector3d.new(1,2,3)
|
|
655
|
-
#
|
|
639
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
640
|
+
# vector.y = 10
|
|
656
641
|
#
|
|
657
|
-
# @param [
|
|
642
|
+
# @param [Float] y
|
|
658
643
|
# The y coordinate for the vector.
|
|
659
644
|
#
|
|
660
|
-
# @return [
|
|
645
|
+
# @return [Float] the newly set y coordinate for the vector
|
|
661
646
|
#
|
|
662
647
|
# @version SketchUp 6.0
|
|
663
648
|
def y=(y)
|
|
664
649
|
end
|
|
665
650
|
|
|
666
|
-
# Get the z coordinate of the vector.
|
|
651
|
+
# Get the {#z} coordinate of the vector.
|
|
667
652
|
#
|
|
668
653
|
# @example
|
|
669
|
-
# vector = Geom::Vector3d.new(1,2,3)
|
|
654
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
670
655
|
# z = vector.z
|
|
671
656
|
#
|
|
672
|
-
# @return [
|
|
657
|
+
# @return [Float] the z coordinate of the vector
|
|
673
658
|
#
|
|
674
659
|
# @version SketchUp 6.0
|
|
675
660
|
def z
|
|
676
661
|
end
|
|
677
662
|
|
|
678
|
-
# Set the z coordinate of the vector.
|
|
663
|
+
# Set the {#z=} coordinate of the vector.
|
|
679
664
|
#
|
|
680
665
|
# @example
|
|
681
|
-
# vector = Geom::Vector3d.new(1,2,3)
|
|
682
|
-
#
|
|
666
|
+
# vector = Geom::Vector3d.new(1, 2, 3)
|
|
667
|
+
# vector.z = 10
|
|
683
668
|
#
|
|
684
|
-
# @param [
|
|
669
|
+
# @param [Float] z
|
|
685
670
|
# The z coordinate for the vector.
|
|
686
671
|
#
|
|
687
|
-
# @return [
|
|
672
|
+
# @return [Float] the newly set z coordinate for the vector
|
|
688
673
|
#
|
|
689
674
|
# @version SketchUp 6.0
|
|
690
675
|
def z=(z)
|