# Issue in plotting a mesh of rectangular cube in 3D

**URL:** https://community.freefem.org/t/issue-in-plotting-a-mesh-of-rectangular-cube-in-3d/4015
**Category:** General Discussion
**Created:** [July 25, 2025, 5:07am UTC](https://community.freefem.org/t/issue-in-plotting-a-mesh-of-rectangular-cube-in-3d/4015 "2025-07-25T05:07:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![RaghunathBandha](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/raghunathbandha/32/1843_2.png) [@RaghunathBandha](https://community.freefem.org/u/RaghunathBandha)
#### Post date: [July 25, 2025, 5:07am UTC](https://community.freefem.org/t/issue-in-plotting-a-mesh-of-rectangular-cube-in-3d/4015/1 "2025-07-25T05:07:20Z")

</div>

I want to plot a 3D mesh of rectangular cube x=0 to x=2\*pi, y=0 to y=pi, z=1 to z=1.5.  
But the code is showing error in line 48.  
[cube.edp](https://community.freefem.org/uploads/short-url/aj8KJbzdMnoqwT2boawT638k01i.edp) (1.6 KB)

---

<div class="post-metadata">

### Author: ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)
#### Post date: [July 25, 2025, 10:50am UTC](https://community.freefem.org/t/issue-in-plotting-a-mesh-of-rectangular-cube-in-3d/4015/2 "2025-07-25T10:50:18Z")

</div>

You are trying to reproduce the code lines of the documentation

> **[FreeFEM-documentation.pdf](https://doc.freefem.org/pdf/FreeFEM-documentation.pdf)**
>
> 33.85 MB

p.147-148, but the arguments you use are not correct.

In any case you don’t need to redefine the function “cube”, which already exists in freefem.  
Just remove the definition of func cube in your code!

---

<div class="post-metadata">

### Author: ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)
#### Post date: [July 27, 2025, 1:26pm UTC](https://community.freefem.org/t/issue-in-plotting-a-mesh-of-rectangular-cube-in-3d/4015/5 "2025-07-27T13:26:01Z")

</div>

The message says “bad orientation”.  
movemesh does not allow a reverse orientation of the transformation map.  
You have to put a minus sign  
`func ir = -z*cos(y);`

---

<div class="post-metadata">

### Author: ![RaghunathBandha](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/raghunathbandha/32/1843_2.png) [@RaghunathBandha](https://community.freefem.org/u/RaghunathBandha)
#### Post date: [July 27, 2025, 2:29pm UTC](https://community.freefem.org/t/issue-in-plotting-a-mesh-of-rectangular-cube-in-3d/4015/6 "2025-07-27T14:29:51Z")

</div>

Thank you sir for the information.
