PGS shape union

Hi, I’m trying to create a new Shape from 2 more simple.
I use the PGS_library with the function union :

output = PGS_ShapeBoolean.union(shape[0].getShape(), shape[1].getShape());

The new shape is created but still keep the inside lines and I just need those from the new diameter. Here’s the bad result :
noShape

Any ideas ?

1 Like

No idea.

Switch the stroke of the two initial shapes off and after union switch its stroke back on? :wink:

Hello @matheplica,

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

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

Reference:

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

Can you provide a minimal example?

:)

That’s fascinating

What does it stand for psg?

Processing Geometry Suite

1 Like

Ok just a basic forget.
I need to close my path.

sh = createShape();
    sh.beginShape();
    sh.noStroke();
    sh.fill(0);
    for (int i=0; i<len; i++) sh.vertex(int(random(300)), int(random(300)));
    sh.vertex(sh.getVertex(0).x, sh.getVertex(0).y);
    sh.endShape(CLOSE);//here

Thanks for help

2 Likes

Thanks for your suite it’s very good good job.
Now, I try to use :

PGS_Morphology.fieldWarp()

I searching the same parameter than on your example with the leaf on the github site without sucess. Sorry but I’m lost.

It is not my suite.

Thank @micycle.

:)

It should take the same parameters as the example – either way the docs for that method are here.

3 Likes

Thanks, I will try to ask question less quickly !
Happy new year to everyone on the earth

1 Like