# Glimmr Drawing Commands

## version 2/101030 by Erik Temple

**Section - Line using angle + distance**

To draw a line (hue - a number) in (win - a g-window) from (x1 - a number) by (y1 - a number) measuring/of (distance - a number) pixel/pixels/px/-- long/-- at (angle - a number) deg/degree/degrees/-- angle/-- with (wgt - a number) pixel/pixels/px/-- line-weight/stroke:

let xx be (sine of angle) * distance as an integer;

let yy be (cosine of angle) * distance as an integer;

let x2 be x1 + xx;

let y2 be y1 - yy;

#if utilizing Glimmr debugging;

say "[>console][DC]Converting angle ([angle]°) and distance ([distance]) to coordinate pair ([x2], [y2]) in preparation for line-drawing.[<]";

#end if;

Draw a line (hue) in (win) from (x1) by (y1) to (x2) by (y2) with (wgt) pixel line-weight.

To draw a line (hue - a number) in (win - a g-window) from (coord1 - a list of numbers) measuring (distance - a number) pixels/pixel/-- long/-- at (angle - a number) deg/degree/degrees/-- angle/-- with (wgt - a number) pixel/pixels/px/-- line-weight/stroke:

let x1 be entry 1 of coord1;

let y1 be entry 2 of coord1;

Draw a line (hue) in (win) from (x1) by (y1) measuring (distance) pixels at (angle) with (wgt) pixel line-weight.

To line (coord1 - a list of numbers) dist/distance (distance - a number) px/pixels/pixel (angle - a number) deg/degree/degrees/-- angle/at (wgt - a number) px/pixels/pixel wgt/wt/weight/--:

if the type of the current graphics window is not g-graphics:

say "*** Error: Short-form line-drawing directive ignored. The current graphics window global was not correctly specified.";

rule fails;

let x1 be entry 1 of coord1;

let y1 be entry 2 of coord1;

Draw a line (current foreground-color) in (current graphics window) from (x1) by (y1) measuring (distance) pixels at (angle) with (wgt) pixel line-weight.

To decide what number is (rad - a real number) rad/radians:

decide on rad in degrees as an integer.