Quarter Life Crisis

The world according to Sven-S. Porst

« The design of everyday thingsMainiTunes 7.7.1 »

Hit Detection

253 words

Everybody loves NSBezierPath I guess. You invest a few simple Objective-C calls, and in return it draws a path for you that’s nicely antialiased. That’s cool.

However, a few things about it have always been frustrating. For example it could be rather useful if there were methods for finding out the distance of a point from a Bézier path or for simply getting the coordinates of points along a path. That stuff wouldn’t be trivial to implement but the fact that somewhat related algorithms must be used to handle the nice (and slow) drawing of a path’s self-intersections, suggests that this’d be significantly easier to achieve for the people who already wrote the code to draw the path. Instead, under the promising heading of Hit detection in the documentation one only finds this:

NSBezierPath Hit Detection  only lists -containsPoint:

… doesn’t have much to do with the path per se but only concerns the area it encloses. Ah bummer.

As a curious observer one may note that Core Animation’s CAKeyframeAnimation can move things along a Bézier path and Core Animation’s CAMediaTimingFunction curiously looks like it does something fairly similar to running through a Bézier path as well. Thus, some of the desired code actually ships in OS X today, it’s just not accessible in the most generally useful way.


Well, at least it’s easier to find Apple’s patent applications on those topics than useful documentation… which of course baffles the mind once again as to what sorts of things people try (and, I guess succeed) to patent these days.

August 1, 2008, 9:04

Tagged as cocoa, coreanimation, nsbezierpath, patent.

Add your comment

« The design of everyday thingsMainiTunes 7.7.1 »

Comments on

Photos

Categories

Me

This page

Out & About

pinboard Links

♪♬♪

Received data seems to be invalid. The wanted file does probably not exist or the guys at last.fm changed something.

People

Ego-Linking