Module: Skrift::Geometry
Overview
Geometry helpers shared by Font (compound glyphs) and Outline.
Class Method Summary collapse
- .midpoint(a, b) ⇒ Object
-
.transform_points(trf, pts) ⇒ Object
Applies an affine linear transformation matrix to a set of points.
Class Method Details
.midpoint(a, b) ⇒ Object
13 |
# File 'lib/skrift.rb', line 13 def midpoint(a, b) = (a + b) * 0.5 |
.transform_points(trf, pts) ⇒ Object
Applies an affine linear transformation matrix to a set of points.
16 17 18 19 20 21 22 |
# File 'lib/skrift.rb', line 16 def transform_points(trf, pts) pts.each do |pt| x, y = pt[0], pt[1] pt[0] = trf[0][0] * x + trf[0][1] * y + trf[0][2] pt[1] = trf[1][0] * x + trf[1][1] * y + trf[1][2] end end |