What is the most common/accepted way of dealing with the inaccuracies of floating point math? I'm trying to find out 1) Do 2 NSBezierPath lines intersect and then 2) What is the point of the intersection?

Given a couple points on a line I can find the intersection point but since 2 line segments may not intersect, I then check:
if([lineOne containsPoint: intersectionPoint])

That will nearly always fail unless the math works out to very nice, neat, round numbers. I've seen one possible workaround of multiplying everything by 100 and then doing integer math but considering I've got some division involved, not sure exactly if that would work. I guess I could just check the values myself (if point1 is +- .001 of point2) but that seems kinda hackish.

What's the most common way of dealing with these types of problems?

Ashley Perrien
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to