Class: Geom::Transformation
- Inherits:
-
Object
- Object
- Geom::Transformation
- Defined in:
- SketchUp/Geom/Transformation.rb
Overview
Transformations are a standard construct in the 3D world for representing the position, rotation, and sizing of a given entity. In the SketchUp world, Sketchup::ComponentInstance and Sketchup::Group have a .transformation
method that reports their current state and various methods (.move!
, transformation=
, etc.) that allow them to be manipulated.
Use of the transformation class requires a knowledge of geometrical transformations in 3 dimensions which is covered extensively on the Internet.
Class Method Summary collapse
-
.axes(*args) ⇒ Object
The axes method creates a transformation that goes from world coordinates to an arbitrary coordinate system defined by an origin and three axis vectors.
-
.interpolate(transform1, transform2, weight) ⇒ Geom::Transformation
The interpolate method is used to create a new transformation that is the result of interpolating between two other transformations.
-
.rotation(point, vector, angle) ⇒ Geom::Transformation
The rotation method is used to create a transformation that does rotation about an axis.
-
.scaling(*args) ⇒ Object
The scaling method is used to create a transformation that does scaling.
-
.translation(arg) ⇒ Object
The translation method is used to create a transformation that does translation.
Instance Method Summary collapse
-
#*(arg) ⇒ Object
The #* method is used to do matrix multiplication using the transform.
-
#clone ⇒ Geom::Transformation
The #clone method is used to create a copy of a transformation.
-
#identity? ⇒ Boolean
The #identity? method is used to determine if a transformation is the IDENTITY transform.
-
#initialize(*args) ⇒ Transformation
constructor
The new method is used to create a new transformation.
-
#inverse ⇒ Geom::Transformation
The #inverse method is used to retrieve the inverse of a transformation.
-
#invert! ⇒ Geom::Transformation
The #invert! method sets the transformation to its inverse.
-
#origin ⇒ Geom::Point3d
The #origin method retrieves the origin of a rigid transformation.
-
#set!(arg) ⇒ Object
The #set! method is used to set this transformation to match another one.
-
#to_a ⇒ Array<Float>
The #to_a method retrieves a 16 element array which contains the values that define the transformation.
-
#xaxis ⇒ Geom::Vector3d
The #xaxis method retrieves the x axis of a rigid transformation.
-
#yaxis ⇒ Geom::Vector3d
The #yaxis method retrieves the y axis of a rigid transformation.
-
#zaxis ⇒ Geom::Vector3d
The #zaxis method retrieves the z axis of a rigid transformation.
Constructor Details
#initialize ⇒ Geom::Transformation #initialize(point) ⇒ Geom::Transformation #initialize(vector) ⇒ Geom::Transformation #initialize(transform) ⇒ Geom::Transformation #initialize(array) ⇒ Geom::Transformation #initialize(scale) ⇒ Geom::Transformation #initialize(origin, zaxis) ⇒ Geom::Transformation #initialize(origin, xaxis, yaxis) ⇒ Geom::Transformation #initialize(pt, axis, angle) ⇒ Geom::Transformation #initialize(xaxis, yaxis, zaxis, origin) ⇒ Geom::Transformation
The new method is used to create a new transformation.
You can use this method or one of the more specific methods for creating specific kinds of Transformations.
345 346 |
# File 'SketchUp/Geom/Transformation.rb', line 345 def initialize(*args) end |
Class Method Details
.axes(origin, xaxis, yaxis, zaxis) ⇒ Geom::Transformation .axes(origin, xaxis, yaxis) ⇒ Geom::Transformation
The axes method creates a transformation that goes from world coordinates to an arbitrary coordinate system defined by an origin and three axis vectors.
49 50 |
# File 'SketchUp/Geom/Transformation.rb', line 49 def self.axes(*args) end |
.interpolate(transform1, transform2, weight) ⇒ Geom::Transformation
The interpolate method is used to create a new transformation that is the result of interpolating between two other transformations.
Parameter is a weight (between 0.0 and 1.0) that identifies whether to favor transformation1 or transformation2.
79 80 |
# File 'SketchUp/Geom/Transformation.rb', line 79 def self.interpolate(transform1, transform2, weight) end |
.rotation(point, vector, angle) ⇒ Geom::Transformation
The rotation method is used to create a transformation that does rotation about an axis.
The axis is defined by a point and a vector. The angle is given in radians.
103 104 |
# File 'SketchUp/Geom/Transformation.rb', line 103 def self.rotation(point, vector, angle) end |
.scaling(scale) ⇒ Geom::Transformation .scaling(xscale, yscale, zscale) ⇒ Geom::Transformation .scaling(point, scale) ⇒ Geom::Transformation .scaling(point, xscale, yscale, zscale) ⇒ Geom::Transformation
The scaling method is used to create a transformation that does scaling.
149 150 |
# File 'SketchUp/Geom/Transformation.rb', line 149 def self.scaling(*args) end |
.translation(vector) ⇒ Geom::Transformation .translation(point) ⇒ Geom::Transformation
The translation method is used to create a transformation that does translation.
170 171 |
# File 'SketchUp/Geom/Transformation.rb', line 170 def self.translation(arg) end |
Instance Method Details
#*(point) ⇒ Geom::Point3d #*(vector) ⇒ Geom::Vector3d #*(transformation) ⇒ Geom::Transformation #*(point) ⇒ Array<Float, Float, Float> #*(plane) ⇒ Array<Float, Float, Float, Float> #*(plane) ⇒ Array<Float, Float, Float, Float>
The #* method is used to do matrix multiplication using the transform.
215 216 |
# File 'SketchUp/Geom/Transformation.rb', line 215 def *(arg) end |
#clone ⇒ Geom::Transformation
The #clone method is used to create a copy of a transformation.
228 229 |
# File 'SketchUp/Geom/Transformation.rb', line 228 def clone end |
#identity? ⇒ Boolean
As of SketchUp 2018, this now looks at the data to determine if the transformation is identity. Prior to SU2018, this only looks at the flag to see if the transform has not been modified. If the transform has been changed, this will return false even if it is really the identity.
The #identity? method is used to determine if a transformation is the IDENTITY transform.
264 265 |
# File 'SketchUp/Geom/Transformation.rb', line 264 def identity? end |
#inverse ⇒ Geom::Transformation
The #inverse method is used to retrieve the inverse of a transformation.
358 359 |
# File 'SketchUp/Geom/Transformation.rb', line 358 def inverse end |
#invert! ⇒ Geom::Transformation
The #invert! method sets the transformation to its inverse.
371 372 |
# File 'SketchUp/Geom/Transformation.rb', line 371 def invert! end |
#origin ⇒ Geom::Point3d
The #origin method retrieves the origin of a rigid transformation.
384 385 |
# File 'SketchUp/Geom/Transformation.rb', line 384 def origin end |
#set!(transformation) ⇒ Geom::Transformation #set!(point) ⇒ Geom::Transformation #set!(vector) ⇒ Geom::Transformation #set!(matrix) ⇒ Geom::Transformation #set!(scale) ⇒ Geom::Transformation
The #set! method is used to set this transformation to match another one.
The argument is anything that can be converted into a transformation.
423 424 |
# File 'SketchUp/Geom/Transformation.rb', line 423 def set!(arg) end |
#to_a ⇒ Array<Float>
The #to_a method retrieves a 16 element array which contains the values that define the transformation.
438 439 |
# File 'SketchUp/Geom/Transformation.rb', line 438 def to_a end |
#xaxis ⇒ Geom::Vector3d
The #xaxis method retrieves the x axis of a rigid transformation.
451 452 |
# File 'SketchUp/Geom/Transformation.rb', line 451 def xaxis end |
#yaxis ⇒ Geom::Vector3d
The #yaxis method retrieves the y axis of a rigid transformation.
464 465 |
# File 'SketchUp/Geom/Transformation.rb', line 464 def yaxis end |
#zaxis ⇒ Geom::Vector3d
The #zaxis method retrieves the z axis of a rigid transformation.
477 478 |
# File 'SketchUp/Geom/Transformation.rb', line 477 def zaxis end |