# Unwrapping a cylinder

**URL:** <https://discourse.paraview.org/t/unwrapping-a-cylinder/8731>\
**Category:** ParaView Support\
**Created:** [January 5, 2022, 3:03pm UTC](https://discourse.paraview.org/t/unwrapping-a-cylinder/8731 "2022-01-05T15:03:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![roland](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/3ab097/32.png) [@roland](https://discourse.paraview.org/u/roland)\
**Post date:** [January 5, 2022, 5:19pm UTC](https://discourse.paraview.org/t/unwrapping-a-cylinder/8731/2 "2022-01-05T17:19:07Z")

</div>

Can it be that your surface is folded back on it self because you use an atan function instead of atan2?

I don’t know if atan2 is available now, but it wasn’t before, so I used to calculate it myself with a Calculator filter:

> if(coordsX\>0,atan(coordsY/coordsX), if(coordsX\<0, if(coordsY\<0,atan(coordsY/coordsX)-4\*atan(1),atan(coordsY/coordsX) +4 \*atan(1)), if(coordsY\>0, 2 \*atan(1), if(coordsY\<0, -2 \*atan(1),0))))

Then apply a [-pi, pi] threshold on the resulting angle (which I called theta).

Finally I apply this Calculator (which you may have already found [here](https://www.cfd-online.com/Forums/paraview/210976-unwrapping-cylinder-paraview.html#post714726)):

> Coords\_flat = sqrt(coordsX^2+coordsZ^2) \* theta \* iHat+coordsY \* jHat+0 \* kHat

You will need to change your coordsX,Y,Z to fit your cylinder orientation of course.

---

_[View the full topic](https://discourse.paraview.org/t/unwrapping-a-cylinder/8731)._
