PGS: problem invoking centroid()

Hi, coming back to Processing after a long while; just dicovered the amazing PGS library. Problem: how do I make Processing see method centroid()?

I have included line import micycle.pgs.*;, but my instruction to get a vector PVector cntr = centroid(child); is not recognized. Processing complains about the method not existing.

What am I doing wrong?

Hi @Eamoex and welcome back to the forum!

Could you share a minimal sketch showing the error?

Pinging @micycle too :eyes:

Hi sableRalph, thanks!

Sure, here: link

EDIT: Meh. Testing my link ends up in a rebuttal because my domain is not secure http… hope you can dl the file anyway.

Since this is an external library you have to qualify the method with the class it comes from: PGS_ShapePredicates.centroid().

However if you still want reference it in Processing-style (like you’ve been trying), you can do so using Java’s static import: import static micycle.pgs.PGS_ShapePredicates.centroid;

3 Likes

Great, thanks a lot.