\newpage
{\bf \Huge Region}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Constructor for {\tt Region} objects.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt [reg] = Region() } \\
{\tt [reg] = Region(index) } \\
{\tt  [reg] = Region(type, param) } \\
{\tt  [reg] = Region('composite', param, op1, op2, oper) }
\end{quote}

{\bf Description}

\begin{quote}
{\tt [reg] = Region() } creates an empty {\tt Region} object.

{\tt [reg] = Region(ind) } returns the previously-allocated {\tt
Region} object of index {\tt ind}.

{\tt  [reg] = Region(type, param) } creates a {\tt Region} object of the
given type, with parameters given in the structure {\tt param}.

{\tt  [reg] = Region('composite', param, op1, op2, oper) } creates a
composite {\tt Region} in {\tt param.dim}-dimensional space, formed as a
result of the operation {\tt oper} of the two {\tt Regions op1} and {\tt
op2}. 

{\tt type} can be one of 
\begin{itemize}
\item {\tt 'halfspace'} is a halfspace, containing all points
$\mathbf{x}$ such that $\mathbf{a}'\mathbf{x} >= b$. param must contain the
fields {\tt dim}, {\tt a} and {\tt b}, where {\tt a} is a vector of
length {\tt dim}, and {\tt b} is a
scalar.

\item    'sphere' is a hypersphere, containing all points $\mathbf{x}$ such that
       $|\mathbf{x}| <= r$. {\tt param} must contain the fields {\tt
dim}, {\tt center}
       and {\tt radius}, where {\tt center} is a vector of length {\tt dim} which
       indicates the center point of the hypersphere, and {\tt radius} is
       a positive, real scalar.
\item    {\tt 'convpoly'} is a bounded convex polytope. Its constructor
       requires {\tt param} to contain the fields {\tt dim} and {\tt points}, where
       {\tt points} is a list of points describing the polytope. The
       convex hull of the points is then determined, and fields {\tt A}
       and {\tt b} are added to {\tt param}, which describe the intersecting
       halfspaces $\mathbf{a}'\mathbf{x} >= b$ which determine the polytope.
\end{itemize}


\end{quote}

%-----------------

\newpage
{\bf \Huge Region/bb}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Bounding box for {\tt Region}.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt box = bb(reg, lat)  }
\end{quote}

{\bf Description}

\begin{quote}
Returns a bounding box for the {\tt Region reg} in
  terms of the {\tt Lattice lat}; that is, in terms of intervals along the
  lattice basis vectors which define a parallepiped that circumscribes
  the {\tt Region}.  
 
  If the {\tt Region} is unbounded, the function returns {\tt inf}.

 If {\tt lat} is an offset {\tt Lattice}, the intervals given are for a
  parallelepiped that circumscribes the {\tt Region} shifted by the
  inverse of the lattice's offset.

\end{quote}

%-----------------

\newpage
{\bf \Huge Region/get\_dim, get\_type}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
{\tt Region} dimension and type extraction.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt dim = get\_dim(reg) } \\
{\tt type = get\_type(reg) }
\end{quote}

{\bf Description}

\begin{quote}
{\tt dim = get\_dim(reg) } returns the dimension of the {\tt Region
reg}.

{\tt type = get\_type(reg) } returns the type of the {\tt Region reg}.

\end{quote}

%-----------------

\newpage
{\bf \Huge Region/intersect, mtimes}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Intersection of {\tt Region}s.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt reg = intersect(a, b)  }\\
{\tt reg = mtimes(a, b) }
\end{quote}

{\bf Description}

\begin{quote}
Returns the composite {\tt Region} which is the intersection of {\tt
Region}s {\tt a} and {\tt b}. 

{\tt reg = intersect(a, b) } is called for the syntax {\tt a * b}.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/isin}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Determine if points are in a {\tt Region}.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt result = isin(reg, points)  } \\
{\tt [result, I] = isin(reg, points}
\end{quote}

{\bf Description}

\begin{quote}
Returns the points from the list of points which are in {\tt reg}. {\tt
points} is a matrix, in which each row contains the coordinates for an
individual point. {\tt result} is a matrix of the same structure.

{\tt [result, I] = isin(reg, points)} also returns an index vector {\tt
I}, such that {\tt result = points(I,:) }.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/msop}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Minimal sum-of-products representation.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt fcn = msop(reg) } \\
{\tt [fcn, prims] = msop(reg)}
\end{quote}

{\bf Description}

\begin{quote}
Returns a simplified sum-of-products representation of a composite {\tt
Region}. {\tt fcn} is a cell array, of which each cell represents a
product term. Each cell contains a vector of numbers which correspond to
primitive {\tt Region}s in the product term.

{\tt [fcn, prims] = msop(reg)} also returns a list of the indices of
primitive {\tt Region}s in the composite {\tt Region}.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/not}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Complement of region.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt reg = not(a) }
\end{quote}

{\bf Description}

\begin{quote}
Returns a {\tt Region} object which is the complement of {\tt a}.

{\tt reg = not(a)} is called for the syntax {\tt \~{}a}.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/or}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Region shift.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt rreg = or(reg, off)  }
\end{quote}

{\bf Description}

\begin{quote}
Shifts {\tt reg} by the offset vector {\tt off}.

{\tt rreg = or(reg, off)} is called for the syntax {\tt reg | off}.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/points}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Lattice points in region.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt [locs] = points(reg, lat)  }
\end{quote}

{\bf Description}

\begin{quote}
 Returns the points in {\tt reg} on
  the {\tt Lattice lat}. {\tt locs} is a matrix with each row containing the
  the cartesian coordinates of a point.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/probett}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Evaluate Boolean function.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt bit = probett(reg, prims, row)  }
\end{quote}

{\bf Description}

\begin{quote}
Evaluates the Boolean function over primitive regions specified by the
{\tt Region reg} and evaluated on the primitive variables given {\tt
prims}, a vector of indices. {\tt row} is an integer which when
converted to BCD specifies the binary value for each of the primitive
values. The variables are assumed to be ordered from least significant
to most significant. The result {\tt bit} is a logical value which can
be 0 or 1.
\end{quote}

{\bf Examples}

\begin{quote}
{\tt probett(15, [1 2 3], 0)} evaluates 
\[ f_{15}(P_1 = 0, P_2 = 0, P_3 = 0). \]

{\tt probett(15, [1 2 3], 6)} evaluates
\[ f_{15}(P_1 = 1, P_2 = 1, P_3 = 0). \]
where $f_{15}$ is the Boolean function specified by the {\tt Region} of
index 15.

\end{quote}

%-----------------

\newpage
{\bf \Huge Region/rot}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Rotate region.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt rreg = rot(reg, ang, dims) }
\end{quote}

{\bf Description}

\begin{quote}
 Rotates the region by {\tt ang} radians in dimensions {\tt dims}.
 {\tt dims} is a length-2 vector indicating the subspace in which
  the rotation is performed.
  For example, {\tt rot(reg, pi/4, [1 3])} will rotate {\tt reg} 45 degrees 
  in the $xz$-subspace.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/setdiff}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Set difference of regions.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt reg = setdiff(a, b)  }
\end{quote}

{\bf Description}

\begin{quote}
  Returns {\tt Region} whose members are in {\tt a} but not {\tt b}.
  {\tt [reg] = setdiff(a, b)} has the same effect as
  {\tt [reg] = intersect(a, ~b)}.
\end{quote}

%-----------------

\newpage
{\bf \Huge Region/union, plus}
\leavevmode\leaders\hrule height 1mm \hfill
%\rule{2in}{1mm}
\vspace{0.25in}

{\bf Purpose}

\begin{quote}
Union of {\tt Region}s.
\end{quote}

{\bf Syntax}

\begin{quote}
{\tt reg = union(a, b)  }\\
{\tt reg = plus(a, b) }
\end{quote}

{\bf Description}

\begin{quote}
Returns the composite {\tt Region} which is the union of {\tt
Region}s {\tt a} and {\tt b}. 

{\tt reg = union(a, b) } is called for the syntax {\tt a + b}.
\end{quote}

%-----------------
