Equivalent (PShape?) to Java2D Area subtract

Hi there. I’m trying to grasp the relationship between PShape and java.awt.Shape. In particular, how can I subtract one PShape from another, or intersect them. E.g. new java.awt.geom.Area(shape1).subtract(new java.awt.geom.Area(shape2)). Is that possible?

Hello,

One way…

Reference:

:)

Thanks, I saw beginContour; but can I “paste” an existing PShape here? Or do I have to retrace all vertices? Seems rather low level approach.

There’s not really any relationship between PShape and awt.Shape.

You can use the Processing Geometry Suite library to perform 2D boolean operations (addition, subtraction, intersection, etc.) on PShapes directly.

2 Likes