Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] View of /branches/vis12/doc/report/basis.tex
 [diderot] / branches / vis12 / doc / report / basis.tex

# View of /branches/vis12/doc/report/basis.tex

Sat Jul 7 19:52:14 2012 UTC (9 years ago) by jhr
File size: 4294 byte(s)
  added documentation for c4hexic

%!TEX root = report.tex
%
\chapter{The Diderot Basis Environment}
\label{chap:basis}

% polymorphic function
\newcommand{\PFNSPEC}[4]{\item[\normalfont{$\mathtt{#1} : (#2) #3 \rightarrow #4$}]\mbox{}\\}
\newcommand{\FNSPEC}[3]{\item[\normalfont{$\mathtt{#1} : #2 \rightarrow #3$}]\mbox{}\\}
\newcommand{\imageTy}[2]{\mkw{image}(#1)[#2]}
\newcommand{\kernelTy}[2]{\mkw{kernel\#}#2}
\newcommand{\fieldTy}[3]{\mkw{field\#}#1(#2)[#3]}
\newcommand{\tensorTy}[1]{\mkw{tensor}[#1]}
\newcommand{\seqTy}[2]{#1\mkw{\{}#2\mkw{\}}}

\section{Other operators}

\section{Functions}
\begin{description}
\FNSPEC{atan2}{(\mkw{real},\,\mkw{real})}{\mkw{real}}
returns the principal value of the arc tangent of $\frac{y}{x}$,
using the signs of both arguments to determine the quadrant of the return
value.
\FNSPEC{CL}{\tensorTy{3,3}}{\mkw{real}}
\PFNSPEC{convolve}{d,k,\sigma}{(\imageTy{d}{\sigma},\,\kernelTy{k})}{\fieldTy{k}{d}{\sigma}}
\FNSPEC{cos}{\mkw{real}}{\mkw{real}}
returns the cosine of its argument (measured in radians).
\PFNSPEC{dot}{d}{(\tensorTy{d},\, \tensorTy{d})}{\mkw{real}}
returns the dot product of two vectors.
\FNSPEC{evals}{\tensorTy{3,3}}{\seqTy{\mkw{vec3}}{3}}
\FNSPEC{evecs}{\tensorTy{3,3}}{\seqTy{\mkw{real}}{3}}
\PFNSPEC{inside}{k,d,\sigma}{(\fieldTy{k}{d}{\sigma},\,\mkw{tensor}[d])}{\mkw{bool}}
loads the named image file, which should be a Nrrd file.
Note that this function may only be used in the global initialization part of a Diderot
program.
\PFNSPEC{lerp}{\sigma}{(\tensorTy{\sigma},\,\tensorTy{\sigma},\,\mkw{real})}{\tensorTy{\sigma}}
linear interpolationover the interval $[0,1]$:
\begin{displaymath}
\mathtt{lerp} (x, y, t) = x(1-t) + y
\end{displaymath}%
\PFNSPEC{lerp}{\sigma}{(\tensorTy{\sigma},\,\tensorTy{\sigma},\,\mkw{real},\,\mkw{real},\,\mkw{real})}{\tensorTy{\sigma}}
linear interpolation over the interval $[\mathit{lo},\mathit{hi}]$:
\begin{displaymath}
\mathtt{lerp} (x, y, \mathit{lo}, t, \mathit{hi}) =
\mathtt{lerp}\left({x, y, \frac{t - \mathit{lo}}{\mathit{hi} - \mathit{lo}}}\right)
\end{displaymath}%
\FNSPEC{max}{(\mkw{real},\,\mkw{real})}{\mkw{real}}
returns the minimum of its two arguments.
\FNSPEC{min}{(\mkw{real},\,\mkw{real})}{\mkw{real}}
returns the maximum of its two arguments.
\PFNSPEC{modulate}{d}{(\mkw{tensor}[d],\,\mkw{tensor}[d])}{\mkw{tensor}[d]}
component-wise multiplication of two vectors.
\PFNSPEC{normalize}{d}{\mkw{tensor}[d]}{\mkw{tensor}[d]}
normalize a vector to a unit vector.
\FNSPEC{pow}{(\mkw{real},\,\mkw{real})}{\mkw{real}}
returns the first argument raised to the power of the second argument.
\PFNSPEC{principleEvec}{d}{\mkw{tensor}[d,d]}{\mkw{tensor}[d]}
\FNSPEC{sin}{\mkw{real}}{\mkw{real}}
returns the sine of its argument (measured in radians).
\FNSPEC{sqrt}{\mkw{real}}{\mkw{real}}
returns the square root of its argument.
\FNSPEC{tan}{\mkw{real}}{\mkw{real}}
returns the tangent of its argument (measured in radians).
\PFNSPEC{trace}{d}{\tensorTy{d,d}}{\mkw{real}}
returns the \emph{trace} of a square matrix.
\end{description}%

\section{Kernels}
Diderot knows about a number of standard convolution kernels, which are described in the
following table:
\begin{center}
\begin{tabular}{r@{ \texttt{:} }lp{3.5in}}
\multicolumn{2}{c}{\textbf{Specification}} & \textbf{Description} \\ \hline
\texttt{bspln3} & \kw{kernel\#}\texttt{2} & cubic bspline reconstruction (does not interpolate) \\
\texttt{bspln5} & \kw{kernel\#}\texttt{4} & quintic bspline reconstruction (does not interpolate) \\
\texttt{c4hexic} & \kw{kernel\#}\texttt{4} &
This kernel is the unique, 6-sample support, hexic, $C^4$ kernel,
with 1st and 3rd derivatives zero at origin, which integrates
to unity on the interval $[-2,2]$, with 4th order accuracy
(errors start showing up on 4th order polynomials).
It does not interpolate, but it actually rings once. \\
\texttt{ctmr} & \kw{kernel\#}\texttt{1} & Catmull-Rom interpolation \\
\texttt{tent} & \kw{kernel\#}\texttt{0} & linear interpolation \\ \hline
\end{tabular}%
\end{center}%