uxebu/bonsai — pull request #121 by padolsey (2012-10-18 13:03:31+00:00)
Title: getBoundingBox improvements

What was previously the `getComputed` method is now `getBoundingBox`.

It takes on optional argument, a `Matrix` instance which will be used to apply transforms to the calculated bounding-box.

```js
var shape = new Rect(50, 50, 100, 100);

// No transform applied, -- it'll return the bounding-box
// within shape's own coordinate system:
shape.getBoundingBox(); // ~ 0,0,100,100

// Apply shape's own matrix to the calculation
// (gives position in outer coordinate system):
shape.getBoundingBox( shape.attr('matrix') ); // ~ 50,50,100,100
```

`getBoundingBox` always returns an object in the form:

```js
{
top: n,
left: n,
width: n,
height: n,
bottom: n,
right: n
}
```

Included in this pull request is also an algorithm to determine the correct extrema of cubic bezier curves. Checkout the branch and open the `bounding-box.js` example to see a demonstration of the new `getBoundingBox` calculation.