module Draught::Transformations
Constants
- MM_TO_PT
Public Instance Methods
mm_to_pt()
click to toggle source
# File lib/draught/transformations.rb, line 13 def mm_to_pt Affine.new(Matrix[ [MM_TO_PT, 0, 0], [0, MM_TO_PT, 0], [0, 0, 1] ]) end
rotate(radians)
click to toggle source
# File lib/draught/transformations.rb, line 49 def rotate(radians) cos = Math.cos(radians) sin = Math.sin(radians) Transformations::Affine.new(Matrix[ [cos, -sin, 0], [sin, cos, 0], [0, 0, 1] ]) end
round_to_n_decimal_places(n)
click to toggle source
# File lib/draught/transformations.rb, line 59 def round_to_n_decimal_places(n) Proclike.new(->(p) { [p.x.round(n), p.y.round(n)] }) end
scale(factor)
click to toggle source
# File lib/draught/transformations.rb, line 41 def scale(factor) Transformations::Affine.new(Matrix[ [factor, 0, 0], [0, factor, 0], [0, 0, 1] ]) end
x_axis_reflect()
click to toggle source
# File lib/draught/transformations.rb, line 21 def x_axis_reflect Affine.new(Matrix[ [1,0,0], [0,-1,0], [0,0,1] ]) end
xy_axis_reflect()
click to toggle source
# File lib/draught/transformations.rb, line 37 def xy_axis_reflect Composer.compose(x_axis_reflect, y_axis_reflect) end
y_axis_reflect()
click to toggle source
# File lib/draught/transformations.rb, line 29 def y_axis_reflect Affine.new(Matrix[ [-1,0,0], [0,1,0], [0,0,1] ]) end