Class: Geom::Transformation
- Inherits:
-
Object
- Object
- Geom::Transformation
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 Transformation.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 Transformation.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 Transformation.rotation method is used to create a transformation that does rotation about an axis.
-
.scaling(*args) ⇒ Object
The Transformation.scaling method is used to create a transformation that does scaling.
-
.translation(arg) ⇒ Object
The Transformation.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) ⇒ Object
constructor
You can use this method or one of the more specific methods for creating specific kinds of Transformations.
-
#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
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) ⇒ 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.
↑ .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`.
↑ .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.
↑ .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.
↑ .translation(vector) ⇒ Geom::Transformation .translation(point) ⇒ Geom::Transformation
The translation method is used to create a transformation that does translation.
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.
↑ #clone ⇒ Geom::Transformation
The #clone method is used to create a copy of a transformation.
↑ #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.
↑ #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 #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.
↑ #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.