This module provides some helper functions for graphics.
Public Instance Methods
calculate_dimensions(width, height, rwidth: nil, rheight: nil)¶
Calculates and returns the requested dimensions for the rectangular object with the given
height based on the following: options:
The requested width. If
rheightis not specified, it is chosen so that the aspect ratio is maintained. In case of
heightis used for the height.
The requested height. If
rwidthis not specified, it is chosen so that the aspect ratio is maintained. In case of
widthis used for the width.
point_on_line(x0, y0, x1, y1, distance:)¶
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)