Class: Geom::Transformation
Relationships | |
Inherits: | Object |
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
-
.axes(origin, xaxis, yaxis, zaxis) ⇒ 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.
-
.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.
-
.new ⇒ Geom::Transformation
constructor
You can use this method or one of the more specific methods for creating specific kinds of Transformations.
-
.rotation(point, vector, angle) ⇒ Geom::Transformation
The .rotation method is used to create a transformation that does rotation about an axis.
-
.scaling(scale) ⇒ Geom::Transformation
The .scaling method is used to create a transformation that does scaling.
-
.translation(vector) ⇒ Geom::Transformation
The .translation method is used to create a transformation that does translation.
Instance Attribute Summary
-
#identity? ⇒ Boolean
readonly
The #identity? method is used to determine if a transformation is the IDENTITY transform.
Instance Method Summary
-
#*(point) ⇒ Geom::Point3d
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.
-
#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!(transformation) ⇒ Geom::Transformation
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
.new ⇒ Transformation
.new(point) ⇒ Transformation
.new(vector) ⇒ Transformation
.new(transform) ⇒ Transformation
.new(array) ⇒ Transformation
.new(scale) ⇒ Transformation
.new(origin, zaxis) ⇒ Transformation
.new(origin, xaxis, yaxis) ⇒ Transformation
.new(pt, axis, angle) ⇒ Transformation
.new(xaxis, yaxis, zaxis, origin) ⇒ Transformation
Transformation
.new(point) ⇒ Transformation
.new(vector) ⇒ Transformation
.new(transform) ⇒ Transformation
.new(array) ⇒ Transformation
.new(scale) ⇒ Transformation
.new(origin, zaxis) ⇒ Transformation
.new(origin, xaxis, yaxis) ⇒ Transformation
.new(pt, axis, angle) ⇒ Transformation
.new(xaxis, yaxis, zaxis, origin) ⇒ Transformation
You can use this method or one of the more specific methods for creating specific kinds of Transformations.
Class Method Details
.axes(origin, xaxis, yaxis, zaxis) ⇒ Transformation
.axes(origin, xaxis, yaxis) ⇒ Transformation
Transformation
.axes(origin, xaxis, yaxis) ⇒ 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.
.interpolate(transform1, transform2, weight) ⇒ 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
.
.rotation(point, vector, angle) ⇒ 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.
.scaling(scale) ⇒ Transformation
.scaling(xscale, yscale, zscale) ⇒ Transformation
.scaling(point, scale) ⇒ Transformation
.scaling(point, xscale, yscale, zscale) ⇒ Transformation
Transformation
.scaling(xscale, yscale, zscale) ⇒ Transformation
.scaling(point, scale) ⇒ Transformation
.scaling(point, xscale, yscale, zscale) ⇒ Transformation
The .scaling
method is used to create a transformation that does scaling.
.translation(vector) ⇒ Transformation
.translation(point) ⇒ Transformation
Transformation
.translation(point) ⇒ Transformation
The .translation
method is used to create a transformation that does translation.
Instance Attribute Details
#identity? ⇒ Boolean
(readonly)
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.
Instance Method Details
#*(point) ⇒ Geom::Point3d
#*(vector) ⇒ Geom::Vector3d
#*(transformation) ⇒ Transformation
#*(point) ⇒ Array(Float
, Float
, Float
)
#*(plane) ⇒ Array(Float
, Float
, Float
, Float
)
#*(plane) ⇒ Array(Float
, Float
, Float
, Float
)
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.
#clone ⇒ Transformation
The #clone
method is used to create a copy of a transformation.
#inverse ⇒ Transformation
The #inverse
method is used to retrieve the inverse of a transformation.
#invert! ⇒ Transformation
The #invert!
method sets the transformation to its inverse.
#origin ⇒ Geom::Point3d
The #origin
method retrieves the origin of a rigid transformation.
#set!(transformation) ⇒ Transformation
#set!(point) ⇒ Transformation
#set!(vector) ⇒ Transformation
#set!(matrix) ⇒ Transformation
#set!(scale) ⇒ Transformation
Transformation
#set!(point) ⇒ Transformation
#set!(vector) ⇒ Transformation
#set!(matrix) ⇒ Transformation
#set!(scale) ⇒ 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.
#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.