#[no_mangle]
pub extern "C" fn equirectangular(target: *mut f64, width: u32, height: u32) {
use std::f64::consts::PI;
let target = unsafe {
std::slice::from_raw_parts_mut(target, (width as usize) * (height as usize) * 3)
};
for y in 0 .. (height as usize) {
let rowstart = y * (width as usize) * 3;
let yr = 0. - (y as f64) / (height as f64) * PI;
let yrs = yr.sin();
let yrc = yr.cos();
for x in 0 .. (width as usize) {
let xr = (x as f64) / (width as f64) * 2. * PI;
let pixstart = rowstart + 3 * x;
target[pixstart] = yrs * xr.sin();
target[pixstart + 1] = yrs * xr.cos();
target[pixstart + 2] = yrc;
}
}
}