graph TD A[Data Points] --> B[Sort & Triangulate] B --> C[PWL Interpolation] C --> D{Convex?} D -->|Yes| E[QP: Minimize error] D -->|No| F[Add convex constraints] F --> C E --> G[Convex PWL Fit] style A fill:#fff3e0,stroke:#e65100,stroke-width:3px style B fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style C fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style D fill:#ffcdd2,stroke:#c62828,stroke-width:3px style E fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px style F fill:#ffcdd2,stroke:#c62828,stroke-width:3px style G fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
graph TD A[Neighboring Simplices] --> B[Find barycentric coords] B --> C[Form linear inequality] C --> D[Add to QP constraints] D --> E[Solve QP] E --> F[Convex PWL function] style A fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style B fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style C fill:#fff3e0,stroke:#e65100,stroke-width:3px style D fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px style E fill:#ffcdd2,stroke:#c62828,stroke-width:3px style F fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px
graph TD A[PWL Interpolation] --> B[Univariate n=1] A --> C["Multivariate n > 1"] B --> D["Sort data O(m log m)"] B --> E[Interval lookup] C --> F["Delaunay Tri. O(m log m)"] C --> G[Simplex containment] D --> H[Interpolate] E --> H F --> I[Interpolate] G --> I style A fill:#fff3e0,stroke:#e65100,stroke-width:3px style B fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style C fill:#e3f2fd,stroke:#1565c0,stroke-width:3px style D fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px style E fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px style F fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px style G fill:#f3e5f5,stroke:#7b1fa2,stroke-width:3px style H fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px style I fill:#e3f2fd,stroke:#1565c0,stroke-width:3px