Distance between a line and a point in Objective-C ?
- by micropsari
Hello,
I have 2 class :
// point : (x, y)
@interface ICPoint : NSObject {
NSInteger x;
NSInteger y;
}
// line : y= ax + b
@interface ICLine : NSObject {
float a;
float b;
}
and this method:
// return the distance between a line and a point
-(NSInteger) distance:(ICPoint *)point {
return fabs(-a*point.x +point.y - b) /…