%% -----------------------------------------------------------------------------
%% cadcube.tex
%% Copyright (c) 2026 Jannik Svenson <94602613+janniksvenson@users.noreply.github.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%% The Current Maintainer of this work is Jannik Svenson.
%% This work consists of the files cadcube.sty, cadcube.tex, cadcube.pdf, cadcube.cwl, README.md, and the examples/ directory.
%% -----------------------------------------------------------------------------
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[a4paper, margin=1.5cm]{geometry}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{cadcube}
\usepackage{listings}

% Professional CTAN-standard code listing style for LaTeX
\lstdefinestyle{cadcubestyle}{
  language=[LaTeX]TeX,
  basicstyle=\small\ttfamily,
  keywordstyle=\color{blue!80!black}\bfseries,
  commentstyle=\color{gray!60}\itshape,
  stringstyle=\color{teal!80!black},
  backgroundcolor=\color{gray!6},
  frame=single,
  rulecolor=\color{gray!25},
  framesep=5pt,
  xleftmargin=4pt,
  xrightmargin=4pt,
  breaklines=true,
  tabsize=2,
  showstringspaces=false
}
\lstset{style=cadcubestyle}

% Automatically extract version and release date directly from cadcube.sty
\makeatletter
\def\cadcube@parseinfo#1 #2 #3\@nil{%
  \def\cadcubeDate{#1}%
  \def\cadcubeVersion{#2}%
}
\expandafter\expandafter\expandafter\cadcube@parseinfo\csname ver@cadcube.sty\endcsname\@nil
\makeatother

% Shields.io-style clickable visual documentation badges (vector TikZ without layer conflicts)
\newcommand{\docbadge}[4][]{%
  \href{#1}{%
    \begin{tikzpicture}[baseline=-0.6ex]
      \node[inner sep=0pt, outer sep=0pt] {%
        \sbox0{\sffamily\bfseries\fontsize{7pt}{8pt}\selectfont#2}%
        \sbox2{\sffamily\bfseries\fontsize{7pt}{8pt}\selectfont#3}%
        \begin{tikzpicture}[baseline=-0.6ex]
          \clip[rounded corners=2.5pt] (0,-2.5pt) rectangle (\wd0+\wd2+16pt, 9.5pt);
          \fill[black!75] (0,-2.5pt) rectangle (\wd0+8pt, 9.5pt);
          \fill[#4] (\wd0+8pt,-2.5pt) rectangle (\wd0+\wd2+16pt, 9.5pt);
          \node[anchor=west, text=white, font=\sffamily\bfseries\fontsize{7pt}{8pt}\selectfont, inner sep=0pt] at (4pt, 3.5pt) {#2};
          \node[anchor=west, text=white, font=\sffamily\bfseries\fontsize{7pt}{8pt}\selectfont, inner sep=0pt] at (\wd0+12pt, 3.5pt) {#3};
          \draw[black!20, line width=0.3pt, rounded corners=2.5pt] (0,-2.5pt) rectangle (\wd0+\wd2+16pt, 9.5pt);
        \end{tikzpicture}%
      };
    \end{tikzpicture}%
  }%
}
\usepackage{booktabs}
\usepackage{array}
\usepackage{subcaption}
\usepackage[hidelinks, pdfencoding=auto]{hyperref}
\hypersetup{
  pdftitle={The cadcube Package: Modular CAD Orientation Cube for LaTeX},
  pdfauthor={Jannik Svenson},
  pdfsubject={Modular CAD Orientation Cube for LaTeX},
  pdfkeywords={CTAN, TeX, LaTeX, TikZ, CAD, CFD, view-cube, orientation, scientific-visualization, coordinate-systems, 3d-projection}
}

% Clean paragraph and float spacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt plus 2pt minus 1pt}

\setlength{\floatsep}{8pt plus 2pt minus 2pt}
\setlength{\textfloatsep}{10pt plus 2pt minus 2pt}
\setlength{\intextsep}{8pt plus 2pt minus 2pt}

\captionsetup{font=small, labelfont=bf}
\captionsetup[table]{position=above, skip=6pt}
\captionsetup[figure]{position=below, skip=6pt}
\captionsetup[sub]{font=footnotesize, skip=2pt}

% Column types for documentation tables (vertically centered)
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{M}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}

% ------------------------------------------------------------------------------
% Table Preview Box Definitions
% ------------------------------------------------------------------------------
\newcommand{\cadTableRowSep}{1.5pt}          % Vertical separation between table rows
\newlength{\cadTableBoxW}
\setlength{\cadTableBoxW}{2.5cm}            % Standard width: 2.5cm
\newlength{\cadTableBoxH}
\setlength{\cadTableBoxH}{1.5cm}           % Standard height: 1.50cm
\newlength{\cadTableBoxSize}
\setlength{\cadTableBoxSize}{1.0cm}          % Default indicator overlay size: 1.0cm

\newcommand{\tableBox}[1][]{%
  \cadcubeoverlay[location=center, size=\cadTableBoxSize, #1]{%
    \begin{tikzpicture}
      \path[use as bounding box] (0,0) rectangle (\cadTableBoxW, \cadTableBoxH);
      \fill[gray!8] (0,0) rectangle (\cadTableBoxW, \cadTableBoxH);
      \draw[gray!30, line width=0.4pt] (0,0) rectangle (\cadTableBoxW, \cadTableBoxH);
      \draw[gray!18, step=0.5cm, line width=0.2pt] (0,0) grid (\cadTableBoxW, \cadTableBoxH);
    \end{tikzpicture}%
  }%
}

\newcommand{\demoBox}[1][]{%
  \tableBox[#1]%
}

\newcommand{\cadBoxTwo}[1]{%
  \cadcubeoverlay[location=center, size=1.0cm, preset=cartesian, #1]{%
    \begin{tikzpicture}
      \path[use as bounding box] (0,0) rectangle (2.0cm, 1.50cm);
      \fill[gray!8] (0,0) rectangle (2.0cm, 1.50cm);
      \draw[gray!30, line width=0.35pt] (0,0) rectangle (2.0cm, 1.50cm);
      \draw[gray!18, step=0.5cm, line width=0.2pt] (0,0) grid (2.0cm, 1.50cm);
    \end{tikzpicture}%
  }%
}

\begin{document}

% ==============================================================================
% Title & Metadata Header
% ==============================================================================
\title{\sffamily\bfseries The \texttt{cadcube} Package\\[0.3em]
\large Modular CAD Orientation Cube for \LaTeX}
\author{\href{https://github.com/janniksvenson}{\textbf{Jannik Svenson}}}
\date{\cadcubeVersion \quad (\cadcubeDate)}
\maketitle
\thispagestyle{empty}

\begin{center}
  \vspace{-1.2em}
  \docbadge[https://ctan.org/pkg/cadcube]{CTAN}{cadcube}{blue!75!black}\quad
    \docbadge[https://github.com/janniksvenson/cadcube]{Release}{\cadcubeVersion}{blue!75!black}\quad
  \docbadge[https://doi.org/10.5281/zenodo.23695624]{DOI}{10.5281/zenodo.23695624}{blue!75!black}\quad
  \docbadge[https://www.latex-project.org/lppl/]{License}{LPPL 1.3c}{blue!75!black}\quad
  \docbadge[https://github.com/janniksvenson]{Author}{Jannik Svenson}{blue!75!black}
  \vspace{0.6em}
\end{center}

\begin{abstract}
\noindent The \texttt{cadcube} package provides modular, TikZ-based 3D and 2D orientation overlays similar to the ``Axis'' or ``View Cubes'' found in CAD, CFD, and scientific visualization software. It allows coordinate indicators to be overlaid dynamically on top of any LaTeX box, image, graphic, or TikZ figure with zero layout shift using either named cardinal anchors or precise percentage-based coordinates. The package features built-in coordinate presets, customizable camera projections, full control over vector geometry and colors, and automatic Z-buffer sorting.
\end{abstract}

{
  \hypersetup{hidelinks}
  \setlength{\parskip}{0pt}
  \small
  \tableofcontents
}

\newpage
% ==============================================================================
% 1. Preset Gallery
% ==============================================================================
\section{Preset Gallery}
The package comes with six built-in presets covering 3D solids, cylindrical/spherical systems, and 2D projections. Each preset configures geometry, axis vectors, and default labels:

\begin{table}[htbp]
  \centering
  \caption{The six primary built-in presets.}\label{tab:preset_gallery}
  \small
  \setlength{\tabcolsep}{2pt}
  \begin{tabular}{@{} *{6}{C{2.85cm}} @{}}
    \toprule
    \texttt{cartesian} & \texttt{cartesian-uvw} & \texttt{cylindrical} & \texttt{spherical} & \texttt{planar} & \texttt{polar} \\
    \midrule
    \demoBox[preset=cartesian] &
    \demoBox[preset=cartesian-uvw, view={cam(-50,60,10)}, show negative axes=true, shape scale=0.4, background color=gray!15, background shape=rounded, background margin=4pt] &
    \demoBox[preset=cylindrical, pie slice=true, arc radius=1.25] &
    \demoBox[preset=spherical, pie slice=true, arc radius=1.25] &
    \demoBox[preset=planar] &
    \demoBox[preset=polar, pie slice=true, arc radius=1.25] \\
    \bottomrule
  \end{tabular}
\end{table}

% ==============================================================================
% 2. Quick Start
% ==============================================================================
\section{Quick Start}
Load the package in your preamble. It automatically loads \texttt{tikz} and \texttt{xcolor}:
\begin{lstlisting}
\usepackage{cadcube}
\end{lstlisting}
To place an orientation overlay onto a graphic or figure box, wrap the object in the \texttt{\string\cadcubeoverlay} command. The content's natural bounding box dimensions are strictly preserved, ensuring zero layout shift. The overlay is anchored via \texttt{location} (e.g., \texttt{north east}, \texttt{south east}, or relative percentages):

\begin{figure}[htbp]
  \centering
  \begin{minipage}[c]{0.63\linewidth}
\begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
\begin{figure}[htbp]
  \centering
  \cadcubeoverlay[
    preset   = cartesian,
    view     = iso+++,
    location = south east
  ]{%
    % CAD Viewport canvas (blue background):
    \begin{tikzpicture}
      \draw[fill=blue!6, draw=blue!35, rounded corners=3pt]
        (0,0) rectangle (6.0, 3.0);
      % Centered placeholder for CAD model / graphic:
      \draw[fill=gray!15, draw=gray!35, rounded corners=2pt]
        (1.5, 0.75) rectangle (4.5, 2.25)
        node[pos=0.5, anchor=center, align = center, text=gray!70!black] {\textbf{CAD Model}};
    \end{tikzpicture}%
  }
  \caption{CAD viewport with indicator anchored at south east.}
\end{figure}
\end{lstlisting}
  \end{minipage}%
  \hfill
  \begin{minipage}[c]{0.35\linewidth}
    \centering
    \cadcubeoverlay[preset=cartesian, view=iso+++, location=south east]{%
      \begin{tikzpicture}
        \draw[fill=blue!6, draw=blue!35, rounded corners=3pt]
          (0,0) rectangle (6.0, 3.0);
        \draw[fill=gray!15, draw=gray!35, rounded corners=2pt]
        (1.5, 0.75) rectangle (4.5, 2.25)
        node[pos=0.5, anchor=center, align = center, text=gray!70!black] {\textbf{CAD Model}};
      \end{tikzpicture}%
    }
    \vspace{0.4em}
    \caption*{Rendered quick start output}
  \end{minipage}
\end{figure}

To place an orientation indicator on its own without wrapping an underlying figure (for example, in a standalone figure environment, a \texttt{wrapfigure}, a table cell, or inline in text), use the \texttt{\string\cadcube[...]} macro:
\begin{lstlisting}[basicstyle=\footnotesize\ttfamily]
\begin{figure}[htbp]
  \centering
  \cadcube[preset=cartesian, size=2.5cm, view=iso]
  \caption{Standalone orientation cube.}
\end{figure}
\end{lstlisting}
The standalone macro sets \texttt{margin=0pt} by default, ensuring tight bounding box extents just like an \texttt{\string\includegraphics} call.

You can also set default options globally for all subsequent figures via \texttt{\string\cadcubeset}:
\begin{lstlisting}
\cadcubeset{size=1.2cm, up=z, grayscale=false}
\end{lstlisting}

\newpage
% ==============================================================================
% 3. Options Reference
% ==============================================================================
\section{Options Reference}
All options can be passed locally to the \texttt{\string\cadcubeoverlay[...]} (or \texttt{\string\cadcube[...]}) macro or configured globally for all subsequent figures via \texttt{\string\cadcubeset\{...\}}. Each setting is demonstrated with a live rendered TikZ preview in the rightmost column.

\subsection{Core Settings \& Coordinate Frameworks}
The core settings configure the coordinate framework, base dimensions, content-relative anchoring positions, and camera projections.

\begin{table}[htbp]
  \centering
  \caption{Core settings, positioning anchors, and coordinate frame transformations.}
  \small
  \setlength{\tabcolsep}{3pt}
   \begin{tabular}{@{} M{2.5cm} M{2.5cm} M{7cm} M{2.5cm} C{\cadTableBoxW} @{}}
    \toprule
    \textbf{Option} & \textbf{Default} & \textbf{Description} & \textbf{Example} & \textbf{Preview} \\
    \midrule
    \texttt{preset} & \texttt{cartesian} & Loads a predefined set of properties (shape, colors, labels). & \texttt{cartesian-uvw} &
      \tableBox[preset=cartesian-uvw] \\[\cadTableRowSep]
    \texttt{size} & \texttt{10mm} & The global bounding box size of the overlay indicator. & \texttt{0.70cm} &
      \tableBox[preset=cartesian, size=0.70cm] \\[\cadTableRowSep]
    \texttt{location} & \texttt{south west} & Anchors overlay relative to content: \texttt{west}, \texttt{north west}, \texttt{north}, \texttt{north east}, \texttt{center}, ... or percentage \texttt{\{(75,30)\}}. & \texttt{north east} &
      \tableBox[preset=cartesian, location=north east] \\[\cadTableRowSep]
    \texttt{margin} & \texttt{5pt} & The distance between the anchor point and the overlay itself (also \texttt{margin X/Y}). & \texttt{2pt} &
      \tableBox[preset=cartesian, location=north east, margin=2pt] \\[\cadTableRowSep]
    \texttt{view} & \texttt{iso} & Camera projection mode or dynamic camera definition (see Section~\ref{sec:cameraviews}). & \texttt{iso-++} &
      \tableBox[preset=cartesian, view=iso-++] \\[\cadTableRowSep]
    \texttt{cam phi} & \texttt{45} & Azimuth angle (rotation around Z-axis in degrees) for dynamic camera. & \texttt{15} &
      \tableBox[preset=cartesian, view=cam, cam phi=15, cam theta=54.736] \\[\cadTableRowSep]
    \texttt{cam theta} & \texttt{54.736} & Zenith angle (elevation in degrees) for dynamic camera. \texttt{0} is top-down, \texttt{90} is horizontal, \texttt{54.736} is iso. & \texttt{30} &
      \tableBox[preset=cartesian, view=cam, cam phi=45, cam theta=30] \\[\cadTableRowSep]
    \texttt{cam roll} & \texttt{0} & 2D canvas rotation angle. Rotates projected cube without misaligning text labels. & \texttt{-20} &
      \tableBox[preset=cartesian, view=cam, cam phi=45, cam theta=54.736, cam roll=-20] \\[\cadTableRowSep]
    \texttt{up} & \texttt{z} & Defines vertical upward axis (\texttt{x, y, z}); automatically rotates other axes to preserve right-hand rule. & \texttt{y} &
      \tableBox[preset=cartesian, up=y] \\[\cadTableRowSep]
    \texttt{left handed} & \texttt{false} & If \texttt{true}, mirrors horizontal axes to create a left-handed coordinate system. & \texttt{true} &
      \tableBox[preset=cartesian, left handed=true] \\[\cadTableRowSep]
    \texttt{grayscale} & \texttt{false} & Overrides all colors with shades of gray/black for black-and-white printing. & \texttt{true} &
      \tableBox[preset=cartesian, grayscale=true] \\
    \bottomrule
  \end{tabular}
\end{table}

\subsubsection*{Spatial Anchoring \& Coordinate Frame Transformations}
\begin{itemize}
  \item \textbf{Anchoring Model:} The \texttt{location} parameter accepts either standard cardinal compass directions (\texttt{north west}, \texttt{north}, \texttt{north east}, \texttt{west}, \texttt{center}, \texttt{east}, \texttt{south west}, \texttt{south}, \texttt{south east}) or precise fractional percentage coordinates in the form \texttt{\{(x,y)\}}. In the percentage syntax, \texttt{\{(0,0)\}} anchors to the bottom-left corner and \texttt{\{(100,100)\}} to the top-right corner of the wrapped graphic. The \texttt{margin} parameter specifies an inward offset away from bounding borders.
  \item \textbf{Up-Vector Permutations:} In 3D graphics and engineering software, conventions vary widely (e.g., $+Z$ up in CAD and architectural software vs.\ $+Y$ up in computer graphics and game engines). The \texttt{up} option accepts \texttt{x, +x, -x, y, +y, -y, z, +z, -z}. The package automatically rotates the remaining axes according to the right-hand rule ($\vec{e}_x \times \vec{e}_y = \vec{e}_z$). Setting \texttt{left handed=true} mirrors the horizontal plane while respecting the selected vertical axis.
\end{itemize}

\subsection{Visibility Toggles}
All structural components---axes, planes, shapes, and text labels---can be toggled on or off independently to create minimalist indicators or emphasize specific features.

\begin{table}[htbp]
  \centering
  \caption{Independent visibility toggles for axes, planes, shapes, and labels.}
  \small
  \setlength{\tabcolsep}{3pt}
   \begin{tabular}{@{} M{2.5cm} M{2.5cm} M{7cm} M{2.5cm} C{\cadTableBoxW} @{}}
    \toprule
    \textbf{Option} & \textbf{Default} & \textbf{Description} & \textbf{Example} & \textbf{Preview} \\
    \midrule
    \texttt{show axes} & \texttt{true} & Toggles coordinate vectors (arrows) on/off. & \texttt{false} &
      \tableBox[preset=cartesian, show axes=false] \\[\cadTableRowSep]
    \texttt{show arrow tips} & \texttt{true} & Toggles arrowhead tips at vector ends (alias: \texttt{show vector tips}). & \texttt{false} &
      \tableBox[preset=cartesian, show arrow tips=false] \\[\cadTableRowSep]
    \texttt{show planes} & \texttt{true} & Toggles intersection/projection planes on/off. & \texttt{false} &
      \tableBox[preset=cartesian, show planes=false] \\[\cadTableRowSep]
    \texttt{show shape} & \texttt{true} & Toggles the base geometry (cube, cylinder, sphere, square, disk) on/off. & \texttt{false} &
      \tableBox[preset=cartesian, show shape=false] \\[\cadTableRowSep]
    \texttt{show labels} & \texttt{true} & Toggles text labels on the axes on/off. & \texttt{false} &
      \tableBox[preset=cartesian, show labels=false] \\[\cadTableRowSep]
    \texttt{show negative axes} & \texttt{false} & Draws negative tails of coordinate axes into negative quadrants. & \texttt{true} &
      \tableBox[preset=cartesian, show negative axes=true] \\[\cadTableRowSep]
    \texttt{pie slice} & \texttt{false} & Draws a filled ``pie slice'' to visualize angular variables ($\varphi, \theta$). & \texttt{true} &
      \tableBox[preset=spherical, pie slice=true, show planes=false, show shape=false] \\
    \bottomrule
  \end{tabular}
\end{table}

\subsubsection*{Modular Component Deconstruction}
Each structural element of the orientation indicator can be independently suppressed to suit specific requirements:
\begin{itemize}
  \item \textbf{Minimalist CAD Tripod:} Setting \texttt{show shape=false} and \texttt{show planes=false} strips all solid surfaces, leaving a clean, lightweight 3D coordinate cross (*axis tripod*) favored in dense technical schematics.
  \item \textbf{Solid Orientation Block:} Setting \texttt{show axes=false} retains only the shaded solid body with optional face labels, mimicking the navigation cube of modern CAD packages.
  \item \textbf{Angular Sweep Slices:} The \texttt{pie slice=true} option renders a tinted planar wedge visualizing the angular sweep of the azimuthal angle $\varphi$ and elevation angle $\theta$, providing an aid in cylindrical and spherical setups.
  \item \textbf{Negative Axis Extensions:} Setting \texttt{show negative axes=true} extends dashed or semi-transparent vectors into the negative octants, clarifying the origin location in multi-quadrant domains.
\end{itemize}

\newpage
\subsection{Geometry \& Layout}
These options control relative component scalings, line widths, arrow styles, and out-of-plane markers in 2D views.

\begin{table}[htbp]
  \centering
  \caption{Parametric geometry scaling, dimensions, and line styling.}
  \small
  \setlength{\tabcolsep}{3pt}
   \begin{tabular}{@{} M{2.5cm} M{2.5cm} M{7cm} M{2.5cm} C{\cadTableBoxW} @{}}
    \toprule
    \textbf{Option} & \textbf{Default} & \textbf{Description} & \textbf{Example} & \textbf{Preview} \\
    \midrule
    \texttt{shape} & \texttt{cube} & Base geometry solid: \texttt{cube}, \texttt{square}, \texttt{disk}, \texttt{cylinder}, \texttt{sphere}, \texttt{none}. & \texttt{cylinder} &
      \tableBox[preset=cylindrical] \\[\cadTableRowSep]
    \texttt{axes type} & \texttt{3D} & Coordinate vector logic: \texttt{3D}, \texttt{2D}, \texttt{cylindrical}, \texttt{spherical}, \texttt{polar}. & \texttt{2D} &
      \tableBox[axes type=2D, shape=square] \\[\cadTableRowSep]
    \texttt{shape scale} & \texttt{0.25} & Size of the geometric shape relative to the vector length. & \texttt{0.5} &
      \tableBox[preset=cartesian, shape scale=0.5] \\[\cadTableRowSep]
    \texttt{plane scale} & \texttt{1.00} & Size of intersection planes relative to the vectors. & \texttt{1.35} &
      \tableBox[preset=cartesian, plane scale=1.35] \\[\cadTableRowSep]
    \texttt{arrow length} & \texttt{1.00} & Primary length scaling factor for coordinate vectors (all sub-scales normalize to this). & \texttt{1.30} &
      \tableBox[preset=cartesian, arrow length=1.30] \\[\cadTableRowSep]
    \texttt{arrow line width} & \texttt{0.5pt} & Line thickness of the vector shafts. & \texttt{1.8pt} &
      \tableBox[preset=cartesian, arrow line width=1.8pt] \\[\cadTableRowSep]
    \texttt{arrow tip} & \texttt{Stealth} & Arrowhead style (\texttt{Stealth}, \texttt{Latex}, \texttt{Triangle}, \texttt{To}, \texttt{Circle}, \texttt{none}) or TikZ spec. & \texttt{Latex} &
      \tableBox[preset=cartesian, arrow tip=Latex] \\[\cadTableRowSep]
    \texttt{arrow tip length} & \texttt{3.5pt} & Arrowhead length with unit or factor of vector length (e.g. \texttt{0.4}). & \texttt{5pt} &
      \tableBox[preset=cartesian, arrow tip length=5pt] \\[\cadTableRowSep]
    \texttt{arrow tip width} & \texttt{2.5pt} & Arrowhead width with unit or factor of shaft line width (e.g. \texttt{6}). & \texttt{4pt} &
      \tableBox[preset=cartesian, arrow tip width=4pt] \\[\cadTableRowSep]
    \texttt{flat scale} & \texttt{1.50} & Relative size of out-of-plane markers ($\odot$, $\otimes$) in 2D orthogonal views. & \texttt{2.0} &
      \tableBox[preset=cartesian, view=+z, flat scale=2.0, show shape=false] \\[\cadTableRowSep]
    \texttt{label flat sep} & \texttt{2pt} & Radial spacing between out-of-plane markers ($\odot$, $\otimes$) and their axis label (alias: \texttt{flat gap}). & \texttt{4pt} &
      \tableBox[preset=cartesian, view=+z, label flat sep=4pt] \\[\cadTableRowSep]
    \texttt{inner axis style} & \texttt{densely dotted} & TikZ style applied to the portion of axes \textit{inside} the 3D shape. & \texttt{dashed, }\textcolor{gray}{\texttt{gray}} &
      \tableBox[preset=cartesian, inner axis style={dashed, gray, line width=0.8pt}] \\[\cadTableRowSep]
    \texttt{outer axis style} & \textit{none} & TikZ style applied to the portion of axes \textit{outside} the 3D shape. & \texttt{line width=1.8pt, densely dotted} &
      \tableBox[preset=cartesian, outer axis style={line width=1.8pt, densely dotted}] \\
    \bottomrule
  \end{tabular}
\end{table}

\subsubsection*{Proportional Scaling \& Orthogonal Glyphs}
\begin{itemize}
  \item \textbf{Geometric Proportions \& Master Scaling:} The parameter \texttt{arrow length} serves as the primary dimensionless multiplier on the base coordinate scale ($L = \texttt{arrow length} \times \texttt{size} \times 0.35$). The secondary layout keys \texttt{shape scale} ($0.25$ by default) and \texttt{plane scale} ($1.00$ by default) are strictly normalized relative to \texttt{arrow length}. A \texttt{shape scale} of $0.25$ guarantees that the central solid body occupies exactly one-quarter of the full vector span, ensuring axis arrows cleanly pierce through bounding faces.
  \item \textbf{Out-of-Plane Glyphs \& Flat Scaling:} In 2D orthogonal projections (such as viewing along the $Z$-axis in \texttt{view=+z}), 3D vector shafts collapse along the line of sight into a zero-length singularity. The package detects this foreshortening and substitutes the occluded or head-on vector with standard ISO drafting symbols: a circle with an inscribed dot ($\odot$) for an axis pointing towards the observer, and a circle with an inscribed cross ($\otimes$) for an axis pointing into the page away from the observer. The key \texttt{flat scale} (default: \texttt{1.50}) determines the circle radius via $r = (\texttt{flat scale} \times L) / (2\pi)$, scaling the glyph in exact proportion to the coordinate system. The label spacing is governed by \texttt{label flat sep} (default: \texttt{2pt}).
  \item \textbf{Dual-Segment Axis Styling:} The vectors are partitioned into an occluded segment (\emph{inside} the solid shape) and an exposed segment (\emph{outside}). By default, \texttt{inner axis style} is set to \texttt{densely dotted}, providing a natural x-ray depth cue.
  \item \textbf{Vector Tip Customization \& Factor Recognition:} The arrowhead can be selected from standard TikZ shapes (\texttt{arrow tip=Stealth}, \texttt{Latex}, \texttt{Triangle}, \texttt{To}, \texttt{Circle}) or suppressed entirely with \texttt{arrow tip=none} or \texttt{show arrow tips=false}. Both \texttt{arrow tip length} (default: \texttt{3.5pt}) and \texttt{arrow tip width} (default: \texttt{2.5pt}) feature intelligent unit parsing: if specified with a dimension unit (e.g., \texttt{4pt}, \texttt{2mm}), they define absolute dimensions; if specified as a dimensionless scalar (e.g., \texttt{arrow tip length=0.4} or \texttt{arrow tip width=6}), they scale automatically as a factor of the vector shaft length and line thickness, respectively. Setting \texttt{arrow tip scale=1.5} scales the tip uniformly.
\end{itemize}

\subsection{Labels \& Text}
Axis identifiers, typography, scaling factors, and shape face inscriptions can be tailored individually. By default, axis labels are automatically wrapped in math mode.

\begin{table}[htbp]
  \centering
  \caption{Label customization, font controls, and shape face inscriptions.}
  \small
  \setlength{\tabcolsep}{3pt}
  \setlength{\cadTableBoxH}{1.15cm}
  \setlength{\cadTableBoxSize}{0.85cm}
  \renewcommand{\cadTableRowSep}{0.5pt}
   \begin{tabular}{@{} M{2.5cm} M{2.5cm} M{7cm} M{2.5cm} C{\cadTableBoxW} @{}}
    \toprule
    \textbf{Option} & \textbf{Default} & \textbf{Description} & \textbf{Example} & \textbf{Preview} \\
    \midrule
    \texttt{label X} \newline \texttt{label Y} \newline \texttt{label Z} &
      \texttt{x} \newline \texttt{y} \newline \texttt{z} &
      Text labels for primary, secondary, and tertiary coordinate axes/angles. &
      \texttt{u} \newline \texttt{v} \newline \texttt{w} &
      \tableBox[preset=cartesian, label X=u, label Y=v, label Z=w] \\[\cadTableRowSep]
    \texttt{labels} & \texttt{\{x, y, z\}} & Shortcut for naming the three axes (automatically placed in math mode). & \texttt{\{x\_1, \string\mathbf\{Y\}, z\string^\string*\}} &
      \tableBox[preset=cartesian, labels={x_1, \mathbf{Y}, z^*}] \\[\cadTableRowSep]
    \texttt{label pos} & \texttt{end} & Position along vector: \texttt{end} (tip) or \texttt{mid} (shaft center; dynamically placed beside vertical axes). & \texttt{mid} &
      \tableBox[preset=cartesian, label pos=mid] \\[\cadTableRowSep]
    \texttt{label font} & \texttt{\string\sffamily}\newline\texttt{\string\bfseries} & Font styling applied to axis text labels. & \texttt{\string\rmfamily}\newline\texttt{\string\itshape} &
      \tableBox[preset=cartesian, label font=\rmfamily\itshape] \\[\cadTableRowSep]
    \texttt{label scale} & \texttt{1} & Scaling factor for axis text labels. & \texttt{0.2} &
      \tableBox[preset=cartesian, label scale=0.2] \\[\cadTableRowSep]
    \texttt{font size} & \texttt{\string\scriptsize} & Global font size for all labels (\LaTeX{} switch like \texttt{\string\footnotesize} or dimension like \texttt{8pt}). & \texttt{\string\footnotesize} &
      \tableBox[preset=cartesian, font size=\footnotesize] \\[\cadTableRowSep]
    \texttt{label font size} & \textit{none} & Font size specifically for axis/angle labels (overrides \texttt{font size}). & \texttt{\string\scriptsize} &
      \tableBox[preset=cartesian, label font size=\scriptsize] \\[\cadTableRowSep]
    \texttt{label inner sep} & \texttt{1.5pt} & Inner padding for axis, arc, and flat-mode label nodes. & \texttt{3pt} &
      \tableBox[preset=cartesian, label inner sep=3pt] \\[\cadTableRowSep]
    \texttt{arc radius} & \texttt{1.35} & Radial distance multiplier for angle labels ($\varphi, \theta$) in curved presets. & \texttt{0.65} &
      \tableBox[preset=polar, pie slice=true, arc radius=0.65] \\[\cadTableRowSep]
    \texttt{label math mode} & \texttt{true} & Wraps labels in \texttt{\$...}. Set to \texttt{false} for plain text or glossary macros. & \texttt{false} &
      \tableBox[preset=cartesian, label math mode=false, labels={U, V, W}] \\[\cadTableRowSep]
    \texttt{show face labels} & \texttt{false} & Toggles solid shape face text on/off (default inscriptions: $x, y, z$). & \texttt{true} &
      \tableBox[preset=cartesian, show face labels=true] \\[\cadTableRowSep]
    \texttt{faces} & \textit{none} & Shortcut to label the three visible positive faces: \texttt{\{Right, Top, Front\}}. & \texttt{\{+x, +y, +z\}} &
      \tableBox[preset=cartesian, faces={+x, +y, +z}] \\[\cadTableRowSep]
    \texttt{faces all} & \textit{none} & Shortcut to label all six solid faces: \texttt{\{+X, -X, +Y, -Y, +Z, -Z\}}. & \texttt{\{+X,-X,+Y,}\newline\texttt{-Y,+Z,-Z\}} &
      \tableBox[preset=cartesian, faces all={+X, -X, +Y, -Y, +Z, -Z}] \\[\cadTableRowSep]
    \texttt{face label col} & \textit{empty} & Color of text printed on shape faces (falls back to darkened axis color). & \textcolor{red}{\texttt{red}} &
      \tableBox[preset=cartesian, faces={Right, Front, Top}, face label col=red] \\[\cadTableRowSep]
    \texttt{face font size} \newline \texttt{face label font size} & \textit{none} & Font size specifically for shape face labels (alias: \texttt{face label font size}; overrides \texttt{font size}). & \texttt{\string\tiny} &
      \tableBox[preset=cartesian, show face labels=true, face font size=\tiny] \\[\cadTableRowSep]
    \texttt{face label scale} & \texttt{0.65} & Scaling factor for solid shape face text labels. & \texttt{0.4} &
      \tableBox[preset=cartesian, show face labels=true, face label scale=0.4] \\[\cadTableRowSep]
    \texttt{face label inner sep} & \texttt{1.0pt} & Inner padding for shape face label nodes. & \texttt{0pt} &
      \tableBox[preset=cartesian, show face labels=true, face label inner sep=0pt] \\
    \bottomrule
  \end{tabular}
\end{table}

\subsubsection*{Mathematical Typography \& Face Annotations}
\begin{itemize}
  \item \textbf{Math Mode Integration:} By default, \texttt{label math mode=true} automatically wraps each axis label in \verb|$...$|. This permits \LaTeX{} math notation such as subscripts or primes (e.g., \texttt{labels=\{x\_1,} \texttt{\string\mathbf\{Y\},} \texttt{z\string^\string*\}}). When using plain text macros or the \texttt{glossaries} package, set \texttt{label math mode=false}.
  \item \textbf{cadcube Face Labeling:} For solid cubes, face inscriptions can be enabled via \texttt{show face labels=true} (which defaults to $x, -x, y, -y, z, -z$). Custom text can be configured via \texttt{faces=\{Right, Top, Front\}} for the three visible positive faces, or \texttt{faces all=\{+X, -X, +Y, -Y, +Z, -Z\}} for all sides (both automatically enable \texttt{show face labels=true}). Face labels inherit the darkened axis color corresponding to their normal vector by default.
  \item \textbf{Angular Radius Offsets:} In curvilinear systems (\texttt{cylindrical}, \texttt{spherical}, \texttt{polar}), \texttt{arc radius} defines the radial multiplier for angle labels ($\varphi, \theta$). A value of $1.35$ positions the label $35\%$ outside the radius of the sweep arc.
  \item \textbf{Font Sizing \& Inner Padding:} Font sizes can be set globally with \texttt{font size} (accepting \LaTeX{} macros like \texttt{\string\footnotesize} or dimensions like \texttt{8pt}) or independently for coordinate axes via \texttt{label font size} and shape faces via \texttt{face font size} (alias: \texttt{face label font size}). Node padding around text bounding boxes is configured via \texttt{label inner sep} (default: \texttt{1.5pt}) and \texttt{face label inner sep} (default: \texttt{1.0pt}).
\end{itemize}

\subsection{Colors, Opacities \& Backgrounds}
Colors, transparencies, and background patches can be adjusted to maintain optimal contrast across dark CAD viewports, technical blueprints, and scientific heatmaps.

\begin{table}[htbp]
  \centering
  \caption{Color customization, transparency controls, and background patches.}
  \small
  \setlength{\tabcolsep}{3pt}
  \begin{tabular}{@{} M{2.5cm} M{2.5cm} M{7cm} M{2.5cm} C{\cadTableBoxW} @{}}
    \toprule
    \textbf{Option} & \textbf{Default} & \textbf{Description} & \textbf{Example} & \textbf{Preview} \\
    \midrule
    \texttt{col X} \newline \texttt{col Y} \newline \texttt{col Z} &
      \textcolor{red!85!black}{\texttt{red!85!black}} \newline \textcolor{green!65!black}{\texttt{green!65!black}} \newline \textcolor{blue!80!black}{\texttt{blue!80!black}} &
      Explicit colors for individual coordinate axes (and associated planes). &
      \textcolor{cyan!80!blue}{\texttt{cyan!80!blue}} \newline \textcolor{orange!90!black}{\texttt{orange!90!black}} \newline \textcolor{purple}{\texttt{purple}} &
      \tableBox[preset=cartesian, col X=cyan!80!blue, col Y=orange!90!black, col Z=purple] \\[\cadTableRowSep]
    \texttt{col plane XY} \newline \texttt{col plane XZ} \newline \texttt{col plane YZ} &
      \textcolor{blue!45}{\texttt{blue!45}} \newline \textcolor{green!45}{\texttt{green!45}} \newline \textcolor{red!45}{\texttt{red!45}} &
      Colors for intersecting coordinate planes (default: matching axes). &
      \textcolor{orange!90!black}{\texttt{orange!90!black}} \newline \textcolor{cyan!80!blue}{\texttt{cyan!80!blue}} \newline \textcolor{purple}{\texttt{purple}} &
      \tableBox[preset=cartesian, col plane XY=orange!90!black, col plane XZ=cyan!80!blue, col plane YZ=purple] \\[\cadTableRowSep]
    \texttt{col shape edge} & \texttt{none} & Wireframe edge color: \texttt{none} (borderless), \texttt{auto} (\textcolor{black!80}{\texttt{black!80}} for cube/square, \colorbox{gray!75}{\textcolor{white}{\texttt{white}}} for sphere), or explicit color. & \textcolor{black!80}{\texttt{black!80}} &
      \tableBox[preset=cartesian, col shape edge=black!80] \\[\cadTableRowSep]
    \texttt{opacity front} & \texttt{0.50} & Opacity of faces facing camera (1.0 = fully opaque). & \texttt{1.0} &
      \tableBox[preset=cartesian, opacity front=1.0] \\[\cadTableRowSep]
    \texttt{opacity planes} & \texttt{0.35} & Opacity of intersecting coordinate planes. & \texttt{0.15} &
      \tableBox[preset=cartesian, opacity planes=0.15] \\[\cadTableRowSep]
    \texttt{opacity back} & \texttt{1.00} & Opacity of rear-facing walls to enhance 3D depth. & \texttt{0.30} &
      \tableBox[preset=cartesian, opacity back=0.30, opacity front=0.20] \\[\cadTableRowSep]
    \texttt{opacity axes} & \texttt{1.0} & Opacity of primary coordinate axis vectors. & \texttt{0.4} &
      \tableBox[preset=cartesian, opacity axes=0.4] \\[\cadTableRowSep]
    \texttt{opacity negative axes} & \texttt{0.5} & Opacity of negative axis extensions in negative octants. & \texttt{0.8} &
      \tableBox[preset=cartesian, show negative axes=true, opacity negative axes=0.8] \\[\cadTableRowSep]
    \texttt{darken mix} & \texttt{60} & Mix ratio (remaining color in percent) for auto-generated label and marker colors with black. & \texttt{20} &
      \tableBox[preset=cartesian, view=+x, darken mix=20] \\[\cadTableRowSep]
    \texttt{marker col} & \textit{empty} & Explicit color for out-of-plane 2D markers (falls back to darkened axis color). & \textcolor{red}{\texttt{red}} &
      \tableBox[preset=cartesian, view=+z, marker col=red, show shape=false] \\[\cadTableRowSep]
    \texttt{background color} & \texttt{none} & Adds a distinct background shape behind the CAD cube. & \textcolor{yellow!50!black}{\texttt{yellow!25}} &
      \tableBox[preset=cartesian, background color=yellow!25, background shape=rounded, background margin=4pt] \\[\cadTableRowSep]
    \texttt{background shape} & \texttt{rectangle} & Shape of background card: \texttt{rectangle}, \texttt{rounded}, or \texttt{circle}. & \texttt{rounded} &
      \tableBox[preset=cartesian, background color=yellow!25, background shape=rounded] \\[\cadTableRowSep]
    \texttt{background margin} & \texttt{5pt} & Padding around vectors for background card (also \texttt{background margin X/Y}). & \texttt{2pt} &
      \tableBox[preset=cartesian, background color=yellow!25, background margin=2pt] \\[\cadTableRowSep]
    \texttt{background corner radius} & \texttt{4pt} & Corner rounding radius for \texttt{background shape=rounded} cards. & \texttt{8pt} &
      \tableBox[preset=cartesian, background color=yellow!25, background shape=rounded, background corner radius=8pt] \\
    \bottomrule
  \end{tabular}
\end{table}

\subsubsection*{Depth Cues, Print Compliance \& Background Contrast}
\begin{itemize}
  \item \textbf{Dual-Opacity Depth Perception:} In 2D line projections of 3D cubes, visual ambiguity (the Necker cube illusion) frequently occurs. \texttt{cadcube} resolves this by using an asymmetric dual opacity: front-facing polygons are drawn with \texttt{opacity front=0.5} (semi-transparent glass), while rear-facing polygons are shaded with \texttt{opacity back=1.00} (opaque solid wall). Planes are tuned separately with \texttt{opacity planes=0.35}.
  \item \textbf{Wireframe Edges \& Contextual Tinting:} By default, solid bodies feature borderless facets (\texttt{col shape edge=none}). Setting \texttt{col shape edge=auto} dynamically assigns a high-contrast wireframe outline: \textcolor{black!80}{\texttt{black!80}} for polyhedral cubes and squares, and \colorbox{gray!75}{\textcolor{white}{\texttt{white}}} for dark spherical bodies. Explicit colors (e.g., \texttt{col shape edge=}\textcolor{gray}{\texttt{gray}}) can also be provided.
  \item \textbf{Monochrome Printing:} Enabling \texttt{grayscale=true} overrides all colorful RGB/CMYK tints with calibrated monochrome luminance levels ($80\%$, $55\%$, and $30\%$ black for axes; $10\%$, $20\%$, and $30\%$ for planes), ensuring crisp legibility in black-and-white journals and proceedings.
  \item \textbf{Contrast Backdrop Patches \& Margin Control:} When overlaying complex multicolored backgrounds (e.g., turbulent simulation fields or dark CAD viewports), setting \texttt{background color=}\textcolor{gray!80!black}{\texttt{white!90!black}} with \texttt{background shape=rounded} renders a clean, isolated card behind the orientation cube. The padding between coordinate shafts and the boundary is configured via \texttt{background margin=5pt} (or independently via \texttt{background margin X} and \texttt{background margin Y}).
\end{itemize}

\newpage
% ==============================================================================
% 4. Camera Projections & Viewing Angles
% ==============================================================================
\section{Camera Views and Projection Modes}\label{sec:cameraviews}
The \texttt{cadcube} package provides an expressive projection engine supporting more than 100 standardized engineering views alongside continuous, free-form camera positioning. 

To guarantee graphical correctness across complex semi-transparent bodies, intersecting planes, and penetrating axis arrows, the engine implements an automatic eleven-layer Z-buffering pipeline:
\begin{center}
  \footnotesize
  \texttt{cadcubebg} $\rightarrow$ \texttt{cadcubebackoutvec} $\rightarrow$ \texttt{cadcubeback} $\rightarrow$ \texttt{cadcubebackinvec} $\rightarrow$ \texttt{cadcubeplanes} $\rightarrow$ \texttt{cadcubecross} \\
  $\rightarrow$ \texttt{cadcubefrontinvec} $\rightarrow$ \texttt{main} $\rightarrow$ \texttt{cadcubefront} $\rightarrow$ \texttt{cadcubefrontoutvec} $\rightarrow$ \texttt{cadcubedot}
\end{center}
This multi-stage depth sorting ensures that back-facing faces and background vectors are rendered behind coordinate planes, while interior dashed segments and front-facing faces naturally occlude background geometry without manual intervention.

\subsection{Orthogonal 2D Views \& Automatic Flat-Mode Detection}
Orthogonal 2D views are selected using cardinal axes (\texttt{view=+x}, \texttt{view=-x}, \texttt{view=+y}, \texttt{view=-y}, \texttt{view=+z}, \texttt{view=-z}) or planar aliases (\texttt{xy}, \texttt{xz}, \texttt{yz}). In engineering and CAD conventions, vertical alignment is preserved across orthographic projections: in top view (\texttt{view=+z}), $+Y$ points up on canvas while $+X$ points right; in bottom view (\texttt{view=-z}), $+Y$ remains pointing up while $+X$ points left.

When the line of sight aligns parallel to a coordinate axis, that axis foreshortens to zero length. Instead of drawing an invisible point or a collapsed line, \texttt{cadcube} automatically detects this singularity and substitutes the vector with standardized engineering drafting symbols:
\begin{itemize}
  \item $\odot$ (\textbf{Dot Marker}): Indicates a vector pointing directly out of the page toward the observer.
  \item $\otimes$ (\textbf{Cross Marker}): Indicates a vector pointing directly into the page away from the observer.
\end{itemize}
Importantly, this singularity detection is computed dynamically from the projected 2D vector length: whenever \emph{any} projection angle---including continuous spherical camera views (\texttt{view=\{cam(phi, theta, roll)\}}) or oblique modes---aligns with a coordinate axis such that its canvas length drops below $0.1\,\text{pt}$, the engine automatically substitutes the vector with $\odot$ or $\otimes$ without requiring manual intervention. Labels corresponding to the out-of-plane axis are displaced radially outward to prevent collisions with the marker. The marker diameter can be scaled using \texttt{flat scale} (default: \texttt{1.50}), its label spacing via \texttt{label flat sep} (default: \texttt{2pt}), and its color can be explicitly controlled with \texttt{marker col}.

\begin{table}[htbp]
  \centering
  \caption{Standard orthogonal views with automatic flat-mode vector substitution.}\label{tab:orthogonal_views}
  \begin{minipage}{2.5cm}\centering\tableBox[view=+x]\subcaption*{\texttt{view=+x}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-x]\subcaption*{\texttt{view=-x}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=+y]\subcaption*{\texttt{view=+y}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-y]\subcaption*{\texttt{view=-y}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=+z, show shape=false]\subcaption*{\texttt{view=+z}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-z, show shape=false]\subcaption*{\texttt{view=-z}}\end{minipage}%
\end{table}

\subsection{Axonometric Projections (Isometric, Dimetric, Trimetric)}
Axonometric projections project 3D space perpendicularly onto the drawing canvas. Three distinct geometric families are provided:
\begin{itemize}
  \item \textbf{Isometric (\texttt{iso})}: All three coordinate axes subtend equal $120^\circ$ angles with identical 1:1:1 scale factors. This is the industry standard for balanced technical overviews.
  \item \textbf{Dimetric (\texttt{dimetric})}: Two coordinate axes have equal angles and foreshortening ratios, providing a natural elevated viewing perspective with reduced vertical distortion.
  \item \textbf{Trimetric (\texttt{trimetric})}: All three coordinate axes have distinct foreshortening ratios and angular separations, maximizing visible face area and spatial differentiation.
\end{itemize}
Each family supports all 8 corner octants by appending three signs (\texttt{+++}, \texttt{+-+}, \texttt{--+}, \texttt{-++}, \texttt{+--}, \texttt{++-}, \texttt{-+-}, \texttt{---}) to position the camera in the corresponding octant (Table~\ref{tab:axonometric_corners}).

\begin{table}[htbp]
  \centering
  \caption{All 8 corner octants for the three axonometric projection families.}\label{tab:axonometric_corners}
  \small\textbf{Isometric (\texttt{iso})}\\[0.2em]
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso+++}\subcaption*{\texttt{+++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso+-+}\subcaption*{\texttt{+-+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso--+}\subcaption*{\texttt{--+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso-++}\subcaption*{\texttt{-++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso+--}\subcaption*{\texttt{+--}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso++-}\subcaption*{\texttt{++-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso-+-}\subcaption*{\texttt{-+-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=iso---}\subcaption*{\texttt{---}}\end{minipage}\\[0.5em]
  \small\textbf{Dimetric (\texttt{dimetric})}\\[0.2em]
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric+++}\subcaption*{\texttt{+++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric+-+}\subcaption*{\texttt{+-+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric--+}\subcaption*{\texttt{--+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric-++}\subcaption*{\texttt{-++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric+--}\subcaption*{\texttt{+--}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric++-}\subcaption*{\texttt{++-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric-+-}\subcaption*{\texttt{-+-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=dimetric---}\subcaption*{\texttt{---}}\end{minipage}\\[0.5em]
  \small\textbf{Trimetric (\texttt{trimetric})}\\[0.2em]
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric+++}\subcaption*{\texttt{+++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric+-+}\subcaption*{\texttt{+-+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric--+}\subcaption*{\texttt{--+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric-++}\subcaption*{\texttt{-++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric+--}\subcaption*{\texttt{+--}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric++-}\subcaption*{\texttt{++-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric-+-}\subcaption*{\texttt{-+-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=trimetric---}\subcaption*{\texttt{---}}\end{minipage}%
\end{table}

\subsection{Oblique Projections (Cabinet, Cavalier, Military)}
Unlike axonometric projections where projection rays are strictly orthogonal to the viewing canvas, oblique projections project rays at an angle. This unique mathematical property ensures that one primary coordinate plane remains completely undistorted with true $90^\circ$ angles and undistorted dimensions, while depth axes recede at an angle $\alpha$:
\begin{itemize}
  \item \textbf{Cabinet (\texttt{cabinet})}: Frontal faces preserve true shape and dimensions, while depth axes recede at $45^\circ$ with a 50\% foreshortening ratio ($v = 0.5$). This avoids the exaggerated visual elongation typical of full-scale depth.
  \item \textbf{Cavalier (\texttt{cavalier})}: Frontal faces preserve true shape, while depth axes recede at $45^\circ$ without foreshortening ($v = 1.0$), preserving true measurable dimensions along all three directions.
  \item \textbf{Military (\texttt{military})}: A plan-oblique projection where the horizontal $x$-$y$ floor plane remains completely undistorted at a true $90^\circ$ angle, while the vertical $z$-axis extends straight up.
\end{itemize}
Like axonometric views, all oblique projections support all 8 corner octants (Table~\ref{tab:oblique_corners}).

\begin{table}[htbp]
  \centering
  \caption{All 8 corner octants for the three oblique projection families.}\label{tab:oblique_corners}
  \small\textbf{Cabinet (\texttt{cabinet}, $v=0.5$)}\\[0.2em]
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet+++}\subcaption*{\texttt{+++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet+-+}\subcaption*{\texttt{+-+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet--+}\subcaption*{\texttt{--+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet-++}\subcaption*{\texttt{-++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet+--}\subcaption*{\texttt{+--}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet++-}\subcaption*{\texttt{++-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet-+-}\subcaption*{\texttt{-+-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cabinet---}\subcaption*{\texttt{---}}\end{minipage}\\[0.5em]
  \small\textbf{Cavalier (\texttt{cavalier}, $v=1.0$)}\\[0.2em]
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier+++}\subcaption*{\texttt{+++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier+-+}\subcaption*{\texttt{+-+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier--+}\subcaption*{\texttt{--+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier-++}\subcaption*{\texttt{-++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier+--}\subcaption*{\texttt{+--}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier++-}\subcaption*{\texttt{++-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier-+-}\subcaption*{\texttt{-+-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=cavalier---}\subcaption*{\texttt{---}}\end{minipage}\\[0.5em]
  \small\textbf{Military (\texttt{military}, plan-oblique)}\\[0.2em]
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military+++}\subcaption*{\texttt{+++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military+-+}\subcaption*{\texttt{+-+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military--+}\subcaption*{\texttt{--+}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military-++}\subcaption*{\texttt{-++}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military+--}\subcaption*{\texttt{+--}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military++-}\subcaption*{\texttt{++-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military-+-}\subcaption*{\texttt{-+-}}\end{minipage}\hfill%
  \begin{minipage}{2.0cm}\centering\cadBoxTwo{view=military---}\subcaption*{\texttt{---}}\end{minipage}%
\end{table}

\subsection{The 12 Canonical Edge Projections}
In addition to corner views, the cube can be observed directly along each of its 12 edges. Because each edge projection squarely bisects adjacent bounding faces, the resulting alignment is identical across all projection families (Table~\ref{tab:edge_views}). Specifying \texttt{view=+x+y}, \texttt{view=iso+x+y}, \texttt{view=dimetric+x+y}, or \texttt{view=cabinet+x+y} all resolve to the exact same canonical edge projection.

\begin{table}[htbp]
  \centering
  \caption{The 12 canonical edge projections, identical across all projection families.}\label{tab:edge_views}
  \begin{minipage}{2.5cm}\centering\tableBox[view=+x+y]\subcaption*{\texttt{+x+y}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-x+y]\subcaption*{\texttt{-x+y}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-x-y]\subcaption*{\texttt{-x-y}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=+x-y]\subcaption*{\texttt{+x-y}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=+x+z]\subcaption*{\texttt{+x+z}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-x+z]\subcaption*{\texttt{-x+z}}\end{minipage}\\[0.5em]
  \begin{minipage}{2.5cm}\centering\tableBox[view=-x-z]\subcaption*{\texttt{-x-z}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=+x-z]\subcaption*{\texttt{+x-z}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=+y+z]\subcaption*{\texttt{+y+z}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-y+z]\subcaption*{\texttt{-y+z}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=-y-z]\subcaption*{\texttt{-y-z}}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[view=+y-z]\subcaption*{\texttt{+y-z}}\end{minipage}%
\end{table}

\subsection{Dynamic Spherical Camera \& Dynamic Oblique Projections}
For seamless integration with 3D CAD and scientific visualization tools, \texttt{cadcube} allows arbitrary continuous camera positions defined via spherical coordinates or affine shearing:

\subsubsection{Continuous Spherical Coordinates (\texttt{cam})}
\noindent
\begin{minipage}[c]{0.54\linewidth}
  You can position the camera dynamically in 3D space using:
\end{minipage}\hfill
\begin{minipage}[c]{0.45\linewidth}
\begin{lstlisting}
view={cam(phi, theta, roll)}
\end{lstlisting}
\end{minipage}

\noindent Alternatively, individual keys can be specified: \texttt{view=cam, cam phi=..., cam theta=..., cam roll=...}.
\begin{itemize}
  \item \textbf{$\phi$ (\texttt{cam phi})}: Azimuth angle in degrees (rotation around the vertical $Z$-axis within the $X$-$Y$ plane, $0^\circ$ to $360^\circ$).
  \item \textbf{$\theta$ (\texttt{cam theta})}: Zenith / elevation angle in degrees. $\theta = 0^\circ$ corresponds to a straight top-down plan view, $\theta = 90^\circ$ corresponds to a horizontal side elevation, and $\theta \approx 54.74^\circ$ corresponds to standard isometric elevation.
  \item \textbf{\texttt{roll} (\texttt{cam roll})}: 2D canvas rotation angle. While \texttt{roll} rotates the entire projected coordinate geometry, all text labels are automatically upright-compensated and remain readable.
\end{itemize}

\begin{table}[htbp]
  \centering
  \caption{Dynamic spherical camera views (\texttt{view=cam}): variations across elevation ($\theta$), azimuth ($\phi$), and canvas rotation (\texttt{roll}).}\label{tab:camera_spherical}
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view=cam, cam phi=45, cam theta=0]\subcaption*{$\theta=0^\circ$ (top-down)}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view=cam, cam phi=45, cam theta=15]\subcaption*{$\theta=15^\circ$}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view=cam, cam phi=45, cam theta=30]\subcaption*{$\theta=30^\circ$}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view=cam, cam phi=45, cam theta=54.736]\subcaption*{$\theta=54.74^\circ$ (iso)}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view=cam, cam phi=15, cam theta=30]\subcaption*{$\phi=15^\circ$}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view=cam, cam phi=45, cam theta=30, cam roll=-20]\subcaption*{\texttt{roll=-20}}\end{minipage}%
\end{table}

\subsubsection{Continuous Affine Oblique Shear (\texttt{oblique})}
\noindent
\begin{minipage}[c]{0.54\linewidth}
  Arbitrary affine oblique projections can be customized using:
\end{minipage}\hfill
\begin{minipage}[c]{0.45\linewidth}
\begin{lstlisting}
view={oblique(v, alpha, axis, roll)}
\end{lstlisting}
\end{minipage}

\vspace{0.2em}
\noindent where $v$ is the depth scale ratio ($0.5$ for cabinet, $1.0$ for cavalier), $\alpha$ is the recession angle in degrees ($30^\circ$, $45^\circ$, or $60^\circ$), $\text{axis}$ specifies the receding depth axis (\texttt{x}, \texttt{y}, or \texttt{z}), and $\text{roll}$ applies 2D canvas rotation. Alternatively, individual keys can be specified directly: \texttt{view=oblique, obl v=..., obl alpha=..., obl axis=..., obl roll=...}.

\begin{table}[htbp]
  \centering
  \caption{Dynamic affine oblique projections (\texttt{view=oblique}): variations across depth scale ($v$), recession angle ($\alpha$), depth axis, and canvas rotation (\texttt{roll}).}\label{tab:camera_oblique}
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view={oblique(0.25, 45, y, 0)}]\subcaption*{$v=0.25$ (shallow)}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view={oblique(0.5, 45, y, 0)}]\subcaption*{$v=0.5$ (Cabinet)}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view={oblique(1.0, 45, y, 0)}]\subcaption*{$v=1.0$ (Cavalier)}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view={oblique(0.5, 30, y, 0)}]\subcaption*{$\alpha=30^\circ$}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view={oblique(0.5, 60, z, 0)}]\subcaption*{Axis $z$, $\alpha=60^\circ$}\end{minipage}\hfill%
  \begin{minipage}{2.5cm}\centering\tableBox[preset=cartesian, view={oblique(0.5, 45, -x, 15)}]\subcaption*{Axis $-x$, \texttt{roll=15}}\end{minipage}%
\end{table}

\makeatletter
\tikzset{
  cadcube@proj@mycustomview/.style = {
    x={(0.8cm, -0.1cm)},
    y={(0.4cm,  0.7cm)},
    z={(-0.2cm, 0.9cm)}
  },
  /cadcube/my-cylindrical/.style={
    shape=cylinder,
    axes type=cylindrical,
    labels={r^*, \varphi, h},
    col X=blue!85!black, col Y=red!85!black, col Z=black,
    up=y
  }
}
\makeatother

\newpage
% ==============================================================================
% 5. Advanced Customization
% ==============================================================================
\section{Advanced Customization}
\label{sec:customization}
The \texttt{cadcube} package provides flexible extension points to define custom presets, integrate user-defined affine projection matrices, and fine-tune axis stroke styling.

\subsection{Creating Custom Presets}
If you frequently require a specialized indicator configuration (e.g., custom variable names, specialized brand colors, or alternative vertical axes), you can define a reusable style via \texttt{\string\tikzset}:

\begin{figure}[htbp]
  \centering
  \begin{minipage}{0.70\linewidth}
\begin{lstlisting}
\tikzset{
  /cadcube/my-cylindrical/.style={
    shape=cylinder,
    axes type=cylindrical,
    labels={r^*, \varphi, h},
    col X=blue!85!black, col Y=red!85!black, col Z=black,
    up=y
  }
}
% Usage:
\cadcubeoverlay[preset=my-cylindrical, pie slice=true]{...}
\end{lstlisting}
  \end{minipage}%
  \hfill
  \begin{minipage}{0.28\linewidth}
    \centering
    \tableBox[preset=my-cylindrical, pie slice=true, arc radius=1.25, size=1.05cm]
    \caption*{Rendered \texttt{my-cylindrical}}
  \end{minipage}
\end{figure}

\subsection{Defining Custom Camera Views}
If standard orthogonal, axonometric, or dynamic spherical views are not sufficient, you can define arbitrary projection matrices via standard TikZ coordinate system mappings. Because the package uses internal \texttt{@} macros for projection namespaces, definitions should be enclosed in \texttt{\string\makeatletter} \dots \texttt{\string\makeatother}:

\begin{figure}[htbp]
  \centering
  \begin{minipage}{0.70\linewidth}
\begin{lstlisting}
\makeatletter
\tikzset{
  cadcube@proj@mycustomview/.style = {
    x={(0.8cm, -0.1cm)},
    y={(0.4cm,  0.7cm)},
    z={(-0.2cm, 0.9cm)}
  }
}
\makeatother
% Usage:
\cadcubeoverlay[view=mycustomview]{...}
\end{lstlisting}
  \end{minipage}%
  \hfill
  \begin{minipage}{0.28\linewidth}
    \centering
    \tableBox[view=mycustomview, size=1.05cm]
    \caption*{Rendered \texttt{mycustomview}}
  \end{minipage}
\end{figure}

\noindent
\textbf{Note:} Custom TikZ views fall back to default \texttt{iso} Z-buffer sorting. For complex viewpoints requiring dynamic polygon face-sorting, prefer the dynamic spherical camera \texttt{view=\{cam(phi, theta, roll)\}}.

\subsection{Inner and Outer Axis Styling}
By default, the segment of an axis penetrating \emph{inside} the 3D shape is rendered with \texttt{densely dotted} styling to indicate occlusion, while the \emph{outer} portion is drawn solid. Both segments can be styled independently using standard TikZ stroke options:

\begin{figure}[htbp]
  \centering
  \begin{minipage}{0.70\linewidth}
\begin{lstlisting}
\cadcubeset{
  inner axis style={dashed, gray, line width=0.6pt},
  outer axis style={solid, line width=1.1pt}
}
\end{lstlisting}
  \end{minipage}%
  \hfill
  \begin{minipage}{0.28\linewidth}
    \centering
    \tableBox[inner axis style={dashed, gray, line width=0.6pt}, outer axis style={solid, line width=1.1pt}, size=1.05cm]
    \caption*{Custom axis stroke styles}
  \end{minipage}
\end{figure}

\noindent
Setting \texttt{show shape=false} bypasses shape boundary clipping and renders each vector as a single continuous line using \texttt{outer axis style}.

% ==============================================================================
% 6. References
% ==============================================================================
\section{References}
\label{sec:references}
\begin{thebibliography}{9}
  \bibitem{tikz} T.~Tantau et~al. \emph{PGF/TikZ: A Portable Graphic Format for \TeX}. \url{https://ctan.org/pkg/pgf}.
  \bibitem{xcolor} U.~Kern. \emph{Extending \LaTeX's color facilities: the xcolor package}. \url{https://ctan.org/pkg/xcolor}.
\end{thebibliography}

\end{document}
