• 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: NSPoint Documentation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPoint Documentation


  • Subject: Re: NSPoint Documentation
  • From: David Remahl <email@hidden>
  • Date: Fri, 22 Mar 2002 21:22:01 +0100

> On Friday, March 22, 2002, at 07:26 PM, Daniel Stark wrote:
>
>> afloatvalue = [NSpoint1 distanceToPoint:NSpoint2];
>>
>> And it couldn't find this method. Is this implemented in objective C?
>> Why can't I find the docs or headers for NSpoint? Of course if it
>> doesn't exist I can do it myself, I just thought that it would be built
>> in as it is in Java.
>
> NSPoint isn't implemented as an Obj-C object: it's just a struct. Docs
> on the funtions to manipulate them are here:
> http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_cla
> ssic/
> Functions/FoundationFunctions.html#BCIFGGCH
>
> though I can't see a function comparable to distanceToPoint.
>
> -- Finlay

We could help out people looking through this thread in the future, by
giving a simple function to calculate the distance between the points...Just
in case the person in need doesn't like geometry :)

float DRDistanceBetweenPoints(NSPoint pt1, NSPoint pt2)
{
float ptxd = pt1.x - pt2.x;
float ptyd = pt1.y - pt2.y;
return sqrtf( ptxd*ptxd + ptyd*ptyd );
}

Not tested...

/ david
_______________________________________________
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.

References: 
 >Re: NSPoint Documentation (From: Finlay Dobbie <email@hidden>)

  • Prev by Date: Re: NSPoint Documentation
  • Next by Date: Re: Simple newbie problem: Static variables in Objective-C?
  • Previous by thread: Re: NSPoint Documentation
  • Next by thread: Re: NSPoint Documentation
  • Index(es):
    • Date
    • Thread