# How can I determine the orientation of normals on a given grid?"

**URL:** <https://bempp.discourse.group/t/how-can-i-determine-the-orientation-of-normals-on-a-given-grid/235>\
**Category:** Uncategorized\
**Created:** [24 February 2024 17:05 UTC](https://bempp.discourse.group/t/how-can-i-determine-the-orientation-of-normals-on-a-given-grid/235 "2024-02-24T17:05:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chayma](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@Chayma](https://bempp.discourse.group/u/Chayma)\
**Post date:** [24 February 2024 17:05 UTC](https://bempp.discourse.group/t/how-can-i-determine-the-orientation-of-normals-on-a-given-grid/235/1 "2024-02-24T17:05:49Z")

</div>

Hi all,  
I have a grid `grid = bempp.api.shapes.sphere(r=0.5, origin=(0, 0, 0), h=0.2)` and I want to obtain the swapped normals .

Any help is highly appreciated.  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Elwin](https://yyz2.discourse-cdn.com/free1/user_avatar/bempp.discourse.group/elwin/32/38_2.png) [@Elwin](https://bempp.discourse.group/u/Elwin)\
**Post date:** [26 February 2024 09:24 UTC](https://bempp.discourse.group/t/how-can-i-determine-the-orientation-of-normals-on-a-given-grid/235/2 "2024-02-26T09:24:36Z")

</div>

Hi Chayma,

You can obtain the normals of the grid with `grid.normals`, which are the unit-sized normal vectors at each triangular element.

You can check the orientation of the normals by exporting the grid and opening it in Gmsh.

There is no built-in functionality to swap the orientation of the normals. A workaround would be creating another grid with an opposite triangle orientation, e.g., `grid_swapped = bempp.api.Grid(grid.vertices, grid.elements[[0,2,1],:])`, where the order of the element indices are changed.

Be aware that Bempp assumes that the user defines the grid with consistent normal orientation.

---

<div class="post-metadata">

**Author:** ![Chayma](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@Chayma](https://bempp.discourse.group/u/Chayma)\
**Post date:** [26 February 2024 12:45 UTC](https://bempp.discourse.group/t/how-can-i-determine-the-orientation-of-normals-on-a-given-grid/235/3 "2024-02-26T12:45:11Z")

</div>

Dear Elwin,

Thank you very much for your reply.  
I used also swapped\_grid=bempp.api.grid.grid.union([grid], swapped\_normals=len([grid])\*[True]).  
Best,  
Chayma.
