Geomerative - fitting text inside arbitrary shapes?

Here’s BoundaryTest.java converted to “BoundaryTest.pde”: :smile_cat:

import geomerative.*;

Boundary bounds;
RShape my_rect;

void setup() {
  size(600, 600, P2D);
  RG.init(this);
  RG.setPolygonizer(RG.ADAPTATIVE);
  bounds = Boundary.createBoundingRectangle(100, 100, 100, 50);
}

void draw() {
  fill(255);
  my_rect = RShape.createRectangle(mouseX, mouseY, 10, 10);
  bounds.draw();
  drawMyRect(bounds.inside(my_rect));
}

void drawMyRect(boolean inside) {
  if (inside) {
    noStroke();
    fill(255, 0, 0);
  } else {
    stroke(0);
    fill(255);
  }
  my_rect.draw(this);
}
1 Like