# PGS shape union

**URL:** <https://discourse.processing.org/t/pgs-shape-union/34342>\
**Category:** Libraries\
**Created:** [December 28, 2021, 5:01pm UTC](https://discourse.processing.org/t/pgs-shape-union/34342 "2021-12-28T17:01:19Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [December 28, 2021, 7:43pm UTC](https://discourse.processing.org/t/pgs-shape-union/34342/3 "2021-12-28T19:43:52Z")

</div>

Hello @matheplica,

It works here with this simple example that I conjured up:

```auto
import micycle.pgs.*;
import java.util.List;

PShape s, s1, s2;
boolean inward = true;

void setup() 
  {
  size(400, 400);

  s1 = createShape(RECT, 0, 0, 50, 50);
  s2 = createShape(TRIANGLE, 0, 0, 50, 25, 35, 80);

  s = new PShape();
  s = PGS_ShapeBoolean.union(s1, s2);
  
  shape(s, 100, 100);
  }
  
void draw()
  {
  background(0);
  shape(s1, 100, 50);
  shape(s2, 250, 50); 
  shape(s, mouseX, mouseY);
  }

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b7dd2abeaae6f61e353f35a84a165ef443dc7650.png)

Reference:

> [@Processing Geometry Suite](https://discourse.processing.org/t/processing-geometry-suite/29924):
>
> Processing Geometry Suite Hi everyone. I’m pleased to share something I’ve been working on the past few months – a 2D computational geometry that I’ve called Processing Geometry Suite. The focus of the library is on visualisation rather than providing underlying data structures and so all methods in the library are static and most of them take in and return PShapes or PVectors. I’ve made a real effort to make it easy to pick up – it’s well [documented](https://micycle1.github.io/PGS/micycle/pgs/package-summary.html), the Github is replete with gifs illust…

My first time using this library and can’t add more to this topic.

Can you provide a [minimal example](https://stackoverflow.com/help/minimal-reproducible-example)?

`:)`

---

_[View the full topic](https://discourse.processing.org/t/pgs-shape-union/34342)._
