Well, Geomerative is making me feel really stupid. I've spent several days banging my head against it, and I'm not getting anywhere. Would someone please help me to understand what I'm doing wrong?
I have a gray background (id="bg")in my SVG which is set to display="none". Why is Geomerative rendering it? Can I turn it off?
The edge of the molecule seems to be the edge of the sketch. If I make the sketch bigger, the molecule gets bigger. I assume this is because of the shp.centerIn() method, but all I want is to render my SVG at 1:1 size, and at the molecule's center.
How can I get the contour of my shape? I tried using shp.getChild(), but the only difference seems to be that it loses its fill colors. In fact, I can't setFill on this child shape later on... this might be a bug.
At any rate, since I can't isolate the contour, the shapes always overlap.
I see that there is a translate method for RMatrix. Is there an equivalent translate method for RShape? I assume using pushMatrix/popMatrix isn't ideal, but I don't know how else to do it.
And, what is the difference between RContour, RShape, RSubshape and RPolygon? I'm really confused... they're all asked for in different methods, and I can't seem to convert between them, even though they all seem to have the same methods.
Thanks a lot... I'm feeling very frustrated.
- import geomerative.*;
- RShape shpCircle;
- RShape shpMolecule;
- void setup() {
- size(400, 400);
- smooth();
- RG.init(this);
-
- shpMolecule = RG.loadShape("Water.svg");
- //shpMolecule = shpMolecule.getChild("outline");
-
- shpCircle = RShape.createCircle(width/2, height/2, 50);
- shpMolecule.centerIn(g, 0);
- }
- void draw() {
- background(25, 25, 75);
-
- shpCircle.setFill(color(255, 0, 0));
- //shpMolecule.setFill(color(255, 255, 0)); // if you activate this line and the one commented out above, this line does nothing. Why?
-
- pushMatrix();
- translate(mouseX, mouseY);
- shpMolecule.draw();
- popMatrix();
-
- RG.shape(shpCircle);
-
- if (shpCircle.intersects(shpMolecule)) { // test to see if the molecule and the test circle collide
- println("Bounce!");
- }
- }