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