i tried checking using min and max, but iterating through several times with only 1024 points per shape freezes processingjs! (i am putting the bounding box check within shape generation, i.e., while loop if beyond bounds, generate shape again.)
so i am wondering if there is a more efficient method to check for bounding box of a shape
it depends how many shapes you're creating the bounding box for, and whether they're polygons or polybeziers. If you have even a reasonably low number of shapes you will probably get the best performance from a scanline/sweepline algorith to determine the bounds for your shapes, then track your shapes as they move so that you can update the bounds without having to run a new scanline. While an expensive initial operation, the fact that you only have to do it once makes it highly suitable for animated sketches.