# Intersect and subtract of 2 overlapped ExtrudePolygon

**URL:** https://forum.babylonjs.com/t/intersect-and-subtract-of-2-overlapped-extrudepolygon/13801
**Category:** Questions
**Created:** [August 31, 2020, 6:46am UTC](https://forum.babylonjs.com/t/intersect-and-subtract-of-2-overlapped-extrudepolygon/13801 "2020-08-31T06:46:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![neofita](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@neofita](https://forum.babylonjs.com/u/neofita)
#### Post date: [August 31, 2020, 6:46am UTC](https://forum.babylonjs.com/t/intersect-and-subtract-of-2-overlapped-extrudepolygon/13801/1 "2020-08-31T06:46:51Z")

</div>

Hello evryone,  
i have a problem aboout 2 overlapped ExtrudedPolygon when i interset or subtract with another ExtrudeShapeCustom

I know from another post that in some case for ExtrudedPolygon is necessary to do the inverse of array but i don t know why so i ve tried different solutions

There are these 3 PG for report my problem:

- the first without inverse of the arrays that creates the ExtrudedPolygons  
[Babylon.js Playground](https://playground.babylonjs.com/#EUCIKC)

- the second with inverse of both arrays that creates the ExtrudedPolygons  
[https://playground.babylonjs.com/#EUCIKC#1](https://playground.babylonjs.com/#EUCIKC#1)

- the thirth with inverse of one array and the other no. This example looks near the solution but not at alla and especially i don’ t know why in some case i have to inverse and in other cases no  
[https://playground.babylonjs.com/#EUCIKC#2](https://playground.babylonjs.com/#EUCIKC#2)

Thank you in adcance

---

<div class="post-metadata">

### Author: ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)
#### Post date: [August 31, 2020, 9:49am UTC](https://forum.babylonjs.com/t/intersect-and-subtract-of-2-overlapped-extrudepolygon/13801/2 "2020-08-31T09:49:33Z")

</div>

Maybe someone can help you on that matter (I know @JohnK is a master of parametric shapes) but in any case you should really try to show up your problem with smaller PGs because such big PGs could discourage some people.

---

<div class="post-metadata">

### Author: ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)
#### Post date: [August 31, 2020, 9:58am UTC](https://forum.babylonjs.com/t/intersect-and-subtract-of-2-overlapped-extrudepolygon/13801/3 "2020-08-31T09:58:59Z")

</div>

> [@neofita](#):
>
> i don’ t know why in some case i have to inverse and in other cases no

From [https://doc.babylonjs.com/how\_to/parametric\_shapes#extruded-non-regular-polygon](https://doc.babylonjs.com/how_to/parametric_shapes#extruded-non-regular-polygon) see

_All vectors for shape and holes are Vector3 and should be in the XoZ plane, ie of the form BABYLON.Vector3(x, 0, z) and in counter clockwise order._

If your array happens to be in clockwise order reversing it puts it in counter clockwise order.

---

<div class="post-metadata">

### Author: ![neofita](https://avatars.discourse-cdn.com/v4/letter/n/898d66/32.png) [@neofita](https://forum.babylonjs.com/u/neofita)
#### Post date: [September 2, 2020, 8:29am UTC](https://forum.babylonjs.com/t/intersect-and-subtract-of-2-overlapped-extrudepolygon/13801/4 "2020-09-02T08:29:46Z")

</div>

I’ ve simplified all in this task

> [@Intersect and subtract of 2 overlapped ExtrudePolygon - #2](https://forum.babylonjs.com/t/intersect-and-subtract-of-2-overlapped-extrudepolygon-2/13846):
>
> Hello everyone, i have a problem aboout 2 overlapped ExtrudedPolygon when i interset or subtract with another ExtrudeShapeCustom I dont understand why the wrench is cutted and why it appear deepest than the quare [https://playground.babylonjs.com/#LFWQQK](https://playground.babylonjs.com/#LFWQQK) Thank you in advance

Thank you
