% \section{Evaluation}
% \label{app:eval}

% \subsection{Evaluation of CP Code Generation}
% \label{app:eval_code}

% \subsection{Evaluation of }

\section{Detailed Explanation of Origami Compiler Error Feedback System} % Changed to \section
\label{app:eval_1}

The following is a detailed supplementary explanation of the origami compiler error feedback system, including more specific error types, possible error messages, relevant parameters, and their underlying principles.

\subsection{CP Code Syntax Error}
This type of error occurs in the initial phase when the compiler parses the Crease Pattern (CP) code provided by the user, if the code does not conform to predefined syntax rules.

\subsubsection{More Details}
\begin{itemize}
    \item \textbf{Example Error Codes:}
    \begin{itemize}
        \item \texttt{E\_CP\_SYNTAX\_INVALID\_PARAM\_COUNT}: "Instruction '$COMMAND$' has an insufficient or excessive number of parameters. Expected $X$, got $Y$."
        \item \texttt{E\_CP\_SYNTAX\_UNKNOWN\_COMMAND}: "Unrecognized instruction '$COMMAND$'. Please check spelling or the instruction set."
        \item \texttt{E\_CP\_SYNTAX\_INVALID\_PARAM\_TYPE}: "Parameter '$PARAM\_NAME$' for instruction '$COMMAND$' has an invalid type. Expected type '$EXPECTED\_TYPE$', but received value '$VALUE$' of type '$ACTUAL\_TYPE$'."
        \item \texttt{E\_CP\_SYNTAX\_VALUE\_OUT\_OF\_RANGE}: "Value '$VALUE$' for parameter '$PARAM\_NAME$' of instruction '$COMMAND$' is out of the allowed range $[MIN\_VAL, MAX\_VAL]$."
        \item \texttt{E\_CP\_SYNTAX\_UNEXPECTED\_TOKEN}: "Unexpected symbol/character '$TOKEN$' encountered at line number $[line\_number]$, column $[col\_number]$ while parsing instruction '$COMMAND$'."
        \item \texttt{E\_CP\_SYNTAX\_MISSING\_DELIMITER}: "Instruction '$COMMAND$' is missing a required delimiter. For example, the expected '$EXPECTED\_DELIMITER$' was not found."
        \item \texttt{E\_CP\_SYNTAX\_INVALID\_LINE\_REFERENCE}: "Instruction '$COMMAND$' references a non-existent line ID '$LINE\_ID$' or point ID '$POINT\_ID$'."
    \end{itemize}
    \item \textbf{faulty\_cp\_code\_line\_numbers}: $[line\_number]$ - The specific code line where the error occurred.
    \item \textbf{faulty\_token\_or\_command}: (Optional) Indicates the specific instruction or token that caused the error.
\end{itemize}

\subsubsection{Underlying Principles}
\begin{itemize}
    \item \textbf{Formal Language and Grammar:} CP code is treated as a formal language with precisely defined lexical and syntax rules.
    \item \textbf{Parsing Stages:}
        \begin{enumerate}
            \item \textbf{Lexical Analysis:} Code text is broken into "tokens."
            \item \textbf{Syntax Analysis:} Token sequence is checked against grammar rules, often building an Abstract Syntax Tree (AST).
        \end{enumerate}
    \item \textbf{Error Detection:} Errors are reported if tokens or their sequence violate rules, preventing further compilation.
\end{itemize}

\subsection{Geometrically Impossible Fold}
This error indicates that some defined folding operations are physically or geometrically unfeasible.

\subsubsection{More Details}
\begin{itemize}
    \item \textbf{Example Error Codes:}
    \begin{itemize}
        \item \texttt{E\_GEOM\_TOO\_MANY\_LAYERS}: "Folding near $(x,y)$ would result in $N$ paper layers, exceeding the limit of $M$ layers."
            \begin{itemize}
                \item \texttt{max\_allowable\_layers}: Maximum allowed layers.
                \item \texttt{calculated\_layers\_at\_point}: Calculated layers at the point.
            \end{itemize}
        \item \texttt{E\_GEOM\_ANGLE\_CONSTRAINT\_VIOLATION}: "Target angle $[\theta_{target}]$ of crease $[id]$ conflicts with existing angles $[\alpha_1, \dots, \alpha_{2n}]$ at vertex $[vertex\_coordinates]$."
            \begin{itemize}
                \item \textbf{Specific reasons may include:}
                    \begin{itemize}
                        \item "Maekawa-Justin: $|M-V| \neq 2$."
                        \item "Kawasaki-Justin: $\sum (-1)^i \alpha_i \neq 0$ or alternate sums $\neq \pi$ for flat-folds."
                        \item "Angle sum around vertex $\neq 2\pi$ (internal) or $\pi$ (boundary)."
                        \item "Single crease angle is too large or small."
                    \end{itemize}
                \item \texttt{conflicting\_crease\_ids\_and\_angles}: IDs and angles of conflicting creases.
            \end{itemize}
        \item \texttt{E\_GEOM\_CREASE\_PLACEMENT\_INVALID}: "Endpoints of crease $[id]$ are outside paper, or crease illegally intersects boundary."
        \item \texttt{E\_GEOM\_LENGTH\_CONSTRAINT\_VIOLATION}: "Operation requires points $[A]$ and $[B]$ to coincide, but original distance $d_1$ $\neq$ required $d_2$ (usually 0), implying stretching."
    \end{itemize}
    \item \textbf{faulty\_crease\_ids}: $[List of crease IDs causing the conflict]$
    \item \textbf{faulty\_vertex\_ids\_or\_point\_coordinates}: $[Conflicting vertex IDs or point coordinates]$
    \item \textbf{problematic\_coordinates\_or\_regions}: $[Problematic region's coordinates or description]$
\end{itemize}

\subsubsection{Underlying Principles}
\begin{itemize}
    \item \textbf{Non-stretchability of Paper:} Paper is inextensible; folding is an isometric transformation.
    \item \textbf{Local Developability:} Paper must be locally developable onto a plane (zero Gaussian curvature except at singularities).
    \item \textbf{Flat-foldability Conditions:} For flat folds:
        \begin{itemize}
            \item \textbf{Maekawa-Justin Theorem:} $|M-V|=2$.
            \item \textbf{Kawasaki-Justin Theorem:} $\sum_{i=1}^{n} \alpha_{2i-1} = \sum_{i=1}^{n} \alpha_{2i} = \pi$.
            \item \textbf{Big-Little-Big Angle Constraint:} $\alpha_i \le \alpha_{i-1} + \alpha_{i+1}$.
        \end{itemize}
    \item \textbf{Layer Thickness Limitation:} Real paper has thickness, limiting layer stacking.
\end{itemize}

\subsection{Paper Self-Intersection/Penetration}
This error means different paper parts occupy the same 3D space.

\subsubsection{More Details}
\begin{itemize}
    \item \textbf{Example Error Codes:}
    \begin{itemize}
        \item \texttt{E\_PHYS\_SELF\_INTERSECTION}: "After crease $[id]$, facet $[facet\_A\_id]$ (region $[coordinates_A]$) penetrates facet $[facet\_B\_id]$ (region $[coordinates_B]$)."
        \item \texttt{E\_PHYS\_INTERSECTION\_DURING\_MOTION}: "During folding of $[id]$, at time $t=[time]$, region $[region\_A]$ collides with $[region\_B]$."
        \item \texttt{E\_PHYS\_BOUNDARY\_VIOLATION}: "Folded part $[facet\_id]$ penetrates defined container boundary."
    \end{itemize}
    \item \textbf{faulty\_crease\_ids}: $[Crease ID(s) causing or related to penetration]$
    \item \textbf{problematic\_coordinates\_or\_regions}: $[Penetration area: point sets, bounding boxes, or facet IDs]$
    \item \textbf{intersecting\_layer\_ids} / \textbf{intersecting\_facet\_ids}: (Optional) $[layer\_id_1, layer\_id_2]$ or $[facet\_id_1, facet\_id_2]$ specifying penetrating parts.
    \item \textbf{penetration\_depth}: (Optional) Estimated penetration depth/volume. E.g., $d = 0.5\text{mm}$.
\end{itemize}

\subsubsection{Underlying Principles}
\begin{itemize}
    \item \textbf{Volumetric Exclusion:} Physical objects cannot occupy the same space.
    \item \textbf{Collision Detection:} Algorithms detect intersections between paper parts (meshes/facets).
        \begin{itemize}
            \item \textbf{Discrete Collision Detection:} Checks static geometry at time steps.
            \item \textbf{Continuous Collision Detection (CCD):} Detects collisions between time steps to prevent "tunneling."
        \end{itemize}
    \item \textbf{Data Structures:} Spatial partitioning (Octrees, BVHs) for efficient detection.
    \item \textbf{Layer Ordering and Penetration:} Incorrect layer order in flat folds can cause penetration.
\end{itemize}

\subsection{Ambiguous Folding State}
Indicates that the CP code and constraints do not uniquely determine the folded form.

\subsubsection{More Details}
\begin{itemize}
    \item \textbf{Example Error Codes:}
    \begin{itemize}
        \item \texttt{E\_AMBIGUOUS\_STATE}: "CP code is insufficient for a unique state. $N$ possible configurations in region $[coordinates]$ (or vertex $[vertex\_id]$)."
        \item \texttt{E\_AMBIGUOUS\_LAYER\_ORDER}: "Insufficient constraints to determine stacking order of layers $[layer\_A\_id]$ and $[layer\_B\_id]$ in region $[coordinates]$. At least two valid orders."
        \item \texttt{E\_AMBIGUOUS\_TUCK\_CHOICE}: "Operation 'tuck' at $[coordinates]$ has multiple valid insertion methods; CP unspecified."
        \item \texttt{E\_AMBIGUOUS\_MOUNTAIN\_VALLEY\_ASSIGNMENT}: "For crease $[crease\_id]$, multiple valid M/V assignments satisfy local constraints but yield different global forms."
    \end{itemize}
    \item \textbf{problematic\_coordinates\_or\_regions}: $[Region or vertex where ambiguity occurs]$
    \item \textbf{ambiguous\_crease\_ids\_or\_vertex\_ids}: (Optional) $[Crease/vertex IDs related to ambiguity]$
    \item \textbf{number\_of\_possible\_states}: (Optional) Number of possible states detected ($N$).
    \item \textbf{suggested\_disambiguation}: (Optional) "Suggestion: Add layer order constraint (e.g., LAYER\_ABOVE) or specify crease direction."
\end{itemize}

\subsubsection{Underlying Principles}
\begin{itemize}
    \item \textbf{Non-uniqueness of Solution Space:} A CP may correspond to multiple valid configurations.
    \item \textbf{Local vs. Global Information:} Local constraints may be met, but global form can vary.
    \item \textbf{Symmetry:} Symmetric CPs or operations can lead to multiple equivalent results.
    \item \textbf{Branching Points in Configuration Space:} Folding path may have bifurcations.
    \item \textbf{Implicit vs. Explicit Instructions:} Unstated conventions can lead to ambiguity for the compiler.
    \item \textbf{Solver Behavior:} Solvers for underdetermined systems might not find a unique solution.
\end{itemize}
