soegaard / metapict

A graphics library for producing Racket picts in a MetaPost/TikZ style.
http://soegaard.github.io/metapict/
65 stars 13 forks source link

Bad window dimensions could produce better error messages #16

Closed takikawa closed 10 years ago

takikawa commented 10 years ago

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.

soegaard commented 10 years ago

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.

83d6435c3d6686e4090e8afc5bb86975a05583f3

soegaard commented 10 years ago

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.