module HexaPDF:: Utils:: GraphicsHelpers
This module provides some helper functions for graphics.
Public Instance Methods
Calculates and returns the requested dimensions for the rectangular object with the given width
and height
based on the following: options:
rwidth
-
The requested width. If
rheight
is not specified, it is chosen so that the aspect ratio is maintained. In case ofwidth
begin zero,height
is used for the height. rheight
-
The requested height. If
rwidth
is not specified, it is chosen so that the aspect ratio is maintained. In case ofheight
begin zero,width
is used for the width.
Given two points p0 = (x0, y0) and p1 = (x1, y1), returns the point on the line through these points that is distance
units away from p0.
v = p1 - p0
result = p0 + distance * v/norm(v)