Class: Geom::Transformation2d

Inherits:
Object
  • Object
show all

Overview

Version:

  • LayOut 2018

Instance Method Summary # collapse

Constructor Details

#initializeGeom::Transformation2d #initialize(transformation) ⇒ Geom::Transformation2d #initialize(array) ⇒ Geom::Transformation2d

The #initialize method creates a new Geom::Transformation2d. You can use this method or one of the more specific methods for creating specific kinds of Geom::Transformation2d.

Examples:

tr = Geom::Transformation2d.new({1.0, 0.0, 0.0, 1.0, 1.0, 1.0})

Overloads:

Version:

  • LayOut 2018

Instance Method Details

#==(other) ⇒ Boolean

The #== method checks to see if the two Geom::Transformation2ds are equal. This checks whether the values of the transformations are the same.

Examples:

tr = Geom::Transformation2d.new({1.0, 0.0, 0.0, 1.0, 1.0, 1.0})
tr == tr.clone

Parameters:

Returns:

  • (Boolean)

Version:

  • LayOut 2018

#cloneGeom::Transformation2d

The #clone method creates a copy of the Geom::Transformation2d.

Examples:

tr1 = Geom::Transformation2d.new
tr2 = tr1.clone

Returns:

Version:

  • LayOut 2018

#identity?Boolean

The #identity? method determines if the Geom::Transformation2d is the IDENTITY_2D transform.

Examples:

array = {1.0, 0.0, 0.0, 1.0, 1.0, 0.0}
tr = Geom::Transformation2d.new(array)
# Returns false.
status = tr.identity?
tr = Geom::Transformation2d.new
# Returns true.
status = tr.identity?
# Returns true.
status = IDENTITY.identity?

Returns:

  • (Boolean)

    true if the transform is the identity

  • (Boolean)

Version:

  • LayOut 2018

#set!(transformation) ⇒ Geom::Transformation2d #set!(matrix) ⇒ Geom::Transformation2d

The #set! method sets the Geom::Transformation2d to match another one. The argument is anything that can be converted into a Geom::Transformation2d.

Examples:

tr1 = Geom::Transformation2d.new
array = {2.0, 0.0, 0.0, 2.0, 0.0, 0.0}
tr1.set!(array)

Overloads:

Version:

  • LayOut 2018

#to_aArray<Float>

The #to_a method returns a 6 element array which contains the values that define the Transformation2d.

Examples:

tr = Geom::Transformation2d.new
tr.to_a.each_slice(2) {|a| p a}

Returns:

  • (Array<Float>)

    an array of 6 elements

Version:

  • LayOut 2018