• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calculating accurate bounds of stroked paths [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Calculating accurate bounds of stroked paths (From: Graham Cox <email@hidden>)
 >Re: Calculating accurate bounds of stroked paths (From: Chris Suter <email@hidden>)
 >Re: Calculating accurate bounds of stroked paths [SOLVED] (From: Graham Cox <email@hidden>)
 >Re: Calculating accurate bounds of stroked paths [SOLVED] (From: Chris Suter <email@hidden>)
 >Re: Calculating accurate bounds of stroked paths [SOLVED] (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Distributed Objects "connection went invalid while waiting for a reply"
  • Next by Date: Re: problem with IKImageView and filters
  • Previous by thread: Re: Calculating accurate bounds of stroked paths [SOLVED]
  • Next by thread: iPhone SDK and sms.db file
  • Index(es):
    • Date
    • Thread