class Draught::Transformations::Affine

Attributes

transformation_matrix[R]

Public Class Methods

new(transformation_matrix) click to toggle source
# File lib/draught/transformations/affine.rb, line 11
def initialize(transformation_matrix)
  @transformation_matrix = transformation_matrix
end

Public Instance Methods

==(other) click to toggle source
# File lib/draught/transformations/affine.rb, line 23
def ==(other)
  other.respond_to?(:transformation_matrix) && other.transformation_matrix == transformation_matrix
end
affine?() click to toggle source
# File lib/draught/transformations/affine.rb, line 19
def affine?
  true
end
call(point) click to toggle source
# File lib/draught/transformations/affine.rb, line 15
def call(point)
  Point.from_matrix(transformation_matrix * point.to_matrix)
end
coalesce(other) click to toggle source
# File lib/draught/transformations/affine.rb, line 27
def coalesce(other)
  raise TypeError, "other must be a matrix-based Affine transform" unless other.affine?
  self.class.new(other.transformation_matrix * self.transformation_matrix)
end