If your source is a straight line then wouldn't it be the larger width or height, respectively? A straight line can't get any larger if rotated. For rectangles simply the pythagorean theorem to get the hypotenuse. For ovals you'd have to determine the foci and derive a largest diameter from those two points. For a circle it's simply 2xRadius or Circumference/PI, based on what you know about the circle. For any non-standard geometric shape, there is no ingenious formula; just use the getBounds() method by Mr Malee above (and then possibly the pythagorean theorem to determine the hypotenuse if needed).





Reply With Quote