Re: Neatly fitting a dash to a rect
Re: Neatly fitting a dash to a rect
- Subject: Re: Neatly fitting a dash to a rect
- From: Andy Lee <email@hidden>
- Date: Thu, 12 Dec 2013 12:38:55 -0500
On Dec 12, 2013, at 10:52 AM, Graham Cox <email@hidden> wrote:
>> Does it have to be the same exact pattern all the way around? If it's okay to differ a teeny bit (I bet imperceptibly), you could solve the problem separately for the horizontal edges and the vertical edges, and draw four lines instead of one rect.
>
> It doesn’t *have* to be the same as long as it doesn’t differ too much visually, but detecting that a path is a simple rect (including rotated cases) and breaking it into h and v lengths might turn out to be the hard part. I also wonder if there’s a way to perform the calculation based on the highest common factor (HCF) of the horizontal and vertical edges? That might allow the dash to be tweaked as a single entity and applied in the usual way.
Interesting. You could straighten out the angles of the rect and think of (say) the top and right edges as a single line:
o---+---+---+---+---o---+---+---o
Each of o's is a corner, and each of the +'s marks off a multiple of the HCF. So what you want is for the dash to be tweaked in such a way that all three o's are in the middle of some segment.
Sounds fun -- good luck!
--Andy
_______________________________________________
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