Re: [Seed7-users] Low Limit with genPointList
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
From: Thomas M. <tho...@gm...> - 2021-12-15 13:58:24
|
Hi Zachary, you guessed it. It is a limitation of the underlying X11 function XDrawLines(). XDrawLines() uses an array of XPoint elements. Unfortunately an XPoint is defined as typedef struct { short x, y; } XPoint; Therefore the function genPointList() needs to raise RANGE_ERROR, when a coordinate does not fit into a short. You are magnifying the scene such that coordinates greater than 32767 are computed. Such large values will probably never been drawn as they are beyond the normal size of a window. I suggest you use your own data structure to do the magnification and generate the point list just when it is needed. In this case the values could be limited. You could use 32767 for all values greater than 32767 and -32768 for all values less than -32768. Since this probably far beyond the window borders your magnification probably looks ok. You must also consider the coordinates you use with polyLine(), when the lines are drawn. These coordinates need also to be in the range of a short. Regards Thomas |