Hi everyone,

I am trying to make some particles bounce off or stop at the edges of an SVG vector. I tried using the geomerative library to get all the points on the vector shape, but I'm not sure how to return them as an array of x,y coordinates. Anyway, that was one way I approached the problem, and I'm not sure where I would go from there to have the particles stop at the perimeter of the shape. Any suggestions?

This is what I have to display the shape and print the points:

Thanks in advance.

I am trying to make some particles bounce off or stop at the edges of an SVG vector. I tried using the geomerative library to get all the points on the vector shape, but I'm not sure how to return them as an array of x,y coordinates. Anyway, that was one way I approached the problem, and I'm not sure where I would go from there to have the particles stop at the perimeter of the shape. Any suggestions?

This is what I have to display the shape and print the points:

- import geomerative.*;
- RShape s;
- RShape polyshp;
- void setup() {
- size(640, 360);
- RG.init(this);
- s = RG.loadShape("myshape.svg");
- }
- void draw() {
- background(0);
- polyshp = RG.polygonize(s);
- RG.shape(polyshp, width/4, 50);
- RPoint[] points = s.getPoints();
- println(points);
- }

Thanks in advance.

2