soegaard/metapict

Bad window dimensions could produce better error messages

Closed this issue · 2 comments

The following snippet has some bad window dimensions

#lang racket

(require metapict)

(with-window (window 100 100 100 100)
  (draw (curve origo -- (pt 10 10))))

Running it gives /: division by zero.

Hi,

I have added a guard for the window constructor.
Now an attempt to construct a window with an empty x- or y-range provokes an error.

83d6435

I moved the test to with-window. The guard on the window structure prevents the intersection code to create windows with empty ranges. Now the documentation builds again.