@@ -454,44 +454,43 @@ They are presented in Table \ref{tab:corners}.

\item[Step 1: Change of coordinates.]

As described in Section \ref{sec:coords}, $V$ is transformed into $Y$ and $U$ into $X$.

\item[Step 2: Select plane of $Y$, $P$.]

Calculate $p_i$, $q_i$ and $r_i$ for all vertices of $X$.

\item[Step 2: Select plane $P_\gamma$ of $Y$.]

Calculate $\pxi{i}$, $\qxi{i}$ and $\rxi{i}$ for all vertices of $X$, $i=1,\dots,4$.

\begin{description}

\item[Step 2a: Intersections between $P$ and edges of $X$.]

Test if $\sign(p_i)\neq\sign(p_j)$.

If so, calculate the intersection between $p=0$ and the edge connecting the $i$--th and $j$--th vertices of $X$.

\item[Step 2a: Intersections between $P_\gamma$ and edges of $X$.]

Test if $\sign(\pxi{i})\neq\sign(\pxi{j})$.

If so, calculate the intersection between $p_\gamma=0$ and the edge connecting the $i$--th and $j$--th vertices of $X$, found using the coordinates $q^{ij}_\gamma$ and $r_\gamma^{ij}$.

If $q_\gamma^{ij}$, $r_\gamma^{ij}$ and $1-q_\gamma^{ij}-r_\gamma^{ij}$ are all non-negative then the intersection is a corner of the polyhedron of intersection.

Repeat for all pairs of $i$ and $j$.

\item[Step 2b: Intersection between $G$ and $F$.]

Select a reference line of the right angle triangle $F$.

Calculate $s_i$ and $t_i$ for all vertices of $G$.

\item[Step 2b: Intersection between $G$ and edges of $Y$.]

Select an edge of $Y$ that lies in $P_\gamma$.

Without loss of generality, suppose this aligns with $q_\gamma=p_\eta=0$.

Test if $\sign(q_\gamma^{ij})\neq\sign(q_\gamma^{ik})$

If so, calculate the intersection $t_{\gamma,\eta}^{ijk}$ between $G$ and this edge of $Y$.

If $t_{\gamma,\eta}^{ijk}\in[0,1]$ then this intersection is a corner of the polyhedron of intersection.

Repeat for all pairs of $ij$ and $ik$.

\begin{description}

\item[Step 2bi: Intersections between edges of $Y$ and faces of $X$.]

Test if $\sign(s_i)\neq\sign(s_j)$.

If so, calculate the intersection between this edge of $G$ and $s=0$.

Repeat for all pairs of $i$ and $j$.

Let $t_{\min}$ be the smallest value of $t$ found in this way, and $t_{\max}$ the largest.

Test if $\sign(t_{\gamma,\eta}^{ijk})\neq\sign(t_{\gamma,\eta}^{ijl})$.

If so, the vertex of $Y$ at $t_{\gamma,\eta}=0$ lies in $X$.

Likewise, if $\sign(1-t_{\gamma,\eta}^{ijk})\neq\sign(1-t_{\gamma,\eta}^{ijl})$ then the vertex of $Y$ at $t_{\gamma,\eta}=1$ lies in $X$.

\end{description}

Repeat step 2b for each reference line of $F$.

\item[Step 2c: Intersections between $F$ and edges of $X$]

If $\sign(s_i)=1$ for all reference lines of $F$ then the $i$--th vertex of $G$ is an intersection between $F$ and an edge of $X$.

Repeat step 2b for each edge of $Y$ that lies in $P_\gamma$.

\end{description}

Repeat step 2 for each face of $Y$.

It is not necessary to repeat step 2b for edges considered in previous instances of step 2, nor step 2bi for previously considered vertices.

\item[Step 3: Vertices of $X$ in $Y$.]

Compare all values of $p_i$ for the $i$--th vertex of $X$.

If $\sign(p_i)=1$ for all $P$ then the $i$--th vertex lies inside $Y$.

\item[Step 4: Edges of $Y$.]

Select an edge of $Y$.

Let $T_1$ be the smallest value of $t_{\min}$ found for this edge, and $T_2$ the largest value of $t_{\max}$.

If either $T_1, T_2\in[0,1]$ then the corresponding point is an intersection between this edge of $Y$ and a face of $X$.

If either $0,1\in[T_1, T_2]$ then the corresponding vertex of $Y$ lies inside $X$.

\item[Step 5: Undo change of coordinates.]

Transform the intersections between edges of $X$ and faces of $Y$ (2c) and those between edges of $Y$ and faces of $X$ (4) into the original coordinates.

The transformations between $(s,t)$--coordinates and $(p,q,r)$--coordinates are found in Tables \ref{tab:XwithY} and \ref{tab:YwithX}.

Compare all values of $\pxi{i}$ for the $i$--th vertex of $X$.

If $\sign(\pxi{i})=1$ for all $\gamma$ then the $i$--th vertex lies inside $Y$.

\item[Step 4: Undo change of coordinates.]

Transform the intersections between edges of $X$ and faces of $Y$ (2a) and those between edges of $Y$ and faces of $X$ (2b) into the original coordinates.

The transformation from $(p,q,r)$--coordinates has been shown in Table \ref{tab:XwithY}.

The transformation from $t$--coordinate is presented in Table \ref{tab:YwithX}.

Take the numbers listed in the tables, multiply by the respective vectors $\vec{v}_i$, sum the results and add $\vec{v}_0$ for the positions in original coordinates.

\end{description}

...

...

@@ -506,10 +505,15 @@ Take the numbers listed in the tables, multiply by the respective vectors $\vec{

$y=0,x+y+z=1$&$t$&&$1-t$\\

$x=0,x+y+z=1$&&$1-t$&$t$

\end{tabular}

\caption{Position of the intersection $(0,t)$between an edge of $Y$ and a face of $X$ in original coordinates as functions of $(s,t)$--coordinates.}

\caption{Position of the intersection between an edge of $Y$ and a face of $X$ in original coordinates as functions of its $t$--coordinate.}

\label{tab:YwithX}

\end{table}

Note that step 2b may be completed after step 2a has been completed for all planes $P_\gamma$.

Likewise, step 2bi may be completed after all instances of step 2b.

This means the algorithm can be parallelized by having steps 2a, 2b and 2bi run by separate threads.

One could also have each plane $P_\gamma$ run by separate threads, though information about which edges and vertices have already been considered would need to be passed between these threads.

\section{Consistency errors}

If the algorithm is to be robust, an error on the order of machine epsilon can only cause a change in the volume of the polyhedron of intersection on the same order of magnitude.

...

...

@@ -1180,7 +1184,7 @@ This algorithm is consistent.

Outline:

\begin{itemize}

\item Prove each step of the algorithm is self-consistent;

\item Prove each step is consistent with the previous step;

\item Prove each step is consistent with the previous step;% i am concerned that the calculated intersections may form a non-convex object which will cause an incorrect number of intersections to be calculated - either prevent this by taking convex hulls at each step or prove it isn't a problem