polar2cart: Polar to Cartesian Coordinate Reconstruction
Converting polar representation back to rectangular coordinates
The polar2cart functions perform the inverse transformation of cart2polar, reconstructing Cartesian coordinates from polar and spherical representations.
2D Cartesian Reconstruction
For polar coordinates , the Cartesian reconstruction produces :
3D Cartesian Reconstruction
For spherical coordinates , the Cartesian reconstruction produces :
Function Variants
Function | Input | Output | Description |
---|---|---|---|
polar2cart(polar) | vec2 | vec2 | 2D polar to Cartesian |
polar2cart3D(r,phi,theta) | float,float,float | vec3 | 3D spherical to Cartesian |
Live Editor
const fragment = () => { const r = 0.3 const phi = uv.x.mul(3.14) const theta = uv.y.mul(6.28) const sphere3d = polar2cart3D(r, phi, theta) const projection = sphere3d.xy.add(0.5) const depth = sphere3d.z.mul(2).add(0.5) return vec4(vec3(projection, depth), 1) }