E
against zero is needed,
use the predication
|E| <= EPSILON
EPSILON
is a defined constant.
In this first step, please set EPSILON = 0
.
You are to return undefined values (say, null pointers)
when the intersection or other operations fail.
E.g., when intersecting ptwo parallel lines.
Now, for
i=1, 2, ..., 20,
and for
j=1, 2, ..., 20,
generate the line
Li,j
passing through the points
(0,i)
and
(j,0)
.
So there are 400 lines.
For each pair of lines, compute their intersection,
and then check if their intersection lies on one
of the lines. Thus there are (400 * 399)/2 =79800 pairs
of lines to check.
The answer (if defined) should be yes, of course.
(a)
Collect statistics on how many of the
answers are wrong.
(b)
Is there are pattern you can detect
about when the computation gives wrong answers?
EPSILON
from zero until
the first value EPSILONMIN
such that the previous experiments in STEP 1 always succeed
(all 79800 pairs give the right answer).
EPSILONMIN
?
EPSILONMIN
should be?
NOTE: Please read up our lecture notes about
floating point number systems and the IEEE Arithmetic.
EPSILON
back to 0. Now run the experiment of STEP 1 again.
We describe the above vertical walls more precisely. These walls are two dimensional and so they can be stopped by obstacles in two ways, as they expand horizontally or vertically. (1) For edge-walls, we consider only their expansion in the vertical direction ($z$-direction). At various points along the edge, they are stopped by different obstacles (above and below). Focusing only on the obstacles ``above'' (``below'' is similar), these obstacles or triangles form a sequence of length at most $2n$ (a single triangles can occur up to $n$ times). Alternatively, let us say that a point on an edge is ``above critical'' if it can see another edge vertically above it. Similarly for ``below critical''. Then we can subdivide the edge-wall into trapezoidal pieces by introducing vertical rays above or below from these critical points. (2) For vertex-walls, consider the two obstacles $A$ and $B$ which are vertically above and vertically below the vertex. We expand a vertical wall parallel to the $x$-axis until the wall first reaches the boundaries of $A$ and $B$. This determines the full extent of the vertex-walls. Thus the vertex-walls have a simple description: it is a quadrilateral determined by $A$ and $B$.