• 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: NSBezierPath containsPoint question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBezierPath containsPoint question


  • Subject: Re: NSBezierPath containsPoint question
  • From: Tom Bernard <email@hidden>
  • Date: Wed, 28 Apr 2004 03:18:01 -0600

Fascinating...

I recently needed to find the point where a line intersected the arc of a
circle. The following worked for me:

gameFlagArcPath = [[NSBezierPath bezierPath] retain];
[gameFlagArcPath
appendBezierPathWithArcWithCenter:gameFlagPivotPoint radius:gameFlagWidth
startAngle:-92.0 endAngle:2.0];

t = minuteHandLength - 1.25 * gameFlagWidth;
contactPoint = NSMakePoint( -t * sin(minuteHandRotation), t *
cos(minuteHandRotation) );
while (![gameFlagArcPath containsPoint:contactPoint])
{
t += 0.1;
contactPoint = NSMakePoint( -t * sin(minuteHandRotation), t
* cos(minuteHandRotation) );
}

I am "walking" the line and testing whether my current point on the line is
contained in the path.

If you define an arc with a long enough radius, the arc becomes a flat line.


Tom Bernard
email@hidden

on 4/26/04 11:00 PM,

> From: Dominic Edward Feira <email@hidden>
> Subject: NSBezierPath containsPoint question
> To: email@hidden
>
> I am trying to determine wether or not I am clicking on a line...below
> is a snippet of code. Shouldn't tempBool equal YES? ...


on 4/26/04 11:00 PM, email@hidden at
email@hidden wrote:

> From: Allan Odgaard <email@hidden>
...
> Date: Tue, 27 Apr 2004 06:18:44 +0200
> To: Dominic Edward Feira <email@hidden>
>
> On 27. Apr 2004, at 5:54, Dominic Edward Feira wrote:
>
...
> No, it tells if the point is contained by the (closed) path formed by
> multiple lines in the NSBezierPath.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Prev by Date: clickedOnLink called outside of the link
  • Next by Date: iPhoto plugin source
  • Previous by thread: Re: NSBezierPath containsPoint question
  • Next by thread: mental crutch for class vs instance methods
  • Index(es):
    • Date
    • Thread