sketchup-api-stubs 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs.rb +1 -1
- data/lib/sketchup-api-stubs/sketchup.rb +147 -145
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -318
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +498 -492
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -573
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +179 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +515 -514
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -143
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -371
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -220
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -204
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +694 -694
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -140
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +286 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -328
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -577
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +577 -562
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +604 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -194
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +362 -329
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -312
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -38
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +396 -390
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +502 -508
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1126 -1119
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -544
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +126 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +751 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +699 -697
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +417 -409
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -226
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -190
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +405 -393
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -82
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -303
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +327 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -244
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -136
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -416
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +318 -311
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -141
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -95
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1651 -1638
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +131 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -770
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +363 -353
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -456
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +459 -454
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -225
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +835 -829
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -154
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +71 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1307 -1301
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -43
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +317 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +387 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +255 -229
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/geom.rb +351 -348
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
- data/lib/sketchup-api-stubs/stubs/length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +1342 -1310
- data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/string.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/ui.rb +668 -667
- metadata +4 -2
@@ -1,478 +1,478 @@
|
|
1
|
-
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# Transformations are a standard construct in the 3D world for representing
|
5
|
-
# the position, rotation, and sizing of a given entity. In the SketchUp
|
6
|
-
# world, {Sketchup::ComponentInstance} and {Sketchup::Group} have a
|
7
|
-
# +.transformation+ method that reports their current state and various methods
|
8
|
-
# (+.move!+, +transformation=+, etc.) that allow them to be manipulated.
|
9
|
-
#
|
10
|
-
# Use of the transformation class requires a knowledge of geometrical
|
11
|
-
# transformations in 3 dimensions which is covered extensively on
|
12
|
-
# the Internet.
|
13
|
-
#
|
14
|
-
# @version SketchUp 6.0
|
15
|
-
class Geom::Transformation
|
16
|
-
|
17
|
-
# Class Methods
|
18
|
-
|
19
|
-
# The axes method creates a transformation that goes from world coordinates
|
20
|
-
# to an arbitrary coordinate system defined by an origin and three axis
|
21
|
-
# vectors.
|
22
|
-
#
|
23
|
-
# @example
|
24
|
-
# # Creates a transformation that "flips" the axes from XYZ to XZY. Something
|
25
|
-
# # one often need for importers/exporters when dealing with applications
|
26
|
-
# # that threat Y as "up".
|
27
|
-
# tr = Geom::Transformation.axes(ORIGIN, X_AXIS, Z_AXIS, Y_AXIS.reverse)
|
28
|
-
#
|
29
|
-
# @overload axes(origin, xaxis, yaxis, zaxis)
|
30
|
-
#
|
31
|
-
# @param [Geom::Point3d] origin
|
32
|
-
# @param [Geom::Vector3d] xaxis
|
33
|
-
# @param [Geom::Vector3d] yaxis
|
34
|
-
# @param [Geom::Vector3d] zaxis
|
35
|
-
# @return [Geom::Transformation]
|
36
|
-
#
|
37
|
-
# @overload axes(origin, xaxis, yaxis)
|
38
|
-
#
|
39
|
-
# When the Z axis is omitted and arbitrary axis is computed from the X and Y
|
40
|
-
# axes.
|
41
|
-
# @param [Geom::Point3d] origin
|
42
|
-
# @param [Geom::Vector3d] xaxis
|
43
|
-
# @param [Geom::Vector3d] yaxis
|
44
|
-
# @return [Geom::Transformation]
|
45
|
-
#
|
46
|
-
# @raise [ArgumentError] if any of the vectors are zero length.
|
47
|
-
#
|
48
|
-
# @version SketchUp 6.0
|
49
|
-
def self.axes(*args)
|
50
|
-
end
|
51
|
-
|
52
|
-
# The interpolate method is used to create a new transformation that is the
|
53
|
-
# result of interpolating between two other transformations.
|
54
|
-
#
|
55
|
-
# Parameter is a weight (between 0.0 and 1.0) that identifies whether to favor
|
56
|
-
# transformation1 or transformation2.
|
57
|
-
#
|
58
|
-
# @example
|
59
|
-
# origin = Geom::Point3d.new(0, 0, 0)
|
60
|
-
# x = Geom::Vector3d.new(0, 1, 0)
|
61
|
-
# y = Geom::Vector3d.new(1, 0, 0)
|
62
|
-
# z = Geom::Vector3d.new(0, 0, 1)
|
63
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
64
|
-
# t1 = Geom::Transformation.new(point)
|
65
|
-
# t2 = Geom::Transformation.axes(origin, x, y, z)
|
66
|
-
# # This produce a transformation that is a mix of 75% t1 and 25% t2.
|
67
|
-
# t3 = Geom::Transformation.interpolate(t1, t2, 0.25)
|
68
|
-
#
|
69
|
-
# @param [Geom::Transformation] transform1
|
70
|
-
#
|
71
|
-
# @param [Geom::Transformation] transform2
|
72
|
-
#
|
73
|
-
# @param [Float] weight
|
74
|
-
# A value between 0.0 and 1.0 (see comments).
|
75
|
-
#
|
76
|
-
# @return [Geom::Transformation]
|
77
|
-
#
|
78
|
-
# @version SketchUp 6.0
|
79
|
-
def self.interpolate(transform1, transform2, weight)
|
80
|
-
end
|
81
|
-
|
82
|
-
# The rotation method is used to create a transformation that does rotation
|
83
|
-
# about an axis.
|
84
|
-
#
|
85
|
-
# The axis is defined by a point and a vector. The angle is given in radians.
|
86
|
-
#
|
87
|
-
# @example
|
88
|
-
# point = Geom::Point3d.new(10, 20, 0)
|
89
|
-
# vector = Geom::Vector3d.new(0, 0, 1)
|
90
|
-
# angle = 45.degrees # Return 45 degrees in radians.
|
91
|
-
# transformation = Geom::Transformation.rotation(point, vector, angle)
|
92
|
-
#
|
93
|
-
# @param [Geom::Point3d] point
|
94
|
-
#
|
95
|
-
# @param [Geom::Vector3d] vector
|
96
|
-
#
|
97
|
-
# @param [Float] angle
|
98
|
-
# The angle in radians.
|
99
|
-
#
|
100
|
-
# @return [Geom::Transformation]
|
101
|
-
#
|
102
|
-
# @version SketchUp 6.0
|
103
|
-
def self.rotation(point, vector, angle)
|
104
|
-
end
|
105
|
-
|
106
|
-
# The scaling method is used to create a transformation that does scaling.
|
107
|
-
#
|
108
|
-
# @example
|
109
|
-
# point = Geom::Point3d.new(20, 30, 0)
|
110
|
-
# scale = 10
|
111
|
-
# tr = Geom::Transformation.scaling(point, scale)
|
112
|
-
#
|
113
|
-
# @overload scaling(scale)
|
114
|
-
#
|
115
|
-
# @note This has been fixed in SketchUp 2018 but in previous versions it
|
116
|
-
# might yield an unexpected transformation. It sets the 16th value
|
117
|
-
# to the scaling factor. Something not all extensions reading the
|
118
|
-
# transformation expects. Consider using +scaling(xscale, yscale, zscale)+
|
119
|
-
# instead.
|
120
|
-
# With one argument, it does a uniform scale about the origin.
|
121
|
-
# @param [Float] scale The global scale factor for the transform.
|
122
|
-
# @return [Geom::Transformation]
|
123
|
-
#
|
124
|
-
# @overload scaling(xscale, yscale, zscale)
|
125
|
-
#
|
126
|
-
# With three arguments, it does a non-uniform scale about the origin.
|
127
|
-
# @param [Float] xscale The scale factor in the x direction for the transform.
|
128
|
-
# @param [Float] yscale The scale factor in the y direction for the transform.
|
129
|
-
# @param [Float] zscale The scale factor in the z direction for the transform.
|
130
|
-
# @return [Geom::Transformation]
|
131
|
-
#
|
132
|
-
# @overload scaling(point, scale)
|
133
|
-
#
|
134
|
-
# With two arguments, it does a uniform scale about an arbitrary point.
|
135
|
-
# @param [Geom::Point3d] point
|
136
|
-
# @param [Float] scale The global scale factor for the transform.
|
137
|
-
# @return [Geom::Transformation]
|
138
|
-
#
|
139
|
-
# @overload scaling(point, xscale, yscale, zscale)
|
140
|
-
#
|
141
|
-
# With four arguments it does a non-uniform scale about an arbitrary point.
|
142
|
-
# @param [Geom::Point3d] point
|
143
|
-
# @param [Float] xscale The scale factor in the x direction for the transform.
|
144
|
-
# @param [Float] yscale The scale factor in the y direction for the transform.
|
145
|
-
# @param [Float] zscale The scale factor in the z direction for the transform.
|
146
|
-
# @return [Geom::Transformation]
|
147
|
-
#
|
148
|
-
# @version SketchUp 6.0
|
149
|
-
def self.scaling(*args)
|
150
|
-
end
|
151
|
-
|
152
|
-
# The translation method is used to create a transformation that does
|
153
|
-
# translation.
|
154
|
-
#
|
155
|
-
# @example
|
156
|
-
# vector = Geom::Vector3d.new(0, 1, 0)
|
157
|
-
# tr = Geom::Transformation.translation(vector)
|
158
|
-
#
|
159
|
-
# @overload translation(vector)
|
160
|
-
#
|
161
|
-
# @param [Geom::Vector3d] vector
|
162
|
-
# @return [Geom::Transformation]
|
163
|
-
#
|
164
|
-
# @overload translation(point)
|
165
|
-
#
|
166
|
-
# @param [Geom::Point3d] point
|
167
|
-
# @return [Geom::Transformation]
|
168
|
-
#
|
169
|
-
# @version SketchUp 6.0
|
170
|
-
def self.translation(arg)
|
171
|
-
end
|
172
|
-
|
173
|
-
# Instance Methods
|
174
|
-
|
175
|
-
# The {#*} method is used to do matrix multiplication using the transform.
|
176
|
-
#
|
177
|
-
# @example
|
178
|
-
# point1 = Geom::Point3d.new(10, 20, 30)
|
179
|
-
# point2 = Geom::Point3d.new(2, 2, 2)
|
180
|
-
# tr = Geom::Transformation.new(point1)
|
181
|
-
# # Returns Point3d(12, 22, 32)
|
182
|
-
# point3 = tr * point2
|
183
|
-
#
|
184
|
-
# @overload *(point)
|
185
|
-
#
|
186
|
-
# @param [Geom::Point3d] point
|
187
|
-
# @return [Geom::Point3d]
|
188
|
-
#
|
189
|
-
# @overload *(vector)
|
190
|
-
#
|
191
|
-
# @param [Geom::Vector3d] vector
|
192
|
-
# @return [Geom::Vector3d]
|
193
|
-
#
|
194
|
-
# @overload *(transformation)
|
195
|
-
#
|
196
|
-
# @param [Geom::Transformation] transformation
|
197
|
-
# @return [Geom::Transformation]
|
198
|
-
#
|
199
|
-
# @overload *(point)
|
200
|
-
#
|
201
|
-
# @param [Array<Float, Float, Float>] point
|
202
|
-
# @return [Array<Float, Float, Float>]
|
203
|
-
#
|
204
|
-
# @overload *(plane)
|
205
|
-
#
|
206
|
-
# @param [Array<Geom::Point3d, Geom::Vector3d>] plane
|
207
|
-
# @return [Array<Float, Float, Float, Float>] transformed plane
|
208
|
-
#
|
209
|
-
# @overload *(plane)
|
210
|
-
#
|
211
|
-
# @param [Array<Float, Float, Float, Float>] plane
|
212
|
-
# @return [Array<Float, Float, Float, Float>] transformed plane
|
213
|
-
#
|
214
|
-
# @version SketchUp 6.0
|
215
|
-
def *(arg)
|
216
|
-
end
|
217
|
-
|
218
|
-
# The {#clone} method is used to create a copy of a transformation.
|
219
|
-
#
|
220
|
-
# @example
|
221
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
222
|
-
# tr1 = Geom::Transformation.new(point)
|
223
|
-
# tr2 = tr1.clone
|
224
|
-
#
|
225
|
-
# @return [Geom::Transformation]
|
226
|
-
#
|
227
|
-
# @version SketchUp 6.0
|
228
|
-
def clone
|
229
|
-
end
|
230
|
-
|
231
|
-
# The {#identity?} method is used to determine if a transformation is the
|
232
|
-
# {IDENTITY} transform.
|
233
|
-
#
|
234
|
-
# @example
|
235
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
236
|
-
# tr = Geom::Transformation.new(point)
|
237
|
-
# # Returns false.
|
238
|
-
# status = tr.identity?
|
239
|
-
#
|
240
|
-
# @example
|
241
|
-
# tr = Geom::Transformation.new(ORIGIN)
|
242
|
-
# # Returns false.
|
243
|
-
# status = tr.identity?
|
244
|
-
#
|
245
|
-
# @example
|
246
|
-
# tr = Geom::Transformation.new
|
247
|
-
# # Returns true.
|
248
|
-
# status = tr.identity?
|
249
|
-
#
|
250
|
-
# @example
|
251
|
-
# # Returns true.
|
252
|
-
# status = IDENTITY.identity?
|
253
|
-
#
|
254
|
-
# @note As of SketchUp 2018, this now looks at the data to determine if the
|
255
|
-
# transformation is identity. Prior to SU2018, this only looks at the flag to
|
256
|
-
# see if the transform has not been modified. If the transform has been
|
257
|
-
# changed, this will return false even if it is really the identity.
|
258
|
-
#
|
259
|
-
# @return [Boolean] +true+ if the transformation is the identity
|
260
|
-
#
|
261
|
-
# @version SketchUp 6.0
|
262
|
-
def identity?
|
263
|
-
end
|
264
|
-
|
265
|
-
# The new method is used to create a new transformation.
|
266
|
-
#
|
267
|
-
# You can use this method or one of the more specific methods for creating
|
268
|
-
# specific kinds of Transformations.
|
269
|
-
#
|
270
|
-
# @example
|
271
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
272
|
-
# tr = Geom::Transformation.new(point)
|
273
|
-
#
|
274
|
-
# @overload initialize
|
275
|
-
#
|
276
|
-
# @return [Geom::Transformation] identity Transformation.
|
277
|
-
#
|
278
|
-
# @overload initialize(point)
|
279
|
-
#
|
280
|
-
# Translates the origin to point.
|
281
|
-
# @param [Geom::Point3d] point
|
282
|
-
# @return [Geom::Transformation]
|
283
|
-
#
|
284
|
-
# @overload initialize(vector)
|
285
|
-
#
|
286
|
-
# @param [Geom::Vector3d] vector
|
287
|
-
# @return [Geom::Transformation]
|
288
|
-
#
|
289
|
-
# @overload initialize(transform)
|
290
|
-
#
|
291
|
-
# Creates a Transformation that is a copy of another Transformation. This is
|
292
|
-
# equivalent to {#clone}.
|
293
|
-
# @param [Geom::Transformation] transform
|
294
|
-
# @return [Geom::Transformation]
|
295
|
-
#
|
296
|
-
# @overload initialize(array)
|
297
|
-
#
|
298
|
-
# @param [Array<Float>] Creates a Transformation from a 16 element Array.
|
299
|
-
# @return [Geom::Transformation]
|
300
|
-
#
|
301
|
-
# @overload initialize(scale)
|
302
|
-
#
|
303
|
-
# Creates a transformation that does uniform scaling.
|
304
|
-
# @note Versions prior to SU2018 would produce transformations which
|
305
|
-
# didn't always work right in SketchUp. See {.scaling} for more info.
|
306
|
-
# @param [Float] scale
|
307
|
-
# @return [Geom::Transformation]
|
308
|
-
#
|
309
|
-
# @overload initialize(origin, zaxis)
|
310
|
-
#
|
311
|
-
# Creates a Transformation where origin is the new origin, and zaxis is the
|
312
|
-
# z axis. The x and y axes are determined using an arbitrary axis rule.
|
313
|
-
# @param [Geom::Point3d] origin
|
314
|
-
# @param [Geom::Vector3d] zaxis
|
315
|
-
# @return [Geom::Transformation]
|
316
|
-
#
|
317
|
-
# @overload initialize(origin, xaxis, yaxis)
|
318
|
-
#
|
319
|
-
# Creates a Transformation given a new origin, x axis and y axis.
|
320
|
-
# @param [Geom::Point3d] origin
|
321
|
-
# @param [Geom::Vector3d] xaxis
|
322
|
-
# @param [Geom::Vector3d] yaxis
|
323
|
-
# @return [Geom::Transformation]
|
324
|
-
#
|
325
|
-
# @overload initialize(pt, axis, angle)
|
326
|
-
#
|
327
|
-
# Creates a Transformation that rotates by angle (given in radians) about a
|
328
|
-
# line defined by pt and axis.
|
329
|
-
# @param [Geom::Point3d] origin
|
330
|
-
# @param [Geom::Vector3d] axis
|
331
|
-
# @param [Float] angle
|
332
|
-
# @return [Geom::Transformation]
|
333
|
-
#
|
334
|
-
# @overload initialize(xaxis, yaxis, zaxis, origin)
|
335
|
-
#
|
336
|
-
# @param [Geom::Vector3d] xaxis
|
337
|
-
# @param [Geom::Vector3d] yaxis
|
338
|
-
# @param [Geom::Vector3d] zaxis
|
339
|
-
# @param [Geom::Point3d] origin
|
340
|
-
# @return [Geom::Transformation]
|
341
|
-
#
|
342
|
-
# @version SketchUp 6.0
|
343
|
-
def initialize(*args)
|
344
|
-
end
|
345
|
-
|
346
|
-
# The {#inverse} method is used to retrieve the inverse of a transformation.
|
347
|
-
#
|
348
|
-
# @example
|
349
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
350
|
-
# tr1 = Geom::Transformation.new(point)
|
351
|
-
# tr2 = tr1.inverse
|
352
|
-
#
|
353
|
-
# @return [Geom::Transformation]
|
354
|
-
#
|
355
|
-
# @version SketchUp 6.0
|
356
|
-
def inverse
|
357
|
-
end
|
358
|
-
|
359
|
-
# The {#invert!} method sets the transformation to its inverse.
|
360
|
-
#
|
361
|
-
# @example
|
362
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
363
|
-
# tr = Geom::Transformation.new(point)
|
364
|
-
# tr.invert!
|
365
|
-
#
|
366
|
-
# @return [Geom::Transformation]
|
367
|
-
#
|
368
|
-
# @version SketchUp 6.0
|
369
|
-
def invert!
|
370
|
-
end
|
371
|
-
|
372
|
-
# The {#origin} method retrieves the origin of a rigid transformation.
|
373
|
-
#
|
374
|
-
# @example
|
375
|
-
# point1 = Geom::Point3d.new(10, 20, 30)
|
376
|
-
# tr = Geom::Transformation.new(point1)
|
377
|
-
# point2 = tr.origin
|
378
|
-
#
|
379
|
-
# @return [Geom::Point3d] the origin of the transformation.
|
380
|
-
#
|
381
|
-
# @version SketchUp 6.0
|
382
|
-
def origin
|
383
|
-
end
|
384
|
-
|
385
|
-
# The {#set!} method is used to set this transformation to match another one.
|
386
|
-
#
|
387
|
-
# The argument is anything that can be converted into a transformation.
|
388
|
-
#
|
389
|
-
# @example
|
390
|
-
# point1 = Geom::Point3d.new(10, 20, 30)
|
391
|
-
# tr1 = Geom::Transformation.new(point)
|
392
|
-
# point2 = Geom::Point3d.new(60, 40, 70)
|
393
|
-
# tr1.set!(point2)
|
394
|
-
#
|
395
|
-
# @overload set!(transformation)
|
396
|
-
#
|
397
|
-
# @param [Geom::Transformation] transformation
|
398
|
-
# @return [Geom::Transformation]
|
399
|
-
#
|
400
|
-
# @overload set!(point)
|
401
|
-
#
|
402
|
-
# @param [Geom::Point3d] point
|
403
|
-
# @return [Geom::Transformation]
|
404
|
-
#
|
405
|
-
# @overload set!(vector)
|
406
|
-
#
|
407
|
-
# @param [Geom::Vector3d] vector
|
408
|
-
# @return [Geom::Transformation]
|
409
|
-
#
|
410
|
-
# @overload set!(matrix)
|
411
|
-
#
|
412
|
-
# @param [Array<Float>] matrix Array of 16 floats.
|
413
|
-
# @return [Geom::Transformation]
|
414
|
-
#
|
415
|
-
# @overload set!(scale)
|
416
|
-
#
|
417
|
-
# @param [Float] scale
|
418
|
-
# @return [Geom::Transformation]
|
419
|
-
#
|
420
|
-
# @version SketchUp 6.0
|
421
|
-
def set!(arg)
|
422
|
-
end
|
423
|
-
|
424
|
-
# The {#to_a} method retrieves a 16 element array which contains the values that
|
425
|
-
# define the transformation.
|
426
|
-
#
|
427
|
-
# @example
|
428
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
429
|
-
# tr = Geom::Transformation.new(point)
|
430
|
-
# # This splits the 16 items into a string of 4x4 elements for easier reading.
|
431
|
-
# str4x4 = tr.to_a.each_slice(4).inject { |str, row| "#{str}\r\n#{row}" }
|
432
|
-
#
|
433
|
-
# @return [Array<Float>]
|
434
|
-
#
|
435
|
-
# @version SketchUp 6.0
|
436
|
-
def to_a
|
437
|
-
end
|
438
|
-
|
439
|
-
# The {#xaxis} method retrieves the x axis of a rigid transformation.
|
440
|
-
#
|
441
|
-
# @example
|
442
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
443
|
-
# tr = Geom::Transformation.new(point)
|
444
|
-
# x = tr.xaxis
|
445
|
-
#
|
446
|
-
# @return [Geom::Vector3d]
|
447
|
-
#
|
448
|
-
# @version SketchUp 6.0
|
449
|
-
def xaxis
|
450
|
-
end
|
451
|
-
|
452
|
-
# The {#yaxis} method retrieves the y axis of a rigid transformation.
|
453
|
-
#
|
454
|
-
# @example
|
455
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
456
|
-
# tr = Geom::Transformation.new(point)
|
457
|
-
# x = tr.yaxis
|
458
|
-
#
|
459
|
-
# @return [Geom::Vector3d]
|
460
|
-
#
|
461
|
-
# @version SketchUp 6.0
|
462
|
-
def yaxis
|
463
|
-
end
|
464
|
-
|
465
|
-
# The {#zaxis} method retrieves the z axis of a rigid transformation.
|
466
|
-
#
|
467
|
-
# @example
|
468
|
-
# point = Geom::Point3d.new(10, 20, 30)
|
469
|
-
# tr = Geom::Transformation.new(point)
|
470
|
-
# x = tr.zaxis
|
471
|
-
#
|
472
|
-
# @return [Geom::Vector3d]
|
473
|
-
#
|
474
|
-
# @version SketchUp 6.0
|
475
|
-
def zaxis
|
476
|
-
end
|
477
|
-
|
478
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# Transformations are a standard construct in the 3D world for representing
|
5
|
+
# the position, rotation, and sizing of a given entity. In the SketchUp
|
6
|
+
# world, {Sketchup::ComponentInstance} and {Sketchup::Group} have a
|
7
|
+
# +.transformation+ method that reports their current state and various methods
|
8
|
+
# (+.move!+, +transformation=+, etc.) that allow them to be manipulated.
|
9
|
+
#
|
10
|
+
# Use of the transformation class requires a knowledge of geometrical
|
11
|
+
# transformations in 3 dimensions which is covered extensively on
|
12
|
+
# the Internet.
|
13
|
+
#
|
14
|
+
# @version SketchUp 6.0
|
15
|
+
class Geom::Transformation
|
16
|
+
|
17
|
+
# Class Methods
|
18
|
+
|
19
|
+
# The axes method creates a transformation that goes from world coordinates
|
20
|
+
# to an arbitrary coordinate system defined by an origin and three axis
|
21
|
+
# vectors.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# # Creates a transformation that "flips" the axes from XYZ to XZY. Something
|
25
|
+
# # one often need for importers/exporters when dealing with applications
|
26
|
+
# # that threat Y as "up".
|
27
|
+
# tr = Geom::Transformation.axes(ORIGIN, X_AXIS, Z_AXIS, Y_AXIS.reverse)
|
28
|
+
#
|
29
|
+
# @overload axes(origin, xaxis, yaxis, zaxis)
|
30
|
+
#
|
31
|
+
# @param [Geom::Point3d] origin
|
32
|
+
# @param [Geom::Vector3d] xaxis
|
33
|
+
# @param [Geom::Vector3d] yaxis
|
34
|
+
# @param [Geom::Vector3d] zaxis
|
35
|
+
# @return [Geom::Transformation]
|
36
|
+
#
|
37
|
+
# @overload axes(origin, xaxis, yaxis)
|
38
|
+
#
|
39
|
+
# When the Z axis is omitted and arbitrary axis is computed from the X and Y
|
40
|
+
# axes.
|
41
|
+
# @param [Geom::Point3d] origin
|
42
|
+
# @param [Geom::Vector3d] xaxis
|
43
|
+
# @param [Geom::Vector3d] yaxis
|
44
|
+
# @return [Geom::Transformation]
|
45
|
+
#
|
46
|
+
# @raise [ArgumentError] if any of the vectors are zero length.
|
47
|
+
#
|
48
|
+
# @version SketchUp 6.0
|
49
|
+
def self.axes(*args)
|
50
|
+
end
|
51
|
+
|
52
|
+
# The interpolate method is used to create a new transformation that is the
|
53
|
+
# result of interpolating between two other transformations.
|
54
|
+
#
|
55
|
+
# Parameter is a weight (between 0.0 and 1.0) that identifies whether to favor
|
56
|
+
# transformation1 or transformation2.
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# origin = Geom::Point3d.new(0, 0, 0)
|
60
|
+
# x = Geom::Vector3d.new(0, 1, 0)
|
61
|
+
# y = Geom::Vector3d.new(1, 0, 0)
|
62
|
+
# z = Geom::Vector3d.new(0, 0, 1)
|
63
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
64
|
+
# t1 = Geom::Transformation.new(point)
|
65
|
+
# t2 = Geom::Transformation.axes(origin, x, y, z)
|
66
|
+
# # This produce a transformation that is a mix of 75% t1 and 25% t2.
|
67
|
+
# t3 = Geom::Transformation.interpolate(t1, t2, 0.25)
|
68
|
+
#
|
69
|
+
# @param [Geom::Transformation] transform1
|
70
|
+
#
|
71
|
+
# @param [Geom::Transformation] transform2
|
72
|
+
#
|
73
|
+
# @param [Float] weight
|
74
|
+
# A value between 0.0 and 1.0 (see comments).
|
75
|
+
#
|
76
|
+
# @return [Geom::Transformation]
|
77
|
+
#
|
78
|
+
# @version SketchUp 6.0
|
79
|
+
def self.interpolate(transform1, transform2, weight)
|
80
|
+
end
|
81
|
+
|
82
|
+
# The rotation method is used to create a transformation that does rotation
|
83
|
+
# about an axis.
|
84
|
+
#
|
85
|
+
# The axis is defined by a point and a vector. The angle is given in radians.
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# point = Geom::Point3d.new(10, 20, 0)
|
89
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
90
|
+
# angle = 45.degrees # Return 45 degrees in radians.
|
91
|
+
# transformation = Geom::Transformation.rotation(point, vector, angle)
|
92
|
+
#
|
93
|
+
# @param [Geom::Point3d] point
|
94
|
+
#
|
95
|
+
# @param [Geom::Vector3d] vector
|
96
|
+
#
|
97
|
+
# @param [Float] angle
|
98
|
+
# The angle in radians.
|
99
|
+
#
|
100
|
+
# @return [Geom::Transformation]
|
101
|
+
#
|
102
|
+
# @version SketchUp 6.0
|
103
|
+
def self.rotation(point, vector, angle)
|
104
|
+
end
|
105
|
+
|
106
|
+
# The scaling method is used to create a transformation that does scaling.
|
107
|
+
#
|
108
|
+
# @example
|
109
|
+
# point = Geom::Point3d.new(20, 30, 0)
|
110
|
+
# scale = 10
|
111
|
+
# tr = Geom::Transformation.scaling(point, scale)
|
112
|
+
#
|
113
|
+
# @overload scaling(scale)
|
114
|
+
#
|
115
|
+
# @note This has been fixed in SketchUp 2018 but in previous versions it
|
116
|
+
# might yield an unexpected transformation. It sets the 16th value
|
117
|
+
# to the scaling factor. Something not all extensions reading the
|
118
|
+
# transformation expects. Consider using +scaling(xscale, yscale, zscale)+
|
119
|
+
# instead.
|
120
|
+
# With one argument, it does a uniform scale about the origin.
|
121
|
+
# @param [Float] scale The global scale factor for the transform.
|
122
|
+
# @return [Geom::Transformation]
|
123
|
+
#
|
124
|
+
# @overload scaling(xscale, yscale, zscale)
|
125
|
+
#
|
126
|
+
# With three arguments, it does a non-uniform scale about the origin.
|
127
|
+
# @param [Float] xscale The scale factor in the x direction for the transform.
|
128
|
+
# @param [Float] yscale The scale factor in the y direction for the transform.
|
129
|
+
# @param [Float] zscale The scale factor in the z direction for the transform.
|
130
|
+
# @return [Geom::Transformation]
|
131
|
+
#
|
132
|
+
# @overload scaling(point, scale)
|
133
|
+
#
|
134
|
+
# With two arguments, it does a uniform scale about an arbitrary point.
|
135
|
+
# @param [Geom::Point3d] point
|
136
|
+
# @param [Float] scale The global scale factor for the transform.
|
137
|
+
# @return [Geom::Transformation]
|
138
|
+
#
|
139
|
+
# @overload scaling(point, xscale, yscale, zscale)
|
140
|
+
#
|
141
|
+
# With four arguments it does a non-uniform scale about an arbitrary point.
|
142
|
+
# @param [Geom::Point3d] point
|
143
|
+
# @param [Float] xscale The scale factor in the x direction for the transform.
|
144
|
+
# @param [Float] yscale The scale factor in the y direction for the transform.
|
145
|
+
# @param [Float] zscale The scale factor in the z direction for the transform.
|
146
|
+
# @return [Geom::Transformation]
|
147
|
+
#
|
148
|
+
# @version SketchUp 6.0
|
149
|
+
def self.scaling(*args)
|
150
|
+
end
|
151
|
+
|
152
|
+
# The translation method is used to create a transformation that does
|
153
|
+
# translation.
|
154
|
+
#
|
155
|
+
# @example
|
156
|
+
# vector = Geom::Vector3d.new(0, 1, 0)
|
157
|
+
# tr = Geom::Transformation.translation(vector)
|
158
|
+
#
|
159
|
+
# @overload translation(vector)
|
160
|
+
#
|
161
|
+
# @param [Geom::Vector3d] vector
|
162
|
+
# @return [Geom::Transformation]
|
163
|
+
#
|
164
|
+
# @overload translation(point)
|
165
|
+
#
|
166
|
+
# @param [Geom::Point3d] point
|
167
|
+
# @return [Geom::Transformation]
|
168
|
+
#
|
169
|
+
# @version SketchUp 6.0
|
170
|
+
def self.translation(arg)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Instance Methods
|
174
|
+
|
175
|
+
# The {#*} method is used to do matrix multiplication using the transform.
|
176
|
+
#
|
177
|
+
# @example
|
178
|
+
# point1 = Geom::Point3d.new(10, 20, 30)
|
179
|
+
# point2 = Geom::Point3d.new(2, 2, 2)
|
180
|
+
# tr = Geom::Transformation.new(point1)
|
181
|
+
# # Returns Point3d(12, 22, 32)
|
182
|
+
# point3 = tr * point2
|
183
|
+
#
|
184
|
+
# @overload *(point)
|
185
|
+
#
|
186
|
+
# @param [Geom::Point3d] point
|
187
|
+
# @return [Geom::Point3d]
|
188
|
+
#
|
189
|
+
# @overload *(vector)
|
190
|
+
#
|
191
|
+
# @param [Geom::Vector3d] vector
|
192
|
+
# @return [Geom::Vector3d]
|
193
|
+
#
|
194
|
+
# @overload *(transformation)
|
195
|
+
#
|
196
|
+
# @param [Geom::Transformation] transformation
|
197
|
+
# @return [Geom::Transformation]
|
198
|
+
#
|
199
|
+
# @overload *(point)
|
200
|
+
#
|
201
|
+
# @param [Array<Float, Float, Float>] point
|
202
|
+
# @return [Array<Float, Float, Float>]
|
203
|
+
#
|
204
|
+
# @overload *(plane)
|
205
|
+
#
|
206
|
+
# @param [Array<Geom::Point3d, Geom::Vector3d>] plane
|
207
|
+
# @return [Array<Float, Float, Float, Float>] transformed plane
|
208
|
+
#
|
209
|
+
# @overload *(plane)
|
210
|
+
#
|
211
|
+
# @param [Array<Float, Float, Float, Float>] plane
|
212
|
+
# @return [Array<Float, Float, Float, Float>] transformed plane
|
213
|
+
#
|
214
|
+
# @version SketchUp 6.0
|
215
|
+
def *(arg)
|
216
|
+
end
|
217
|
+
|
218
|
+
# The {#clone} method is used to create a copy of a transformation.
|
219
|
+
#
|
220
|
+
# @example
|
221
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
222
|
+
# tr1 = Geom::Transformation.new(point)
|
223
|
+
# tr2 = tr1.clone
|
224
|
+
#
|
225
|
+
# @return [Geom::Transformation]
|
226
|
+
#
|
227
|
+
# @version SketchUp 6.0
|
228
|
+
def clone
|
229
|
+
end
|
230
|
+
|
231
|
+
# The {#identity?} method is used to determine if a transformation is the
|
232
|
+
# {IDENTITY} transform.
|
233
|
+
#
|
234
|
+
# @example
|
235
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
236
|
+
# tr = Geom::Transformation.new(point)
|
237
|
+
# # Returns false.
|
238
|
+
# status = tr.identity?
|
239
|
+
#
|
240
|
+
# @example
|
241
|
+
# tr = Geom::Transformation.new(ORIGIN)
|
242
|
+
# # Returns false.
|
243
|
+
# status = tr.identity?
|
244
|
+
#
|
245
|
+
# @example
|
246
|
+
# tr = Geom::Transformation.new
|
247
|
+
# # Returns true.
|
248
|
+
# status = tr.identity?
|
249
|
+
#
|
250
|
+
# @example
|
251
|
+
# # Returns true.
|
252
|
+
# status = IDENTITY.identity?
|
253
|
+
#
|
254
|
+
# @note As of SketchUp 2018, this now looks at the data to determine if the
|
255
|
+
# transformation is identity. Prior to SU2018, this only looks at the flag to
|
256
|
+
# see if the transform has not been modified. If the transform has been
|
257
|
+
# changed, this will return false even if it is really the identity.
|
258
|
+
#
|
259
|
+
# @return [Boolean] +true+ if the transformation is the identity
|
260
|
+
#
|
261
|
+
# @version SketchUp 6.0
|
262
|
+
def identity?
|
263
|
+
end
|
264
|
+
|
265
|
+
# The new method is used to create a new transformation.
|
266
|
+
#
|
267
|
+
# You can use this method or one of the more specific methods for creating
|
268
|
+
# specific kinds of Transformations.
|
269
|
+
#
|
270
|
+
# @example
|
271
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
272
|
+
# tr = Geom::Transformation.new(point)
|
273
|
+
#
|
274
|
+
# @overload initialize
|
275
|
+
#
|
276
|
+
# @return [Geom::Transformation] identity Transformation.
|
277
|
+
#
|
278
|
+
# @overload initialize(point)
|
279
|
+
#
|
280
|
+
# Translates the origin to point.
|
281
|
+
# @param [Geom::Point3d] point
|
282
|
+
# @return [Geom::Transformation]
|
283
|
+
#
|
284
|
+
# @overload initialize(vector)
|
285
|
+
#
|
286
|
+
# @param [Geom::Vector3d] vector
|
287
|
+
# @return [Geom::Transformation]
|
288
|
+
#
|
289
|
+
# @overload initialize(transform)
|
290
|
+
#
|
291
|
+
# Creates a Transformation that is a copy of another Transformation. This is
|
292
|
+
# equivalent to {#clone}.
|
293
|
+
# @param [Geom::Transformation] transform
|
294
|
+
# @return [Geom::Transformation]
|
295
|
+
#
|
296
|
+
# @overload initialize(array)
|
297
|
+
#
|
298
|
+
# @param [Array<Float>] Creates a Transformation from a 16 element Array.
|
299
|
+
# @return [Geom::Transformation]
|
300
|
+
#
|
301
|
+
# @overload initialize(scale)
|
302
|
+
#
|
303
|
+
# Creates a transformation that does uniform scaling.
|
304
|
+
# @note Versions prior to SU2018 would produce transformations which
|
305
|
+
# didn't always work right in SketchUp. See {.scaling} for more info.
|
306
|
+
# @param [Float] scale
|
307
|
+
# @return [Geom::Transformation]
|
308
|
+
#
|
309
|
+
# @overload initialize(origin, zaxis)
|
310
|
+
#
|
311
|
+
# Creates a Transformation where origin is the new origin, and zaxis is the
|
312
|
+
# z axis. The x and y axes are determined using an arbitrary axis rule.
|
313
|
+
# @param [Geom::Point3d] origin
|
314
|
+
# @param [Geom::Vector3d] zaxis
|
315
|
+
# @return [Geom::Transformation]
|
316
|
+
#
|
317
|
+
# @overload initialize(origin, xaxis, yaxis)
|
318
|
+
#
|
319
|
+
# Creates a Transformation given a new origin, x axis and y axis.
|
320
|
+
# @param [Geom::Point3d] origin
|
321
|
+
# @param [Geom::Vector3d] xaxis
|
322
|
+
# @param [Geom::Vector3d] yaxis
|
323
|
+
# @return [Geom::Transformation]
|
324
|
+
#
|
325
|
+
# @overload initialize(pt, axis, angle)
|
326
|
+
#
|
327
|
+
# Creates a Transformation that rotates by angle (given in radians) about a
|
328
|
+
# line defined by pt and axis.
|
329
|
+
# @param [Geom::Point3d] origin
|
330
|
+
# @param [Geom::Vector3d] axis
|
331
|
+
# @param [Float] angle
|
332
|
+
# @return [Geom::Transformation]
|
333
|
+
#
|
334
|
+
# @overload initialize(xaxis, yaxis, zaxis, origin)
|
335
|
+
#
|
336
|
+
# @param [Geom::Vector3d] xaxis
|
337
|
+
# @param [Geom::Vector3d] yaxis
|
338
|
+
# @param [Geom::Vector3d] zaxis
|
339
|
+
# @param [Geom::Point3d] origin
|
340
|
+
# @return [Geom::Transformation]
|
341
|
+
#
|
342
|
+
# @version SketchUp 6.0
|
343
|
+
def initialize(*args)
|
344
|
+
end
|
345
|
+
|
346
|
+
# The {#inverse} method is used to retrieve the inverse of a transformation.
|
347
|
+
#
|
348
|
+
# @example
|
349
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
350
|
+
# tr1 = Geom::Transformation.new(point)
|
351
|
+
# tr2 = tr1.inverse
|
352
|
+
#
|
353
|
+
# @return [Geom::Transformation]
|
354
|
+
#
|
355
|
+
# @version SketchUp 6.0
|
356
|
+
def inverse
|
357
|
+
end
|
358
|
+
|
359
|
+
# The {#invert!} method sets the transformation to its inverse.
|
360
|
+
#
|
361
|
+
# @example
|
362
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
363
|
+
# tr = Geom::Transformation.new(point)
|
364
|
+
# tr.invert!
|
365
|
+
#
|
366
|
+
# @return [Geom::Transformation]
|
367
|
+
#
|
368
|
+
# @version SketchUp 6.0
|
369
|
+
def invert!
|
370
|
+
end
|
371
|
+
|
372
|
+
# The {#origin} method retrieves the origin of a rigid transformation.
|
373
|
+
#
|
374
|
+
# @example
|
375
|
+
# point1 = Geom::Point3d.new(10, 20, 30)
|
376
|
+
# tr = Geom::Transformation.new(point1)
|
377
|
+
# point2 = tr.origin
|
378
|
+
#
|
379
|
+
# @return [Geom::Point3d] the origin of the transformation.
|
380
|
+
#
|
381
|
+
# @version SketchUp 6.0
|
382
|
+
def origin
|
383
|
+
end
|
384
|
+
|
385
|
+
# The {#set!} method is used to set this transformation to match another one.
|
386
|
+
#
|
387
|
+
# The argument is anything that can be converted into a transformation.
|
388
|
+
#
|
389
|
+
# @example
|
390
|
+
# point1 = Geom::Point3d.new(10, 20, 30)
|
391
|
+
# tr1 = Geom::Transformation.new(point)
|
392
|
+
# point2 = Geom::Point3d.new(60, 40, 70)
|
393
|
+
# tr1.set!(point2)
|
394
|
+
#
|
395
|
+
# @overload set!(transformation)
|
396
|
+
#
|
397
|
+
# @param [Geom::Transformation] transformation
|
398
|
+
# @return [Geom::Transformation]
|
399
|
+
#
|
400
|
+
# @overload set!(point)
|
401
|
+
#
|
402
|
+
# @param [Geom::Point3d] point
|
403
|
+
# @return [Geom::Transformation]
|
404
|
+
#
|
405
|
+
# @overload set!(vector)
|
406
|
+
#
|
407
|
+
# @param [Geom::Vector3d] vector
|
408
|
+
# @return [Geom::Transformation]
|
409
|
+
#
|
410
|
+
# @overload set!(matrix)
|
411
|
+
#
|
412
|
+
# @param [Array<Float>] matrix Array of 16 floats.
|
413
|
+
# @return [Geom::Transformation]
|
414
|
+
#
|
415
|
+
# @overload set!(scale)
|
416
|
+
#
|
417
|
+
# @param [Float] scale
|
418
|
+
# @return [Geom::Transformation]
|
419
|
+
#
|
420
|
+
# @version SketchUp 6.0
|
421
|
+
def set!(arg)
|
422
|
+
end
|
423
|
+
|
424
|
+
# The {#to_a} method retrieves a 16 element array which contains the values that
|
425
|
+
# define the transformation.
|
426
|
+
#
|
427
|
+
# @example
|
428
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
429
|
+
# tr = Geom::Transformation.new(point)
|
430
|
+
# # This splits the 16 items into a string of 4x4 elements for easier reading.
|
431
|
+
# str4x4 = tr.to_a.each_slice(4).inject { |str, row| "#{str}\r\n#{row}" }
|
432
|
+
#
|
433
|
+
# @return [Array<Float>]
|
434
|
+
#
|
435
|
+
# @version SketchUp 6.0
|
436
|
+
def to_a
|
437
|
+
end
|
438
|
+
|
439
|
+
# The {#xaxis} method retrieves the x axis of a rigid transformation.
|
440
|
+
#
|
441
|
+
# @example
|
442
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
443
|
+
# tr = Geom::Transformation.new(point)
|
444
|
+
# x = tr.xaxis
|
445
|
+
#
|
446
|
+
# @return [Geom::Vector3d]
|
447
|
+
#
|
448
|
+
# @version SketchUp 6.0
|
449
|
+
def xaxis
|
450
|
+
end
|
451
|
+
|
452
|
+
# The {#yaxis} method retrieves the y axis of a rigid transformation.
|
453
|
+
#
|
454
|
+
# @example
|
455
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
456
|
+
# tr = Geom::Transformation.new(point)
|
457
|
+
# x = tr.yaxis
|
458
|
+
#
|
459
|
+
# @return [Geom::Vector3d]
|
460
|
+
#
|
461
|
+
# @version SketchUp 6.0
|
462
|
+
def yaxis
|
463
|
+
end
|
464
|
+
|
465
|
+
# The {#zaxis} method retrieves the z axis of a rigid transformation.
|
466
|
+
#
|
467
|
+
# @example
|
468
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
469
|
+
# tr = Geom::Transformation.new(point)
|
470
|
+
# x = tr.zaxis
|
471
|
+
#
|
472
|
+
# @return [Geom::Vector3d]
|
473
|
+
#
|
474
|
+
# @version SketchUp 6.0
|
475
|
+
def zaxis
|
476
|
+
end
|
477
|
+
|
478
|
+
end
|