Re: Calculating accurate bounds of stroked paths [SOLVED]
Re: Calculating accurate bounds of stroked paths [SOLVED]
- Subject: Re: Calculating accurate bounds of stroked paths [SOLVED]
- From: Peter Zegelin <email@hidden>
- Date: Wed, 9 Jul 2008 17:42:51 +1000
On 09/07/2008, at 5:24 PM, Graham Cox wrote:
<snip>
You will need to also take into account of the line width (as I'm
sure you do) so I think the combined offset would be best expressed
as:
max(w / 2, ml * w / 2)
where ml is the mitre limit.
That's right, and precisely what I'm doing. Works well enough though
for most actual paths is on the generous side (because rarely do
angles get that sharp). Still, it's probably a fair compromise
between updating more than necessary and going over each path to
find the sharpest angle.
Since I'm working in C++ for this part of my app I'm going to have to
do all the calculations myself rather than using
CGContextGetPathBoundingBox. I'll probably use the worst case while
the shape is selected and then calculate the exact bounds when the
shape becomes deselected. Interestingly, not only will the maximum
outset have to be calculated according to the angle *at* each point
but this will have to then be modified depending on the rotation of
the point itself. Great fun for the math challenged like me.
Peter
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden