contains() function not working when used with an SVG file loaded by PShape

FRDFRD
edited May 2016 in Questions about Code

Hello everyone,

I'm running Processing 2.2.1 and I'm getting in trouble when trying to see if a point is inside or outside a PShape object created by loading an SVG file with the .loadShape("filename.svg") function.

The code is the following:

PShape s;

void setup() { size(1920, 1200); s = loadShape("Organo1.svg"); }

void draw() { background(0); stroke(0, 0, 0, 0); shape(s); s.contains(10, 10); }

The error which I obtain is the following:

"The contains() method is only implemented for paths."

How can I fix it?

Thanks in advance, FD

Answers

  • The best solution might be to edit the svg file in a program like inkscape and see if you can save the information in the svg file as a path.

Sign In or Register to comment.