Zylindrischer Halfpipe-Warp (inverse Projektion)
Erzeugt mathematisch ein Warp-Gitter, das eine inverse zylindrische Projektion simuliert. Dadurch entsteht ein 'Halfpipe'-Effekt, bei dem sich das Bild scheinbar in den Bildschirm hinein oder heraus wölbt.
INPUT
OUTPUT
JavaScript
// Cylindrical half-pipe warp (inverse projection)
// warpgrid_halfpipe.js
//!INPUT: INPUT
//!OUTPUT: OUTPUT
//!PARAM: THETA_DEG:number=68,min=-360,max=360
//!PARAM: ROWS:integer=8,min=2,max=100
//!PARAM: COLS:integer=24,min=2,max=100
const thetaMax = THETA_DEG * Math.PI / 180;
const sinT = Math.sin(thetaMax);
const nodes = {};
for (let r = 0; r < ROWS; r++) {
const row = [];
for (let c = 0; c < COLS; c++) {
const nc = c / (COLS - 1); // 0..1 horizontal
const nr = r / (ROWS - 1); // 0..1 vertical
// Inverse cylindrical projection for u (horizontal axis only)
const u = (Math.asin((2 * nc - 1) * sinT) + thetaMax) / (2 * thetaMax);
const v = nr; // cylinder axis is horizontal — no vertical distortion
row.push(u, v);
}
nodes[String(r)] = row;
}
Engine.loadImage(INPUT)
.warpGrid({ rows: ROWS, cols: COLS, nodes })
.save(OUTPUT);
// © 2026 Michael Lechner · mlc OpticScript · https://mlcgo.eu · Elastic License 2.0