Re: Re: Re: Tracking rectangles and bezier paths
Re: Re: Re: Tracking rectangles and bezier paths
- Subject: Re: Re: Re: Tracking rectangles and bezier paths
- From: "Raphael Sebbe" <email@hidden>
- Date: Sat, 9 Sep 2006 20:10:43 +0200
Hi,
From what Dave told, I believe he is interested in highlighting the
curve when the mouse is *on* it, as opposed to *inside* the area
defined by it. The convex hull may be too large for tracking purpose.
Raphael
On 9/9/06, Wagner Truppel <email@hidden> wrote:
It's not as hard a math problem as suggested, even if the curve is
not monotonic. Recall that the entire bezier path is contained within
the convex hull of the path's control points so a very simple
solution is to retrieve the control points, compute their convex hull
(which is a convex polygon, in 2 dimensions), and use that as your
tracking area. Computing convex hulls in 2 dimensions is almost
trivial - any decent book on algorithms will tell you how.
Wagner
============
You cannot simultaneously prevent and prepare for war.
- Albert Einstein
> Thanks, That is about what I suspected. I suppose that if the curve
> is monotonic then it is straightforward to do the math in case 2.
>
> On Sep 8, 2006, at 9:44 AM, Raphael Sebbe wrote:
>
>> Hi,
>>
>> That involves computing an intersection between a region around the
>> mouse cursor and the curve.
>>
>> 1. If you draw that curve yourself in OpenGL (I mean tesselate it as
>> segments), this is pretty straightforward, as you set up a pickbuffer
>> and render the scene a second time only in that region arond the
>> mouse
>> and see if the curve is inside or not by parsing the pick buffer.
>>
>> 2. If your are using NSBezierPath, well, it seems more difficult to
>> me, at least it involves parsing the control points and doing about
>> the same thing as 1 or other fancy math yourself.
>>
>> Of course, there are workarounds, like landmining the path or just
>> doing that effect when the mouse enters control point handles.
>>
>> HTH,
>>
>> Raphael
>>
>> On 9/8/06, Dave Budde <email@hidden> wrote:
>>> I've seen at least one application (Space Designer in Logic Pro
>>> comes
>>> to mind) that can track a bezier curve and highlight it when a mouse
>>> enters and exits the proximity of the curve. Is there a similar
>>> thing to tracking rectangle that can do this or does one need to
>>> create a bunch of little rects along the path and assign them the
>>> same proximity variable.
>>>
>>> Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden